Skip to content

Commit

Permalink
added scan-details.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ooola committed Dec 13, 2016
1 parent 0923b9f commit e99e2cd
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
28 changes: 28 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,31 @@ requests.get('https://cloud.tenable.com/scanners', headers=headers)
### Print status

`print-scan-status.py` prints the status of existing scans. Scan with a status of 'complete' can be downloaded.

### Scan details

`scan-details.py` prints the details including the number of vulnerabilities from recent scans.

```
$ scan-details.py 15
. . .
u'hosts': [{u'critical': 0,
. . .
u'hostname': u'ec2-35-164-212-193.us-west-2.compute.amazonaws.com',
u'info': 14,
u'low': 2,
u'medium': 1,
. . .
u'severitycount': {u'item': [{u'count': 14,
u'severitylevel': 0},
{u'count': 2,
u'severitylevel': 1},
{u'count': 1,
u'severitylevel': 2},
{u'count': 0,
u'severitylevel': 3},
{u'count': 0,
u'severitylevel': 4}]},
```

15 is the scan id available from `print-scan-status.py`. This provide a means to report on new vulnerabilities.
25 changes: 25 additions & 0 deletions scan-details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python2.7

import requests
import json
import sys
from pprint import pprint

scanid = sys.argv[1]
if len(scanid) == 0:
print 'please pass in scan id'
sys.exit(1)

with open('creds.json') as df:
data = json.load(df)

session = requests.post('https://cloud.tenable.com/session', data = data)

headers = { 'X-Cookie': 'token=' + session.json()['token']}

##
## Load configured scans
##
scans = requests.get('https://cloud.tenable.com/scans/' + scanid, headers=headers)

pprint(scans.json())

0 comments on commit e99e2cd

Please sign in to comment.