-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmalw_scan_it.py
107 lines (103 loc) · 4.53 KB
/
malw_scan_it.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import os, glob, sys
def get_filename():
cwd = sys.argv[0]
cwd = list(cwd)
result = ""
for i in cwd:
if i == "/" or i == '\\':
result = result + " "
else:
result = result + i
result = result.split()
final_result = result[(len(result) - 1)]
return final_result
filename = get_filename()
def asktodelete(script):
global script_file
script_file.close()
delete = input("[+] Cancellare il File (yes/no)?: ")
if delete.lower() == "yes":
print(f"[+] Cancellazione: {script}")
os.remove(script)
elif delete.lower() == "no":
print("[+] Questa scelta potrebbe compromettere il tuo pc.")
pass
else:
print(f"[+] File Cancellato: {script}")
os.remove(script)
print("")
print(" ANTI-MALWARE SCAN (per script in python)")
print("")
print(" Questo script analizza i file usando il linguaggio pyhton.")
while True:
try:
directory = input("\n[+] Inserisci il percorso della cartella da analizzare: ")
os.chdir(directory)
pyscripts = glob.glob('*.py') + glob.glob('*.pyw')
for script in pyscripts:
try:
script_file = open(script, 'r')
lines = script_file.readlines()
for line in lines:
if 'os.remove' in line.lower() or 'os.rmdir' in line.lower():
if script == filename:
pass
else:
print(f"\n[+] File {script} Alert: Trojan:FileDel")
print("[+] This file can delete certain files on your computer.")
asktodelete(script)
break
elif 'connect(' in line.lower() or 'sento(' in line.lower() or 'send' in line.lower():
if script == filename:
pass
else:
print(f"\n[+] Script: {script} Alert: Trojan:SockDDoS")
print("[+] Questo script può essere potenzialmente utilizzato in un attacco DDoS.")
asktodelete(script)
break
elif 'os.system' in line.lower():
if script == filename:
pass
else:
print(f"\n[+] Script: {script} Alert: Trojan:Term")
print("[+] Questo script può eseguire i comandi del terminale.")
asktodelete(script)
break
elif 'os.startfile' in line.lower():
if script == filename:
pass
else:
print(f"\n[+] Script: {script} Alert: Trojan:LagCPU")
print(
"[+] Questo file può avviare altri file e potrebbe potenzialmente rallentare il computer.")
asktodelete(script)
break
elif 'open(' in line.lower():
if script == filename:
pass
else:
print(f"\n[+] Script: {script} Alert: Trojan:ReadWriteFiles")
print("[+] Questo file può leggere e scrivere altri file e possibilmente rendere altri file dannosi a tua insaputa.")
asktodelete(script)
break
elif 'never gonna give you up' in line.lower():
if script == filename:
pass
else:
print(f"\n[+] Script: {script} Alert: Trojan:RickRoll")
print("[+] Questo file potrebbe essere un blocco.")
asktodelete(script)
break
elif 'copyfile(' in line.lower():
if script == filename:
pass
else:
print(f"\n[+] Script: {script} Alert: Worm:SelfReplicating")
print("[+] Questo file può clonarsi in altre directory del tuo computer.")
asktodelete(script)
break
except:
pass
print("\n[+] Scansione Completa.")
except:
print("[+] Input non valido.")