File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ """
3+ Start a scan using the API including reduced scope
4+
5+ To create an API token please go to the target settings in the user interface
6+ and under "Integrations" create one.
7+
8+ Alternatively to perform actions as a regular user check the login workflow in
9+ the create_target script.
10+ """
11+ import requests
12+ from urllib .parse import urljoin
13+
14+ token = input ("API Token:" )
15+ headers = {"Authorization" : "JWT {}" .format (token )}
16+
17+ target_id = input ("Target ID:" )
18+
19+ api_base_url = "https://api.probely.com"
20+ scan_now_endpoint = urljoin (api_base_url , "targets/{target_id}/scan_now/" )
21+
22+ reduced_scopes = []
23+ i = 1
24+ while reduced_scope := input ("Reduced scope #{} (leave empty to stop):" .format (i )):
25+ reduced_scopes .append (reduced_scope )
26+ i += 1
27+
28+ response = requests .post (
29+ scan_now_endpoint .format (target_id = target_id ),
30+ headers = headers ,
31+ json = {
32+ "reduced_scopes" : [{"url" : reduced_scope } for reduced_scope in reduced_scopes ]
33+ },
34+ )
35+
You can’t perform that action at this time.
0 commit comments