[FREE] Program to propperly destroy files, corrupt, encrypt, and delete.
by Interpol404 - Sunday June 2, 2024 at 08:43 PM
#1
Here is a Python program that I made a while ago to help securely delete files. It encrypts using AES 256, Blowfish (which at this point is overkill), Overwrites, and deletes. Enjoy

import os import shutil import random import string from Crypto.Cipher import AES, Blowfish from Crypto.Random import get_random_bytes from multiprocessing import Pool, cpu_count def generate_random_key(length):     return get_random_bytes(length) def generate_random_name(length=10):     characters = string.ascii_letters + string.digits     return ''.join(random.choice(characters) for _ in range(length)) def encrypt_aes(data, key):     cipher = AES.new(key, AES.MODE_EAX)     nonce = cipher.nonce     ciphertext, tag = cipher.encrypt_and_digest(data)     return nonce + tag + ciphertext def decrypt_aes(encrypted_data, key):     nonce = encrypted_data[:16]     tag = encrypted_data[16:32]     ciphertext = encrypted_data[32:]     cipher = AES.new(key, AES.MODE_EAX, nonce=nonce)     decrypted_data = cipher.decrypt_and_verify(ciphertext, tag)     return decrypted_data def encrypt_blowfish(data, key):     cipher = Blowfish.new(key, Blowfish.MODE_EAX)     nonce = cipher.nonce     ciphertext, tag = cipher.encrypt_and_digest(data)     return nonce + tag + ciphertext def decrypt_blowfish(encrypted_data, key):     nonce = encrypted_data[:8]     tag = encrypted_data[8:16]     ciphertext = encrypted_data[16:]     cipher = Blowfish.new(key, Blowfish.MODE_EAX, nonce=nonce)     decrypted_data = cipher.decrypt_and_verify(ciphertext, tag)     return decrypted_data def rename_files_and_folders(directory):     for root, dirs, files in os.walk(directory, topdown=False):         for filename in files:             file_path = os.path.join(root, filename)             new_name = generate_random_name()             os.rename(file_path, os.path.join(root, new_name))         for folder in dirs:             folder_path = os.path.join(root, folder)             new_name = generate_random_name()             os.rename(folder_path, os.path.join(root, new_name)) def process_file(file_path):     try:         with open(file_path, 'rb') as f:             file_content = f.read()         # Generate random keys for encryption         aes_key = generate_random_key(16)         blowfish_key = generate_random_key(16)         encrypted_aes = encrypt_aes(file_content, aes_key)         encrypted_aes_key = encrypt_blowfish(aes_key, blowfish_key)         with open(file_path, 'wb') as f:             f.write(encrypted_aes_key + encrypted_aes)         os.remove(file_path)         print(f"File '{file_path}' shredded and deleted.")     except Exception as e:         print(f"An error occurred for file '{file_path}': {e}") def shred_files(directory):     try:         rename_files_and_folders(directory)         files_to_process = []         for root, dirs, files in os.walk(directory):             for filename in files:                 file_path = os.path.join(root, filename)                 files_to_process.append(file_path)         num_processes = min(cpu_count(), 4)         with Pool(num_processes) as pool:             pool.map(process_file, files_to_process)         print("All files shredded and deleted successfully.")     except Exception as e:         print(f"An error occurred: {e}") if __name__ == "__main__":     user_directory = input("Enter the directory path: ")         if os.path.exists(user_directory) and os.path.isdir(user_directory):         shred_files(user_directory)     else:         print("Invalid directory path. Please provide a valid directory.")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  | FREE | CRTA Exam Writeup giveaway RedBlock 85 2,362 Yesterday, 05:55 PM
Last Post: pepeplsSad
  [ C|EH v12 ] [ FREE ] Module 04: Enumeration [. PDF ] mrJ3tt 5 703 07-24-2026, 06:39 PM
Last Post: runkzein
  Free Spotify Premium for Any Account (Mobile and Desktop) KaBob 580 54,773 07-24-2026, 04:00 AM
Last Post: fifaman
  {FREE} GET ANYTHING FROM GOOGLE DRIVE lulagain 1,282 34,971 07-23-2026, 01:46 PM
Last Post: themanofsex2
  GET ANY COURSE FOR FREE virgin 288 8,855 07-16-2026, 06:10 PM
Last Post: krisna157



 Users browsing this thread: