def encrypt_aes_ecb_same_key(data): return crypto.aes_encrypt_ecb(random_string + data + unknown_string, key)
key = os.urandom(16) # We want to provide an email that is long enough to stretch over # a block barrier. Just after that barrier we want a block that says # "admin". # [email protected]&uid=10&role=user # 0123456789ABCDEF0123456789ABCDEF email = "" email += "*****@*****.**" email += "admin".ljust(16, '\x00') profile = profile_for(email) params = encode_params(profile) print "[*]Encrypting params:\n{}".format(params) ct = crypto.aes_encrypt_ecb(params, key) print "[*]Here's your ct:\n{}".format(ct.encode('hex')) # Snip out the 'admin' block. admin = ct[16:32] # Now request a second encoding that has a email whose length puts the # start of the role into its own block at the end # email=Much_Long_yes&uid=10&role=user # 0123456789ABCDEF0123456789ABCDEF email = "Much_Long_Wow" profile = profile_for(email) params = encode_params(profile) print "[*]Encrypting params:\n{}".format(params) ct = crypto.aes_encrypt_ecb(params, key) print "[*]Here's your ct:\n{}".format(ct.encode('hex'))