Sending and Receiving Data |
conn.send(s) |
Send the string s . |
conn.sendline(s) |
Send the string s and a newline. |
s = conn.recv(n) |
Receive up to n bytes. |
s = conn.recvn(n) |
Receive exactly n bytes. |
s = conn.recvline() |
Receive up to and including a newline. |
s = conn.recvuntil(prompt) |
Receive up to and including the string prompt . |
s = conn.recvregex(regex) |
Receive up to and including something that matches regex . |
s = conn.recvall() |
Receive everything until the connection closes. |
conn.sendlineafter(prompt, s) |
Receive until prompt , then send the string s . |
conn.interactive() |
Drop into interactive mode. |
Shellcraft |
asm = pwn.shellcraft.sh() |
Generate assembly that opens an interactive shell. |
asm = pwn.shellcraft.cat(path) |
Generate assembly that dumps the file at path . |
asm = pwn.shellcraft.exit(code) |
Generate assembly that exits with code code . |
asm = pwn.shellcraft.nop() |
Generate assembly for a single-byte no-op. |
bin = pwn.asm(asm) |
Assembles asm into a binary snippet. |
asm = pwn.disasm(bin) |
Disassembles bin into assembly. |
Context Control |
pwn.context.log_level = "debug" |
Log all traffic through your connection. |
pwn.context.log_level = "warn" |
Don't log unless something goes wrong. |
pwn.context.arch = "i386" |
Set the target CPU architecture. |
pwn.context.os = "linux" |
Set the target operating system. |
pwn.context.endian = "big" |
Set the target endianness. |
pwn.context.word_size = 32 |
Set the target word size. |
pwn.context(arch="arm", ...) |
Set any of the above in a single line. |