tenable / pyTenable

Python Library for interfacing into Tenable's platform APIs
https://pytenable.readthedocs.io
MIT License
356 stars 175 forks source link

Question Pytenable and Analysis #185

Closed zepernick03 closed 4 years ago

zepernick03 commented 4 years ago

Beginner using Pytenable: What is the next step to write this output to a CSV file? Is there a forum or community resource?

from tenable.sc import TenableSC import pprint import getpass

Tenable login info

username = 'name' p = getpass.getpass(prompt='Password:')

sc = TenableSC('URL') sc.login(username,p)

for vuln in sc.analysis.vulns(('pluginID','=','125063,125073,125060,125313'),tool='vulndetails'): print('{ip}:{pluginID}:{pluginName}:{severity}'.format(**vuln))

sc.logout()

SteveMcGrath commented 4 years ago

You may want to look at the CSV library.

https://docs.python.org/3/library/csv.html

zepernick03 commented 4 years ago

Can I simply write my output to a text file? Using something like this? def main(): file = open("alerts.txt","w")

file.write("here is the query"
file.close()

if name== "main": main()

SteveMcGrath commented 4 years ago

thats all up to you at that point.