Skip to content

Instantly share code, notes, and snippets.

@hyunsikjeong
Created September 6, 2020 15:16
Show Gist options
  • Save hyunsikjeong/685d28eef253a542c6e5791f3b02bb92 to your computer and use it in GitHub Desktop.
Save hyunsikjeong/685d28eef253a542c6e5791f3b02bb92 to your computer and use it in GitHub Desktop.
bitcrypto
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