Skip to content

Instantly share code, notes, and snippets.

@MrMugiwara
Forked from faidamine/serial_misc50.py
Created September 17, 2017 23:22
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 MrMugiwara/c777d972c8a806457d9b803ad7cacc06 to your computer and use it in GitHub Desktop.
Save MrMugiwara/c777d972c8a806457d9b803ad7cacc06 to your computer and use it in GitHub Desktop.
#usr/bin/python
#Faid Mohammed Amine
#Fb : piratuer
from pwn import *
import sys
def main():
con = remote('misc.chal.csaw.io', 4239)
con.recvline()
while True:
bins = con.recvline().strip()
assert bins[0] == '0'
assert bins[-1] == '1'
bs = map(int, list(bins))[1:-1]
pty = bs[-1]
cs = bs[:-1]
if cs.count(1) % 2 == pty:
sys.stdout.write(chr(int(bins[1:-2], 2)))
con.sendline('1')
else:
con.sendline('0')
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment