pwntools
提示
在pwntools下,其实是可以自动生成shellcode脚本的,我们先看一下,利用pwntools的shellcode要注意的是你要表明系统和版本不进行表明生成的是32位的。
from pwn import *
print(shellcraft.sh())
/* execve(path='/bin///sh', argv=['sh'], envp=0) */
/* push b'/bin///sh\x00' */
push 0x68
push 0x732f2f2f
push 0x6e69622f
mov ebx, esp
/* push argument array ['sh\x00'] */
/* push 'sh\x00\x00' */
push 0x1010101
xor dword ptr [esp], 0x1016972
xor ecx, ecx
push ecx /* null terminate */
push 4
pop ecx
add ecx, esp
push ecx /* 'sh\x00' */
mov ecx, esp
xor edx, edx
/* call execve() */
push SYS_execve /* 0xb */
pop eax
int 0x80
如果进行表明系统,那么结果是不一样的,这个自动输出的是32位的shellcode,我们表明一下系统之后输出shellcode。
from pwn import