Created
April 14, 2019 19:12
-
-
Save Creased/3b036da5b52e0e990bcc7c3e3052182f to your computer and use it in GitHub Desktop.
BreizhCTF 2019 - Hallowed be thy name
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
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