-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathR4VEN_decrypter.py
46 lines (36 loc) · 1.3 KB
/
R4VEN_decrypter.py
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
import subprocess as command
import os
import re
from ransomware_menager import decrypt
def listDirectories(Dirpath):
for resultado in os.listdir(Dirpath):
result2 = os.popen("file " + Dirpath + resultado)
for arq in result2:
if not re.search(r'directory', arq):
files.append(Dirpath + resultado)
else:
listDirectories(Dirpath + resultado + "/")
path = "directory path do decrypt(Full path works better)" # Remember to put a / at the end E.g: /home/kali/Documents/
files = []
directories = []
listagem = (os.listdir(path))
for file in listagem:
result = os.popen("file " + path + file)
for resu in result:
if not re.search(r"directory", resu):
files.append(str(path + file))
else:
directories.append(path + file + "/")
for direc in directories:
listDirectories(direc)
for decryptFilePath in files:
if re.search(r'.R4VEN', decryptFilePath):
with open(decryptFilePath, 'rb') as arq:
content = arq.read()
arq.close()
content = decrypt(content)
filePath = decryptFilePath.split('.R4VEN')[0]
with open(filePath + content[1], 'wb')as arq:
arq.write(content[0])
arq.close()
command.run(['rm', '-rf', decryptFilePath])