-
Notifications
You must be signed in to change notification settings - Fork 1
/
Scanner.py
110 lines (76 loc) · 2.69 KB
/
Scanner.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
108
109
110
import urllib3
import signal
import sys
from Crawler import Crawler
from core.CommonFunctions import *
from SQLi import *
import multiprocessing
import multiprocessing.pool
import AuthBypass
import WeakPasswords
def runScan(target):
crawler = Crawler()
findings = {}
print("Scanning: ", target)
findings.clear()
findings = {"target":target,"sqlinjection":[], "WeakPassword":[]}
if not crawler.init(target):
return
crawler.crawl()
crawler.findLoginPanel()
AuthBypass.check_authbypass(crawler.loginFormEndpoints, findings)
WeakPasswords.check_weak_passwords(crawler.loginFormEndpoints, findings)
if len(crawler.loginFormEndpoints) > 0:
findings["loginForm"]="yes"
else:
findings["loginForm"] = "no"
sqli_scan_urls(crawler.uEndPoints, findings)
sqli_scan_forms(crawler.fEndpoints, findings)
CommonFunctions.save_findings(findings)
def signal_handler(sig, frame):
print('You pressed Ctrl+C!')
sys.exit(0)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
if __name__ == "__main__":
print("Program Started!!!")
signal.signal(signal.SIGINT, signal_handler)
input_file = open("completed.txt", "r")
targets_completed = input_file.readlines()
targets_completed = [x.strip() for x in targets_completed]
input_file.close()
input_file = open("input.txt", "r")
targets = input_file.readlines()
input_file.close()
targets = [x.strip() for x in targets]
#targets = list(set(targets) - set(targets_completed))
#for t in targets:
# runScan(t)
#exit(0)
if len(targets) < Config.number_of_processes:
Config.number_of_processes = len(targets)
index = 0
processes = []
for i in range(Config.number_of_processes):
processes.append(multiprocessing.Process(target=runScan,args=(targets[index],)))
index+=1
for p in processes:
p.start()
more_loop = True
while more_loop:
time.sleep(5)
for i in range(0,Config.number_of_processes) :
if processes[i].is_alive():
processes[i].join(1)
#print("jobs is not finished")
else:
if index >= len(targets):
for p in processes:
p.join()
more_loop = False
break
processes[i] = multiprocessing.Process(target=runScan,args=(targets[index],))
processes[i].start()
index+=1
print("Pool completed execution!!!")
print("Exiting main thread.")
exit(0)