def nexpose_connection(): serveraddr = 'rapid7nexpose.broadinstitute.org' port = 3780 while 1: username = raw_input("Please input your Nexpose Username: "******"Password: "******"Trying to connect to Nexpose engine...\n") try: nexposeClient = pnexpose.Connection(serveraddr, port, username, password) return nexposeClient except: print("Username or password incorrect, please retry")
def __init__(self, server, port, user, pw): self.conn = pnexpose.Connection(server, port, user, pw) self.sitelist = {} self.grouplist = {}
import pnexpose import os import time import base64 serveraddr = '202.100.1.213' port = 3780 username = '******' password = '******' #creates a nexposeClient object nexposeClient = pnexpose.Connection(serveraddr, port, username, password) #call requires site ids in an array #sites = [1,2] query = """SELECT fa.vulnerability_instances, fa.affected_assets, fa.most_recently_discovered, dv.title FROM fact_vulnerability fa JOIN dim_vulnerability dv USING (vulnerability_id) where affected_assets > 0""" #response = nexposeClient.adhoc_report(query,sites) #print response #response = nexposeClient.vulnerability_listing() #print response #response = nexposeClient.site_device_listing(2) #print response print '-----------------list siteID and siteName----------------'