Tags: aes-ecb 

Rating: 2.0

Hello. This is my first time write a Writeups. Thanks for reading
Just post my code first..
https://github.com/phmngcthanh/CTF-solved/blob/master/2020/BSides%20Algiers%202021%20Quals/crypto/aes-ecb.md
```
import socket
from string import *
import base64
host='chall.bsidesalgiers.com'
port= 5002
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
### for some reason that i dont understand, i have to do 2 times recv instead of 1 time recv (4096)
s.recv(1024)
s.recv(1024)
#sometime it will fail at some stage, just type the known flag and it will get the rest of it
flag=''
padding='0'
payload_padding='0'
BLCK_SZ=16
sent=''
#another time for recv :D
s.recv(1024)
len_flag=69
#adjusted from string.printable , for quicker
printable_mod='{_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&()*+-?@}~'

for j in range(len(flag),len_flag):
for i in printable_mod:

sent=flag[-15:]+i
while (len(sent)<16):
sent=payload_padding+sent
sent+=(padding*((16*6)-j-1))
sent=sent+'\n'
#print(sent)
s.sendall(sent.encode())
a=s.recv(2048)
#print(a)
if(len(a) <20):
a=s.recv(1024)
if (a[0:3]==b'The'):
a=a[13:]
if (a.decode().find('=>')):
a=a[:-4]
a=base64.b64decode(a).hex()
#print(a)
if (a[0:32]==a[192:224]):
#print("----------------------------------------------------------------")
#print('FLAG:',end="")
#print(flag+i)
flag+=i
break
print(flag)
```

flag='shellmates{I_though_AES_w4s_m1l1tary_gr4de_encryp7ion_1n_al1_m0des}'

Original writeup (https://github.com/phmngcthanh/CTF-solved).