Extracts TEXT section of a PE, ELF, or Mach-O executable to shellcode
go install github.com/Binject/exec2shell@latest
git clone https://github.com/Binject/exec2shell.git
cd exec2shell
go build .
exec2shell [-h|--help] -i|--in "" [-o|--out ""] [-c|--c-outfile ""] [-n|--c-var ""] [-g|--go-outfile ""] [-p|--go-pkg ""] [-v|--go-var ""]
Arguments: | Short Form | Long Form | Description | Default | | --- | --- | --- | --- | | -h | --help | Print help information | | | -i | --in | Input PE, ELF, or Mach-o binary | | | -o | --out | Output file - Shellcode as Binary | shellcode.bin | | -c | --c-outfile | Output file - Shellcode as C Array | | -n | --c-var | Sets variable name for C Array output. | SHELLCODE | | -g | --go-outfile | Output file - Shellcode as Go Array | | -p | --go-pkg | Sets package string for Go Array output. | shellcode | | -v | --go-var | Sets variable name for Go Array output. | shellcode |
exec2shell -i someprog.exe -o shellcode.bin
exec2shell -i someprog.exe -c shellcode.h -n SHELLCODE_VARNAME
exec2shell -i someprog.exe -g shellcode.go -p mypackage -v GO_VARNAME
exec2shell -i someprog.exe -o shellcode.bin -c shellcode.h -g shellcode.go -p mypackage -n C_VARNAME -v GO_VARNAME
$ claude mcp add exec2shell \
-- python -m otcore.mcp_server <graph>