-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (23 loc) · 1.01 KB
/
main.py
File metadata and controls
34 lines (23 loc) · 1.01 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
import argparse
from orchestration.pentest import PenetrationTester
from webapp.app import app
def main(targets, top_ports):
pentester = PenetrationTester(targets, top_ports)
pentester.scan_and_report()
app.run(debug=False, host='0.0.0.0', port=1337)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Run penetration tests on the given target subnets.')
# Targets Argument
parser.add_argument('targets', nargs='+', help='List of target subnets.')
# Top Ports Argument
parser.add_argument('-p', '--top_ports', type=int, default=300, help='Number of most common ports to scan.')
# Parse the arguments
args = parser.parse_args()
# Validate top_ports
if args.top_ports < 1:
parser.error("top_ports must be a positive integer.")
# Maximum limit of top_ports
if args.top_ports > 8367:
parser.error("top_ports must be less than or equal to 8367.")
# Run the main function with parsed arguments
main(args.targets, args.top_ports)