Пример #1
0
def is_admin(ct):
	pt = aes.decrypt_cbc(ct, key)
	cookies = []
	for i in pt.split(';'):
		parts = i.split('=')
		if len(parts) != 2:
			raise InvalidCookie()
		if parts[0] == 'admin' and parts[1] == 'true':
			return True
	return False
Пример #2
0
def valid_padding(ct):
	try:
		aes.decrypt_cbc(ct, key)
	except aes.InvalidPadding:
		return False
	return True
Пример #3
0
def consume_ct(ct):
    pt = aes.decrypt_cbc(key + ct, key)

    if not util.is_ascii(pt):
        raise NonAscii(pt)
Пример #4
0
def recv_ct(con, key):
    '''reads <len> <aes cbc encrypted msg>'''
    return aes.decrypt_cbc(recv_len_payload(con), key)
Пример #5
0
import aes
import base64

with open('10.txt', 'r') as f:
    ct = base64.b64decode(''.join(f.read().split()))

key = "YELLOW SUBMARINE"

print aes.decrypt_cbc('\x00' * 16 + ct, key)