コード例 #1
0
def constrained_aes(incoming_shellcode):
    """
    Generates a constrained AES key which is later brute forced
    in a loop
    """
    # Create our constrained Key
    small_key = helpers.randomKey(25)

    # Actual Key used
    real_key = small_key + str(helpers.randomNumbers())

    # Create Cipher Object with Generated Secret Key
    aes_cipher_object = AES.new(real_key, AES.MODE_ECB)

    # Prep for manipulation (this is really for python stallion only)
    # If this function as a whole is needed for another language
    # It should probably be rewritten without this step
    incoming_shellcode = incoming_shellcode.encode('latin-1')
    incoming_shellcode = incoming_shellcode.decode('unicode_escape')

    # Pad the shellcode
    padded_shellcode = encryption_padding(incoming_shellcode, '*')

    # actually encrypt the shellcode
    encrypted_shellcode = aes_cipher_object.encrypt(padded_shellcode)

    # Base64 encode the encrypted shellcode
    encoded_ciphertext = base64.b64encode(encrypted_shellcode)

    # return a tuple of (encodedText, small constrained key, actual key used)
    return encoded_ciphertext, small_key, real_key
コード例 #2
0
ファイル: encryption.py プロジェクト: Veil-Framework/Veil
def constrained_aes(incoming_shellcode):
    """
    Generates a constrained AES key which is later brute forced
    in a loop
    """
    # Create our constrained Key
    small_key = helpers.randomKey(25)

    # Actual Key used
    real_key = small_key + str(helpers.randomNumbers())

    # Create Cipher Object with Generated Secret Key
    aes_cipher_object = AES.new(real_key, AES.MODE_ECB)

    # Prep for manipulation (this is really for python stallion only)
    # If this function as a whole is needed for another language
    # It should probably be rewritten without this step
    incoming_shellcode = incoming_shellcode.encode('latin-1')
    incoming_shellcode = incoming_shellcode.decode('unicode_escape')

    # Pad the shellcode
    padded_shellcode = encryption_padding(incoming_shellcode, '*')

    # actually encrypt the shellcode
    encrypted_shellcode = aes_cipher_object.encrypt(padded_shellcode)

    # Base64 encode the encrypted shellcode
    encoded_ciphertext = base64.b64encode(encrypted_shellcode)

    # return a tuple of (encodedText, small constrained key, actual key used)
    return encoded_ciphertext, small_key, real_key
コード例 #3
0
def arc_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_arc_key = helpers.randomKey()
    arc_cipher_object = ARC4.new(random_arc_key)
    padded_shellcode = encryption_padding(incoming_shellcode)
    encrypted_shellcode = arc_cipher_object.encrypt(padded_shellcode)
    encoded_ciphertext = base64.b64encode(encrypted_shellcode)
    return encoded_ciphertext, random_arc_key
コード例 #4
0
ファイル: encryption.py プロジェクト: Veil-Framework/Veil
def arc_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_arc_key = helpers.randomKey()
    arc_cipher_object = ARC4.new(random_arc_key)
    padded_shellcode = encryption_padding(incoming_shellcode)
    encrypted_shellcode = arc_cipher_object.encrypt(padded_shellcode)
    encoded_ciphertext = base64.b64encode(encrypted_shellcode)
    return encoded_ciphertext, random_arc_key
コード例 #5
0
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
コード例 #6
0
ファイル: encryption.py プロジェクト: Veil-Framework/Veil
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