Created
September 6, 2020 15:16
-
-
Save hyunsikjeong/685d28eef253a542c6e5791f3b02bb92 to your computer and use it in GitHub Desktop.
bitcrypto
This file contains hidden or 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 Crypto.Util.number import * | |
from pwn import * | |
r = remote("crypto.kosenctf.com", 13003) | |
r.recvuntil("your query: ") | |
r.sendline('b') | |
l = r.recvuntil('\n') | |
c = [int(x) for x in l.split('[')[1].split(']')[0].split(",")] | |
one, zero = c[0], c[2] | |
keyword = "yoshiking, give me ur flag" | |
bits = [int(b) for b in "{:b}".format(bytes_to_long(keyword))] | |
new_c = [] | |
for b in bits: | |
if b == 1: | |
new_c.append(one) | |
one *= 4 | |
else: | |
new_c.append(zero) | |
zero *= 4 | |
r.sendline('[' + ','.join(str(v) for v in new_c) + ']') | |
r.interactive() | |
r.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment