· 6 years ago · Sep 08, 2019, 09:52 AM
1# Andrew Pearson 2019
2#
3# Requires Python 3.6 and pyTenable module (pypi.org/project/pyTenable)(github.com/tenable/pyTenable)
4#
5# This script writes a list of software and OS'es that are unsupported into a CSV.
6# Pulls data from Tenable plugins.
7# Designed to be used as a feed to other security tools.
8#
9# This script is not a product of Tenable. Support is not available. Use at your own risk.
10
11from tenable.io import TenableIO
12import csv
13
14access_key = ''
15secret_key = ''
16
17tio = TenableIO(access_key, secret_key)
18
19
20def key_check(key):
21 try:
22 value = plugin['attributes'][key]
23 except KeyError:
24 value = ''
25 return value
26
27
28with open('unsupported.csv', 'w') as csv_file:
29 field_names = ['plugin_id', 'plugin_name', 'synopsis', 'description', 'solution', 'cpe', 'see_also', 'cve',
30 'risk_factor', 'cvss_base_score', 'cvss3_base_score', 'plugin_publication_date']
31 writer = csv.DictWriter(csv_file, fieldnames=field_names)
32
33 writer.writeheader()
34 for plugin in tio.plugins.list(size=2000):
35 if plugin['attributes']['unsupported_by_vendor']:
36 writer.writerow({
37 'plugin_id': plugin['id'],
38 'plugin_name': plugin['name'],
39 'synopsis': key_check('synopsis'),
40 'description': key_check('description'),
41 'solution': key_check('solution'),
42 'cpe': key_check('cpe'),
43 'see_also': key_check('see_also'),
44 'cve': key_check('cve'),
45 'risk_factor': key_check('risk_factor'),
46 'cvss_base_score': key_check('cvss_base_score'),
47 'cvss3_base_score': key_check('cvss3_base_score'),
48 'plugin_publication_date': key_check('plugin_publication_date'),
49 })