fix: update aes

This commit is contained in:
2023-10-16 19:32:37 +08:00
parent 597a62998b
commit 0225398727
4 changed files with 22 additions and 13 deletions

View File

@@ -1,37 +1,34 @@
from pwn import *
from flag import flag
from Crypto.Cipher import AES
from hashlib import sha256
import base64
flag = b''
first_flag = b''
wordlist = b'123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM{}_'
wordlist = b'0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM{}_'
for i in range(16):
for j in wordlist:
r = remote("127.0.0.1", 10002)
r = remote("172.20.14.117", 65311)
payload = b'0'*(16-5) + b'0' * (15 - i)\
+ first_flag + j.to_bytes() + \
b'0' * (15 - i)
r.sendline(payload)
cipher = r.recvline()
r.close()
cipher = base64.b64decode(cipher)
if cipher[16:32] == cipher[32:48]:
first_flag = first_flag + j.to_bytes()
break
last_flag = b''
for i in range(21-16):
for j in wordlist:
r = remote("127.0.0.1", 10002)
r = remote("172.20.14.117", 65311)
payload = b'0' * 11 + j.to_bytes() + \
last_flag + b'0' * 27
r.sendline(payload)
cipher = r.recvline()
r.close()
cipher= base64.b64decode(cipher)
if cipher[16:32] == cipher[64:80]:
last_flag = j.to_bytes() + last_flag
break
break
print(first_flag + last_flag)