def run(self, message):
     message.replace(b';', b'')
     message.replace(b'=', b'')
     message = b'comment1=cooking%20MCs;userdata=' + message + b';comment2=%20like%20a%20pound%20of%20bacon'
     message = pkcs7(message, 16)
     cipher = AES.new(self.key, AES.MODE_CBC, self.IV)
     ciphertext = cipher.encrypt(message)
     return ciphertext
Пример #2
0
def ECB_cut_paste():
    cut_profile = encrypt_profile(b'*****@*****.**')
    cut = cut_profile[:32]
    admin_block = pkcs7(b'admin',16)
    paste_profile = encrypt_profile(b'*****@*****.**'+ admin_block)
    paste = paste_profile[16:32]
    exploit = cut + paste
    exploited_profile = decrypt_profile(exploit,37)
    return exploited_profile
def encryption_oracle(text,key):
    padded_text = front_back_pad(text)
    padded_text = pkcs7(padded_text,16)
    coin = randbelow(2)
    if coin == 0:
        cipher = AES.new(key,AES.MODE_ECB)
        ciphertext = cipher.encrypt(padded_text)
    else:
        initial_vector = random_bytes(16)
        cipher = AES.new(key,AES.MODE_CBC,initial_vector)
        ciphertext = cipher.encrypt(padded_text)
    return ciphertext
 def run(self, your_string):
     whole_string = pkcs7(self.prefix + your_string + ORIGINAL_TEXT, 16)
     return self.cipher.encrypt(whole_string)
Пример #5
0
def encrypt_profile(email):
    encoded = profile_for(email)
    encoded = pkcs7(encoded,16)
    ciphertext = CIPHER.encrypt(encoded)
    return ciphertext