Created
August 12, 2019 13:25
-
-
Save st98/00a53f1289058c5f7443ba4352501243 to your computer and use it in GitHub Desktop.
InterKosenCTF - pascal homomorphicity
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
from pwn import * | |
s = remote('crypto.kosenctf.com', 8002) | |
s.recvline() | |
encrypted = int(s.recvline()) | |
s.recvline() | |
table = ''.join(sorted('{}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_- !?#')) | |
l = 48 | |
known = 'KosenCTF{' | |
for _ in range(len(known), l): | |
p = '' | |
for c in table: | |
temp = int((known + c).ljust(l, '\0').encode('hex'), 16) | |
s.recvuntil('> ') | |
s.sendline(str(temp)) | |
s.recvline() | |
res = int(s.recvline()) | |
if res > encrypted: | |
known += p | |
break | |
p = c | |
print known |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment