Skip to content

Instantly share code, notes, and snippets.

@Creased
Created April 14, 2019 19:12
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 Creased/3b036da5b52e0e990bcc7c3e3052182f to your computer and use it in GitHub Desktop.
Save Creased/3b036da5b52e0e990bcc7c3e3052182f to your computer and use it in GitHub Desktop.
BreizhCTF 2019 - Hallowed be thy name
import base64
from pwn import *
context.log_level = 'info'
PROMPT = '>>> '
def get_con():
p = remote('ctf.bzh', 11000)
return p
def xor(a, b):
cipher = ''
for i in range(len(a)):
cipher += chr(ord(a[i]) ^ ord(b[i]))
return cipher
p = get_con()
p.recvuntil(PROMPT)
p.sendline('1')
p.recvuntil('Enter plain : ')
p.sendline('\x00'*64)
mask = base64.b64decode(p.recvline().split(': ')[1])
p = get_con()
p.recvuntil(PROMPT)
p.sendline('2')
flag = p.recvline()
flag = base64.b64decode(flag.split('Your secret : ', 1)[1])
flag = xor(flag, mask)
print('Flag: %s' % flag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment