import sys import aes import pad key = open('chal_13_key', 'rb').read() c = aes.encrypt_ecb(pad.pkcs7(b'hello', 16), key) c = bytearray(c) #c[0] = 4 c = bytes(c) print(c) p = aes.decrypt_ecb(c, key) print(p)
def load(): with open('25.txt', 'r') as f: ct = base64.b64decode(''.join(f.read().split())) return aes.decrypt_ecb(ct, 'YELLOW SUBMARINE')
import aes import base64 with open('7.txt', 'r') as f: ct = base64.b64decode(''.join(f.read().split())) key = "YELLOW SUBMARINE" print aes.decrypt_ecb(ct, key)
def unoracle(cipher): key = open('chal_13_key', 'rb').read() plain = aes.decrypt_ecb(cipher, key).decode('ascii') return parse(plain)
def is_admin(encrypted_profile): profile = parse_query_string(aes.decrypt_ecb(encrypted_profile, key)) return 'admin' in profile['role']