Code Monkey home page Code Monkey logo

gopwn's Introduction

gopwn

Build Status Go Reference

Golang CTF framework and exploit development module

This module is strictly for educational purposes only. Usage of the methods and tools for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable laws. Developers assume no liability and are not responsible for any misuse or damage caused by this module.

โš ๏ธ This is experimental and subject to breaking changes.

Usage

package main

import (
  "bytes"
  "fmt"

  "github.com/hupe1980/gopwn"
)

func main() {
  p, _ := gopwn.NewProcess([]string{"./ctfbinary"})
  p.SendLine(append(bytes.Repeat([]byte("A"), 200), gopwn.P32L(0xdeadbeef)...))
  out, _ := p.RecvLine()
  fmt.Println(string(out))
}

Packing Integers

//32Bit LittelEndian
b := gopwn.P32L(0xdeadbeef)
assert.Equal(t, []byte("\xef\xbe\xad\xde"), b) // true
i := gopwn.U32L([]byte("\xef\xbe\xad\xde"))
assert.Equal(t, uint32(0xdeadbeef), i) // true

Assembly and Disassembly

insn, _ := gopwn.AssembleI386("mov eax, 0")
fmt.Println(gopwn.HexString(insn))

Outputs:

b800000000
assembly, _ := gopwn.DisamI386([]byte("\xb8\x5d\x00\x00\x00"), 0)
fmt.Println(assembly)

Outputs:

0x0           b8 5d 00 00 00                mov eax, 0x5d

Misc Tools

Generate unique sequences to find offsets in your buffer causing a crash:

assert.Equal(t, []byte("aaaabaaacaaadaaa"), gopwn.Cyclic(16)) // true
assert.Equal(t, 4, gopwn.CyclicFind([]byte("baaa")) // true

Binary Analysis and Manipulation

elf, _ := gopwn.NewELF("./ctfbinary")
pe, _ := gopwn.NewPE("./ctfbinary.exe")
macho, _ := gopwn.NewMACHO("./ctfbinary")

Documentation

See godoc.

Examples

See more complete examples.

CLI

gopwn command-line interface

Usage:
  gopwn [command]

Available Commands:
  cave        Search for code caves
  checksec    Check binary security settings
  completion  Prints shell autocompletion scripts for gopwn
  cyclic      Generation of unique sequences
  help        Help about any command

Flags:
  -h, --help      help for gopwn
  -v, --version   version for gopwn

Use "gopwn [command] --help" for more information about a command.

Installing

You can install the pre-compiled binary in several different ways

deb/rpm/apk:

Download the .deb, .rpm or .apk from the releases page and install them with the appropriate tools.

manually:

Download the pre-compiled binaries from the releases page and copy to the desired location.

License

MIT

gopwn's People

Contributors

hupe1980 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gopwn's Issues

go build error

go build github.com/knightsc/gapstone: build constraints exclude all Go files in C:\Users\admin\go\pkg\mod\github.com\knightsc\[email protected]+incompatible

github.com/keystone-engine/keystone/bindings/go/keystone

C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\arm64_const.go:5:31: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\arm64_const.go:6:31: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\arm64_const.go:7:29: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\arm_const.go:5:29: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\arm_const.go:6:29: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\arm_const.go:7:27: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\evm_const.go:5:29: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\evm_const.go:6:29: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\evm_const.go:7:27: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\hexagon_const.go:5:33: undefined: Error
C:\Users\admin\go\pkg\mod\github.com\keystone-engine\[email protected]\bindings\go\keystone\hexagon_const.go:5:33: too many errors
PS D:\go\gopwn>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.