def des_encryption(incoming_shellcode):
# Generate a random key, create the cipher object
# pad the shellcode, and encrypt the padded shellcode
# return encrypted -> encoded shellcode and key
random_des_key = helpers.randomKey(8)
iv = helpers.randomString(8)
des_cipher_object = DES.new(random_des_key, DES.MODE_CBC, iv)
padded_shellcode = encryption_padding(incoming_shellcode)
encrypted_shellcode = des_cipher_object.encrypt(padded_shellcode)
encoded_ciphertext = base64.b64encode(encrypted_shellcode)
return encoded_ciphertext, random_des_key, iv
评论列表
文章目录