-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathnetlas_cve_surface_check.py
More file actions
50 lines (39 loc) · 1.51 KB
/
netlas_cve_surface_check.py
File metadata and controls
50 lines (39 loc) · 1.51 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import netlas
import time
import re
if __name__ == '__main__':
api_key='yourAPIKey'
netlas_connection = netlas.Netlas(api_key=api_key)
res = 0
print("File with your surface: ")
fileName = input()
inputFile = open(fileName, "r")
print("Do you want to search by pattern or CVE?\n1 - Pattern;\n2 - CVE.")
choose = input()
if (int(choose) == 2):
print("Vulnerability: ")
vuln = input()
else:
print("\nI hope you have added the required request to the script\n")
while True:
line = inputFile.readline()
if not line:
break
reg = re.match(r'([0-9]{1,3}[\.]){3}[0-9]{1,3}', line, 0)
if reg:
if (int(choose) == 1):
sQuery = "http.headers.server:""Microsoft-IIS"" AND host:" + line.replace("\n", "")
else:
sQuery = "cve.name:" + vuln + " AND host:" + line.replace("\n", "")
else:
if (int(choose) == 1):
sQuery="http.headers.server:""Microsoft-IIS"" AND host:*." + line.replace("\n","")
else:
sQuery="cve.name:" + vuln + " AND host:*." + line.replace("\n","")
cnt_of_res = netlas_connection.count(query=sQuery, datatype='response')
if cnt_of_res['count'] != 0:
res += 1
print(line.replace("\n","") + " is probably vulnerable")
time.sleep(1)
print("Now: " + str(res))
print("\nThere are " + str(res) + " probably vulnerable objects from your surface")