Skip to content

Commit ae010f7

Browse files
committed
Scan profile and CVSS examples
1 parent c2ca50f commit ae010f7

3 files changed

Lines changed: 67 additions & 1 deletion

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python
2+
"""
3+
Output CVSS score and vector for all findings in a target
4+
5+
6+
This example is for python 3.5
7+
"""
8+
import argparse
9+
10+
import requests
11+
from urllib.parse import urljoin
12+
13+
14+
api_base_url = "https://api.probely.com"
15+
finding_list_endpoint = urljoin(api_base_url, "targets/{target}/findings/")
16+
17+
18+
if __name__ == '__main__':
19+
parser = argparse.ArgumentParser()
20+
parser.add_argument("target", help="Target id")
21+
args = parser.parse_args()
22+
23+
token = input("API Token:")
24+
headers = {'Authorization': "JWT {}".format(token)}
25+
26+
# Findings
27+
response = requests.get(
28+
finding_list_endpoint.format(target=args.target),
29+
headers=headers,
30+
params={'length': 100}
31+
)
32+
response.raise_for_status()
33+
findings = response.json()['results']
34+
35+
print('Id, CVSS Score, CVSS vector')
36+
for finding in findings:
37+
if finding['cvss_score']:
38+
print("%s, %s, %s" % (finding['id'],
39+
finding['cvss_score'],
40+
finding['cvss_vector']))

probely_api_examples/start_scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from urllib.parse import urljoin
1313

1414
token = input("API Token:")
15-
headers = {'Authorization': "JWT {}".formar(token)}
15+
headers = {'Authorization': "JWT {}".format(token)}
1616

1717
target_id = input("Target ID:")
1818

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
"""
3+
Start a scan using the API selecting a scan profile
4+
5+
Currently there are 3 different scan profiles:
6+
* normal -- default profile
7+
* full -- does everything the default profile does and adds boolean based SQL
8+
injection tests
9+
* safe -- doesn't use any content changing methods (no POST, DELETE, etc) and
10+
tries fewer payloads for SQL injection tests
11+
12+
"""
13+
import requests
14+
from urllib.parse import urljoin
15+
16+
token = input("API Token:")
17+
headers = {'Authorization': "JWT {}".format(token)}
18+
19+
target_id = input("Target ID:")
20+
21+
api_base_url = "https://api.probely.com"
22+
scan_now_endpoint = urljoin(api_base_url, "targets/{target_id}/scan_now/")
23+
24+
response = requests.post(scan_now_endpoint.format(target_id=target_id),
25+
data={'scan_profile': 'safe'},
26+
headers=headers)

0 commit comments

Comments
 (0)