#!/usr/bin/env python import sys import nessuslib scan_id = sys.argv[1] sid = int(scan_id) nessus = nessuslib.nessusAPI(debug=True) x = nessus.scanInfo(sid)
user = "******" passwd = "geek" dbname = "nessus" db = MySQLdb.connect("localhost", user, passwd, dbname) c = db.cursor() qs = "select * from scans" c.execute(qs) rows = c.fetchall() uuids_seen = set() for row in rows: scan_uuid = row[4] uuids_seen.add(scan_uuid) nessus = nessuslib.nessusAPI() x = nessus.listScans() slist = x['scans'] print "iterate over list of scans" for scan in slist: #print scan sid = scan['id'] sname = scan['name'] print "Scan", sid, sname sinfo = nessus.scanInfo(sid) scanhist = sinfo['history'] if scanhist == None: scanhist = [] print "iterate of history list" for hist in scanhist: