-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.py
executable file
·73 lines (53 loc) · 2.04 KB
/
main.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
#!/usr/bin/env python3
import sys
import time
import logging
import argparse
from dotenv import load_dotenv, find_dotenv
from scanners.zap_scanner import ZapScanner
from scanners.nexpose_scanner import NexposeScanner
from scanners.openvas_scanner import OpenVASScanner
load_dotenv(find_dotenv())
logging.basicConfig(filename='scanner.log', level=logging.INFO)
def main(config):
print("hello")
scanners = [ZapScanner(), NexposeScanner(), OpenVASScanner()]
scan_results = {}
scan_status_list = []
if config['target']:
for scanner in scanners:
scanner.start(config['scan_name'], config['target'])
time.sleep(1)
elif config['pause']:
for scanner in scanners:
scanner.pause(config['scan_name'])
time.sleep(1)
elif config['resume']:
for scanner in scanners:
scanner.resume(config['scan_name'])
time.sleep(1)
else:
for scanner in scanners:
scanner.get_scan_status(config.get('scan_name'), scan_status_list)
scanner.get_scan_results(config.get('scan_name'), scan_results)
time.sleep(2)
scanner.print_scan_status(scan_status_list)
scanner.print_report(scan_results)
return True
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--scan-name', required=True, help='Specify a scan name')
parser.add_argument('-i', '--scan-id', help='Specify the scan id', type=int)
parser.add_argument('-t', '--target', help='Specify the Target URL or IP')
parser.add_argument('-p', '--pause', action='store_true', help='Pause a specified scan')
parser.add_argument('-r', '--resume', action='store_true', help='Resume a specified scan')
parser.add_argument('-v', '--version', action='version', version='MultiScanner 1.0')
args = parser.parse_args()
config = {
'scan_name': args.scan_name,
'target': args.target,
'pause': args.pause,
'resume': args.resume
}
main(config)
exit(0)