shellcode¶
this contains some niche but useful shellcode
API¶
minshell: ShellcodeSet¶
a very tiny shell as position-independent shellcode. useful for seccomp jails where you can't execve/execveat.
>>> shellcode.minshell
ShellcodeSet('minshell', arches =
['aarch64', 'amd64', 'arm',
'armeb', 'i386', 'mips',
'mipsel', 'powerpc', 'ppcel'])
>>> len(shellcode.minshell.amd64)
1275
>>>
cat: read filesls: list filescd: change directoryexit: quit- anything else is treated as a command to execute
- type
tgto use execveat() over execve()
- type
runcmd(cmd: str, ctx: str | None = None) -> bytes¶
shorthand for linux.execve("/bin/sh", ["/bin/sh", "-c", cmd], 0); run cmd in a shell
listdir(path: str, size: int = 0x1000, ctx: str | None = None) -> bytes¶
list all files in the directory path by dumping the raw dirent structs to stdout, which pwnlib.util.dirents can parse into clean filenames. size is how much stack space you'd like to allocate, the higher the more files can be read
bash_shellcode(asm: bytes, compress: bool = False) -> str¶
wrapper around this to run arbitrary shellcode in bash only using base64, dd, and cut. set compress to true if you'd like your shellcode to be gzip-compressed.