Skip to content
Snippets Groups Projects
Commit aeb4c331 authored by Dominik Fuhrmann's avatar Dominik Fuhrmann
Browse files

improved scripts

parent 7025de00
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,10 @@ from Crypto.PublicKey import RSA ...@@ -7,7 +7,10 @@ from Crypto.PublicKey import RSA
from Crypto.Util.Padding import pad from Crypto.Util.Padding import pad
from Crypto.Random import get_random_bytes from Crypto.Random import get_random_bytes
import base64 import base64
from ../setup/logging.py import configure_logging, user_input import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'setup')))
from custom_logging import configure_logging, user_input
# Load the RSA public key to encrypt the key # Load the RSA public key to encrypt the key
def load_public_key(): def load_public_key():
...@@ -76,7 +79,7 @@ def main(): ...@@ -76,7 +79,7 @@ def main():
configure_logging() configure_logging()
# server information # server information
host = '127.0.0.1' host = '192.168.178.51'
port = 12345 port = 12345
# Load RSA public key (for encrypting the key) # Load RSA public key (for encrypting the key)
......
...@@ -6,7 +6,10 @@ from Crypto.Cipher import DES, Blowfish, ARC4, PKCS1_OAEP ...@@ -6,7 +6,10 @@ from Crypto.Cipher import DES, Blowfish, ARC4, PKCS1_OAEP
from Crypto.PublicKey import RSA from Crypto.PublicKey import RSA
from Crypto.Util.Padding import unpad from Crypto.Util.Padding import unpad
import base64 import base64
from ../setup/logging.py import configure_logging, user_input import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'setup')))
from custom_logging import configure_logging, user_input
# Load the RSA private key to decrypt the key # Load the RSA private key to decrypt the key
def load_private_key(): def load_private_key():
...@@ -100,7 +103,7 @@ def main(): ...@@ -100,7 +103,7 @@ def main():
configure_logging() configure_logging()
# server information # server information
host = '127.0.0.1' host = '192.168.178.51'
port = 12345 port = 12345
# Load RSA private key (for decrypting the key) # Load RSA private key (for decrypting the key)
......
...@@ -2,31 +2,77 @@ import logging ...@@ -2,31 +2,77 @@ import logging
from Crypto.Cipher import Blowfish from Crypto.Cipher import Blowfish
from Crypto.Util.Padding import unpad from Crypto.Util.Padding import unpad
import itertools import itertools
import base64 import sys
from logger import setup_logging # Import logging configuration import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'setup')))
from custom_logging import configure_logging
def brute_force_blowfish_128(ciphertext_base64, iv_hex): # Brute-force attack on Blowfish encryption (128-bit block size)
ciphertext = base64.b64decode(ciphertext_base64) def brute_force_blowfish(ciphertext_hex, expected_plaintext, debug_key=None):
iv = bytes.fromhex(iv_hex) # Convert the hex string to bytes
decoded_ciphertext = bytes.fromhex(ciphertext_hex)
logging.info("Starting brute-force for Blowfish (128-bit key)...") # Extract the IV (the first 8 bytes)
for key in itertools.product(range(256), repeat=16): # 128-bit key iv = decoded_ciphertext[:8]
ciphertext = decoded_ciphertext[8:] # The rest is the encrypted text
logging.info(f"Extracted IV (Hex): {iv.hex()}")
logging.info("Starting brute-force for Blowfish with 128-bit keys...")
# Optional debug key
if debug_key:
try:
key = bytes.fromhex(debug_key)
cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
plaintext = unpad(cipher.decrypt(ciphertext), Blowfish.block_size)
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with debug key {key.hex()}")
return plaintext.decode()
else:
logging.warning("Debug key provided but failed to match the expected plaintext.")
except Exception as e:
logging.error(f"Error with debug key: {e}")
# Brute-force key generation: all possible 8-byte keys (128 bits)
for key in itertools.product(range(256), repeat=16):
key = bytes(key) key = bytes(key)
try: try:
# Decrypt with the generated key
cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv) cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
plaintext = unpad(cipher.decrypt(ciphertext), Blowfish.block_size) plaintext = unpad(cipher.decrypt(ciphertext), Blowfish.block_size)
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode() # Check if the decrypted text matches the expected plaintext
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode()
except Exception: except Exception:
continue continue
logging.error("No matching key found.") logging.error("No matching key found.")
return None return None
def main(): def main():
setup_logging() # Set up logging # Configure colored logging
ciphertext_base64 = input("Enter the Blowfish-encrypted text (Base64): ").strip() configure_logging()
iv_hex = input("Enter the initialization vector (IV) in hexadecimal (16 characters): ").strip()
brute_force_blowfish_128(ciphertext_base64, iv_hex) # Input the encrypted text as a hex string
ciphertext_hex = input("Enter the Blowfish-encrypted text (Hex, including IV): ").strip()
# Optionally provide a debug key
debug_key = input("Enter a debug key in hex (or press Enter to skip): ").strip()
if not debug_key:
debug_key = None
# Define the expected plaintext
expected_plaintext = "Test"
# Call brute-force decryption
result = brute_force_blowfish(ciphertext_hex, expected_plaintext, debug_key)
if result:
logging.info(f"Decrypted text: {result}")
else:
logging.error("Failed to decrypt the ciphertext.")
if __name__ == "__main__": if __name__ == "__main__":
main() main()
\ No newline at end of file
...@@ -2,31 +2,77 @@ import logging ...@@ -2,31 +2,77 @@ import logging
from Crypto.Cipher import Blowfish from Crypto.Cipher import Blowfish
from Crypto.Util.Padding import unpad from Crypto.Util.Padding import unpad
import itertools import itertools
import base64 import sys
from logger import setup_logging # Import logging configuration import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'setup')))
from custom_logging import configure_logging
def brute_force_blowfish_64(ciphertext_base64, iv_hex): # Brute-force attack on Blowfish encryption (64-bit block size)
ciphertext = base64.b64decode(ciphertext_base64) def brute_force_blowfish(ciphertext_hex, expected_plaintext, debug_key=None):
iv = bytes.fromhex(iv_hex) # Convert the hex string to bytes
decoded_ciphertext = bytes.fromhex(ciphertext_hex)
logging.info("Starting brute-force for Blowfish (64-bit key)...") # Extract the IV (the first 8 bytes)
iv = decoded_ciphertext[:8]
ciphertext = decoded_ciphertext[8:] # The rest is the encrypted text
logging.info(f"Extracted IV (Hex): {iv.hex()}")
logging.info("Starting brute-force for Blowfish with 64-bit keys...")
# Optional debug key
if debug_key:
try:
key = bytes.fromhex(debug_key)
cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
plaintext = unpad(cipher.decrypt(ciphertext), Blowfish.block_size)
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with debug key {key.hex()}")
return plaintext.decode()
else:
logging.warning("Debug key provided but failed to match the expected plaintext.")
except Exception as e:
logging.error(f"Error with debug key: {e}")
# Brute-force key generation: all possible 8-byte keys (64 bits)
for key in itertools.product(range(256), repeat=8): for key in itertools.product(range(256), repeat=8):
key = bytes(key) key = bytes(key)
try: try:
# Decrypt with the generated key
cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv) cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
plaintext = unpad(cipher.decrypt(ciphertext), Blowfish.block_size) plaintext = unpad(cipher.decrypt(ciphertext), Blowfish.block_size)
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode() # Check if the decrypted text matches the expected plaintext
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode()
except Exception: except Exception:
continue continue
logging.error("No matching key found.") logging.error("No matching key found.")
return None return None
def main(): def main():
setup_logging() # Set up logging # Configure colored logging
ciphertext_base64 = input("Enter the Blowfish-encrypted text (Base64): ").strip() configure_logging()
iv_hex = input("Enter the initialization vector (IV) in hexadecimal (16 characters): ").strip()
brute_force_blowfish_64(ciphertext_base64, iv_hex) # Input the encrypted text as a hex string
ciphertext_hex = input("Enter the Blowfish-encrypted text (Hex, including IV): ").strip()
# Optionally provide a debug key
debug_key = input("Enter a debug key in hex (or press Enter to skip): ").strip()
if not debug_key:
debug_key = None
# Define the expected plaintext
expected_plaintext = "Test"
# Call brute-force decryption
result = brute_force_blowfish(ciphertext_hex, expected_plaintext, debug_key)
if result:
logging.info(f"Decrypted text: {result}")
else:
logging.error("Failed to decrypt the ciphertext.")
if __name__ == "__main__": if __name__ == "__main__":
main() main()
\ No newline at end of file
...@@ -2,30 +2,77 @@ import logging ...@@ -2,30 +2,77 @@ import logging
from Crypto.Cipher import DES from Crypto.Cipher import DES
from Crypto.Util.Padding import unpad from Crypto.Util.Padding import unpad
import itertools import itertools
import base64 import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'setup')))
from custom_logging import configure_logging
def brute_force_des(ciphertext_base64, iv_hex): # Brute-force attack on DES encryption
ciphertext = base64.b64decode(ciphertext_base64) def brute_force_des(ciphertext_hex, expected_plaintext, debug_key=None):
iv = bytes.fromhex(iv_hex) # Convert the hex string to bytes
decoded_ciphertext = bytes.fromhex(ciphertext_hex)
# Extract the IV (the first 8 bytes)
iv = decoded_ciphertext[:8]
ciphertext = decoded_ciphertext[8:] # The rest is the encrypted text
logging.info(f"Extracted IV (Hex): {iv.hex()}")
logging.info("Starting brute-force for DES (64-bit key)...") logging.info("Starting brute-force for DES (64-bit key)...")
# Optional debug key
if debug_key:
try:
key = bytes.fromhex(debug_key)
cipher = DES.new(key, DES.MODE_CBC, iv)
plaintext = unpad(cipher.decrypt(ciphertext), DES.block_size)
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with debug key {key.hex()}")
return plaintext.decode()
else:
logging.warning("Debug key provided but failed to match the expected plaintext.")
except Exception as e:
logging.error(f"Error with debug key: {e}")
# Brute-force key generation: all possible 8-byte keys
for key in itertools.product(range(256), repeat=8): for key in itertools.product(range(256), repeat=8):
key = bytes(key) key = bytes(key)
try: try:
# Decrypt with the generated key
cipher = DES.new(key, DES.MODE_CBC, iv) cipher = DES.new(key, DES.MODE_CBC, iv)
plaintext = unpad(cipher.decrypt(ciphertext), DES.block_size) plaintext = unpad(cipher.decrypt(ciphertext), DES.block_size)
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode() # Check if the decrypted text matches the expected plaintext
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode()
except Exception: except Exception:
continue continue
logging.error("No matching key found.") logging.error("No matching key found.")
return None return None
def main(): def main():
setup_logging() # Configure colored logging
ciphertext_base64 = input("Enter the DES-encrypted text (Base64): ").strip() configure_logging()
iv_hex = input("Enter the initialization vector (IV) in hexadecimal (16 characters): ").strip()
brute_force_des(ciphertext_base64, iv_hex) # Input the encrypted text as a hex string
ciphertext_hex = input("Enter the DES-encrypted text (Hex, including IV): ").strip()
# Optionally provide a debug key
debug_key = input("Enter a debug key in hex (or press Enter to skip): ").strip()
if not debug_key:
debug_key = None
# Define the expected plaintext
expected_plaintext = "Test"
# Call brute-force decryption
result = brute_force_des(ciphertext_hex, expected_plaintext, debug_key)
if result:
logging.info(f"Decrypted text: {result}")
else:
logging.error("Failed to decrypt the ciphertext.")
if __name__ == "__main__": if __name__ == "__main__":
main() main()
\ No newline at end of file
import logging import logging
from Crypto.Cipher import ARC4 from Crypto.Cipher import ARC4
import itertools import itertools
import base64 import sys
from logger import setup_logging # Import logging configuration import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'setup')))
from custom_logging import configure_logging
def brute_force_rc4_128(ciphertext_base64): # Brute-force attack on RC4 encryption (128-bit key)
ciphertext = base64.b64decode(ciphertext_base64) def brute_force_rc4(ciphertext_hex, expected_plaintext, debug_key=None):
# Convert the hex string to bytes
ciphertext = bytes.fromhex(ciphertext_hex)
logging.info("Starting brute-force for RC4 (128-bit key)...") logging.info("Starting brute-force for RC4 with 128-bit keys...")
for key in itertools.product(range(256), repeat=16): # 128-bit key
# Optional debug key
if debug_key:
try:
key = bytes.fromhex(debug_key)
cipher = ARC4.new(key)
plaintext = cipher.decrypt(ciphertext)
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with debug key {key.hex()}")
return plaintext.decode()
else:
logging.warning("Debug key provided but failed to match the expected plaintext.")
except Exception as e:
logging.error(f"Error with debug key: {e}")
# Brute-force key generation: all possible 16-byte keys (128 bits)
for key in itertools.product(range(256), repeat=16):
key = bytes(key) key = bytes(key)
try: try:
# Decrypt with the generated key
cipher = ARC4.new(key) cipher = ARC4.new(key)
plaintext = cipher.decrypt(ciphertext) plaintext = cipher.decrypt(ciphertext)
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode() # Check if the decrypted text matches the expected plaintext
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode()
except Exception: except Exception:
continue continue
logging.error("No matching key found.") logging.error("No matching key found.")
return None return None
def main(): def main():
setup_logging() # Set up logging # Configure colored logging
ciphertext_base64 = input("Enter the RC4-encrypted text (Base64): ").strip() configure_logging()
brute_force_rc4_128(ciphertext_base64)
# Input the encrypted text as a hex string
ciphertext_hex = input("Enter the RC4-encrypted text (Hex): ").strip()
# Optionally provide a debug key
debug_key = input("Enter a debug key in hex (or press Enter to skip): ").strip()
if not debug_key:
debug_key = None
# Define the expected plaintext
expected_plaintext = "Test"
# Call brute-force decryption
result = brute_force_rc4(ciphertext_hex, expected_plaintext, debug_key)
if result:
logging.info(f"Decrypted text: {result}")
else:
logging.error("Failed to decrypt the ciphertext.")
if __name__ == "__main__": if __name__ == "__main__":
main() main()
\ No newline at end of file
import logging import logging
from Crypto.Cipher import ARC4 from Crypto.Cipher import ARC4
import itertools import itertools
import base64 import sys
from logger import setup_logging # Import logging configuration import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'setup')))
from custom_logging import configure_logging
def brute_force_rc4(ciphertext_base64): # Brute-force attack on RC4 encryption (64-bit key)
ciphertext = base64.b64decode(ciphertext_base64) def brute_force_rc4(ciphertext_hex, expected_plaintext, debug_key=None):
# Convert the hex string to bytes
ciphertext = bytes.fromhex(ciphertext_hex)
logging.info("Starting brute-force for RC4 (64-bit key)...") logging.info("Starting brute-force for RC4 with 64-bit keys...")
for key in itertools.product(range(256), repeat=8): # 64-bit key
# Optional debug key
if debug_key:
try:
key = bytes.fromhex(debug_key)
cipher = ARC4.new(key)
plaintext = cipher.decrypt(ciphertext)
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with debug key {key.hex()}")
return plaintext.decode()
else:
logging.warning("Debug key provided but failed to match the expected plaintext.")
except Exception as e:
logging.error(f"Error with debug key: {e}")
# Brute-force key generation: all possible 8-byte keys (64 bits)
for key in itertools.product(range(256), repeat=8):
key = bytes(key) key = bytes(key)
try: try:
# Decrypt with the generated key
cipher = ARC4.new(key) cipher = ARC4.new(key)
plaintext = cipher.decrypt(ciphertext) plaintext = cipher.decrypt(ciphertext)
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode() # Check if the decrypted text matches the expected plaintext
if plaintext.decode() == expected_plaintext:
logging.info(f"Decrypted successfully: {plaintext.decode()} with key {key.hex()}")
return plaintext.decode()
except Exception: except Exception:
continue continue
logging.error("No matching key found.") logging.error("No matching key found.")
return None return None
def main(): def main():
setup_logging() # Set up logging # Configure colored logging
ciphertext_base64 = input("Enter the RC4-encrypted text (Base64): ").strip() configure_logging()
brute_force_rc4(ciphertext_base64)
# Input the encrypted text as a hex string
ciphertext_hex = input("Enter the RC4-encrypted text (Hex): ").strip()
# Optionally provide a debug key
debug_key = input("Enter a debug key in hex (or press Enter to skip): ").strip()
if not debug_key:
debug_key = None
# Define the expected plaintext
expected_plaintext = "Test"
# Call brute-force decryption
result = brute_force_rc4(ciphertext_hex, expected_plaintext, debug_key)
if result:
logging.info(f"Decrypted text: {result}")
else:
logging.error("Failed to decrypt the ciphertext.")
if __name__ == "__main__": if __name__ == "__main__":
main() main()
\ No newline at end of file
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA3rQBwcolop8zkonx/+JsyvWtMGBxdXBNRufBnc5nIF+pKjpc MIIEogIBAAKCAQEAxjw3DrDWxWtPLWdyGbNTMMUlDXmR+nFItaif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IIBCgKCAQEA3rQBwcolop8zkonx/+Js MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxjw3DrDWxWtPLWdyGbNT
yvWtMGBxdXBNRufBnc5nIF+pKjpcBTLTdlZx2K85Xj1Rz1waGOdf78oBECfeOb6c MMUlDXmR+nFItaifmR9BFnbVVGMEXwr6BMrtdDOqPkP544c7HzpIsnTfncs0DLvc
keLm86JliQlKS9vkEROuxfagO5jz2qW/BHuYIbxS0O9vdrShoC8tw+qci1pMsVu7 c0YGXgst1Yeoh5IugoUj4bU65f/1JUaXJniTAPUBOAKLNSweUmzRTeXMbpI5M1Es
IBLHMO+mJ3NLVCv9HL+fAYRntrpEyx+j9HdZqmyJRriWrHCjN1/dnJoUt5dABGXT 3ZTBVhFZ10xVPJQu20EkYcPrf7bX+ALvNackyXfnLd1aUKGPggFwKMcmfiXPFlJZ
Iny0BlUQJE5CrfP7oGb0fCvzO5MsSy5/W9rl2O8bZLbbNXJxDoWzsM87YLL7SqUw Jyr9vUoGepu/LOihVliM8s7dHV+76uqBRx5sKarY2TLq+CzRWOcSH6Jp/EeJXE+c
q2SDZpy6DPO+NW9S3tqplwoI+CqjtId5t9FbZ/eQJXSm2bCUAl8MMToUQp9385ew e/mpZuBHMpKhE1NB9fIjYB0qq8Es0TD//pTi9d9gA2khcw3rNS9TrTV90i52JDGb
3wIDAQAB RQIDAQAB
-----END PUBLIC KEY----- -----END PUBLIC KEY-----
\ No newline at end of file
File moved
...@@ -7,10 +7,10 @@ def main(): ...@@ -7,10 +7,10 @@ def main():
public_key = private_key.publickey() public_key = private_key.publickey()
# Save as files # Save as files
with open('private.pem', 'wb') as private_file: with open('../keys/private.pem', 'wb') as private_file:
private_file.write(private_key.export_key()) private_file.write(private_key.export_key())
with open('public.pem', 'wb') as public_file: with open('../keys/public.pem', 'wb') as public_file:
public_file.write(public_key.export_key()) public_file.write(public_key.export_key())
print("RSA-keys generated and saved.") print("RSA-keys generated and saved.")
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment