Added commits to every if statement just incase connection breaks.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,7 +5,8 @@ __pycache__/
|
|||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
.idea
|
||||||
|
.idea/*
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
.Python
|
.Python
|
||||||
env/
|
env/
|
||||||
|
@ -26,11 +26,12 @@ def main():
|
|||||||
verbose=args.verbose)
|
verbose=args.verbose)
|
||||||
|
|
||||||
vw.whisper_nessus()
|
vw.whisper_nessus()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print('{red} ERROR: {error}{endc}'.format(red=bcolors.FAIL, error=e, endc=bcolors.ENDC))
|
print('{red} ERROR: {error}{endc}'.format(red=bcolors.FAIL, error=e, endc=bcolors.ENDC))
|
||||||
sys.exit(0)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@ hostname=localhost
|
|||||||
port=8834
|
port=8834
|
||||||
username=nessus_username
|
username=nessus_username
|
||||||
password=nessus_password
|
password=nessus_password
|
||||||
write_path=path_to_scans
|
write_path=/opt/vulnwhisp/scans
|
||||||
|
db_path=/opt/vulnwhisp/database
|
||||||
trash=false
|
trash=false
|
||||||
verbose=true
|
verbose=true
|
||||||
|
|
||||||
|
BIN
docs/source/vulnwhisp_dashboard.jpg
Normal file
BIN
docs/source/vulnwhisp_dashboard.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 172 KiB |
4
setup.py
4
setup.py
@ -1,8 +1,10 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='VulnWhisperer',
|
name='VulnWhisperer',
|
||||||
version='1.0a',
|
version='1.0.1',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
url='https://github.com/austin-taylor/vulnwhisperer',
|
url='https://github.com/austin-taylor/vulnwhisperer',
|
||||||
license="""MIT License
|
license="""MIT License
|
||||||
|
Binary file not shown.
@ -34,6 +34,7 @@ class vulnWhisperer(object):
|
|||||||
self.nessus_username = self.config.get('nessus', 'username')
|
self.nessus_username = self.config.get('nessus', 'username')
|
||||||
self.nessus_password = self.config.get('nessus', 'password')
|
self.nessus_password = self.config.get('nessus', 'password')
|
||||||
self.nessus_writepath = self.config.get('nessus', 'write_path')
|
self.nessus_writepath = self.config.get('nessus', 'write_path')
|
||||||
|
self.nessus_dbpath = self.config.get('nessus', 'db_path')
|
||||||
self.nessus_trash = self.config.getbool('nessus', 'trash')
|
self.nessus_trash = self.config.getbool('nessus', 'trash')
|
||||||
self.verbose = self.config.getbool('nessus', 'verbose')
|
self.verbose = self.config.getbool('nessus', 'verbose')
|
||||||
|
|
||||||
@ -62,9 +63,18 @@ class vulnWhisperer(object):
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if db_name is not None:
|
if db_name is not None:
|
||||||
|
if self.nessus_dbpath:
|
||||||
|
self.database = os.path.join(self.nessus_dbpath, db_name)
|
||||||
|
else:
|
||||||
self.database = os.path.abspath(os.path.join(os.path.dirname( __file__ ), 'database', db_name))
|
self.database = os.path.abspath(os.path.join(os.path.dirname( __file__ ), 'database', db_name))
|
||||||
|
|
||||||
|
try:
|
||||||
self.conn = sqlite3.connect(self.database)
|
self.conn = sqlite3.connect(self.database)
|
||||||
self.cur = self.conn.cursor()
|
self.cur = self.conn.cursor()
|
||||||
|
self.vprint("{info} Connected to database at {loc}".format(info=bcolors.INFO, loc=self.database))
|
||||||
|
except Exception as e:
|
||||||
|
self.vprint("{fail} Could not connect to database at {loc}\nReason: {e} - Please ensure the path exist".format(e=e, fail=bcolors.FAIL, loc=self.database))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.vprint('{fail} Please specify a database to connect to!'.format(fail=bcolors.FAIL))
|
self.vprint('{fail} Please specify a database to connect to!'.format(fail=bcolors.FAIL))
|
||||||
exit(0)
|
exit(0)
|
||||||
@ -121,7 +131,7 @@ class vulnWhisperer(object):
|
|||||||
:param completed: Only return completed scans
|
:param completed: Only return completed scans
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
self.vprint('{info} Gathering all scan data...'.format(info=bcolors.INFO))
|
self.vprint('{info} Gathering all scan data... this may take a while...'.format(info=bcolors.INFO))
|
||||||
scan_records = []
|
scan_records = []
|
||||||
for s in scans:
|
for s in scans:
|
||||||
if s:
|
if s:
|
||||||
@ -175,11 +185,13 @@ class vulnWhisperer(object):
|
|||||||
folders = scan_data['folders']
|
folders = scan_data['folders']
|
||||||
scans = scan_data['scans']
|
scans = scan_data['scans']
|
||||||
all_scans = self.scan_count(scans)
|
all_scans = self.scan_count(scans)
|
||||||
|
if self.uuids:
|
||||||
scan_list = [scan for scan in all_scans if scan['uuid'] not in self.uuids]
|
scan_list = [scan for scan in all_scans if scan['uuid'] not in self.uuids]
|
||||||
print scan_list, self.uuids
|
else:
|
||||||
self.vprint("{info} Identified {new} new scans to be processed".format(info=bcolors.INFO, new=len(scan_list)))
|
scan_list = all_scans
|
||||||
#print scan_list, len(scan_list)
|
self.vprint("{info} Identified {new} scans to be processed".format(info=bcolors.INFO, new=len(scan_list)))
|
||||||
# create scan subfolders
|
|
||||||
|
# Create scan subfolders
|
||||||
for f in folders:
|
for f in folders:
|
||||||
if not os.path.exists(self.path_check(f['name'])):
|
if not os.path.exists(self.path_check(f['name'])):
|
||||||
if f['name'] == 'Trash' and self.nessus_trash:
|
if f['name'] == 'Trash' and self.nessus_trash:
|
||||||
@ -219,7 +231,8 @@ class vulnWhisperer(object):
|
|||||||
scan_name, scan_id, norm_time, file_name, time.time(), csv_in.shape[0], 'nessus', uuid, 1)
|
scan_name, scan_id, norm_time, file_name, time.time(), csv_in.shape[0], 'nessus', uuid, 1)
|
||||||
self.record_insert(record_meta)
|
self.record_insert(record_meta)
|
||||||
self.vprint(
|
self.vprint(
|
||||||
"[INFO] File {filename} already exist! Updating database".format(filename=relative_path_name))
|
"{info} File {filename} already exist! Updating database".format(info=bcolors.INFO, filename=relative_path_name))
|
||||||
|
self.conn.commit()
|
||||||
else:
|
else:
|
||||||
file_req = self.nessus.download_scan(scan_id=scan_id, history=history_id, export_format='csv')
|
file_req = self.nessus.download_scan(scan_id=scan_id, history=history_id, export_format='csv')
|
||||||
clean_csv = pd.read_csv(io.StringIO(file_req.decode('utf-8')))
|
clean_csv = pd.read_csv(io.StringIO(file_req.decode('utf-8')))
|
||||||
@ -238,6 +251,7 @@ class vulnWhisperer(object):
|
|||||||
1)
|
1)
|
||||||
self.record_insert(record_meta)
|
self.record_insert(record_meta)
|
||||||
self.vprint("{info} {filename} records written to {path} ".format(info=bcolors.INFO, filename=clean_csv.shape[0], path=file_name))
|
self.vprint("{info} {filename} records written to {path} ".format(info=bcolors.INFO, filename=clean_csv.shape[0], path=file_name))
|
||||||
|
self.conn.commit()
|
||||||
else:
|
else:
|
||||||
record_meta = (
|
record_meta = (
|
||||||
scan_name, scan_id, norm_time, file_name, time.time(), clean_csv.shape[0], 'nessus', uuid,
|
scan_name, scan_id, norm_time, file_name, time.time(), clean_csv.shape[0], 'nessus', uuid,
|
||||||
@ -245,11 +259,10 @@ class vulnWhisperer(object):
|
|||||||
self.record_insert(record_meta)
|
self.record_insert(record_meta)
|
||||||
self.vprint(file_name + ' has no host available... Updating database and skipping!')
|
self.vprint(file_name + ' has no host available... Updating database and skipping!')
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
#self.conn.commit()
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
"{success} Scan aggregation complete!".format(success=bcolors.SUCCESS)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.vprint('{fail} Failed to use scanner at {host}'.format(fail=bcolors.FAIL, host=self.nessus_hostname+':'+self.nessus_port))
|
self.vprint('{fail} Failed to use scanner at {host}'.format(fail=bcolors.FAIL, host=self.nessus_hostname+':'+self.nessus_port))
|
||||||
|
|
||||||
|
|
||||||
#vw = vulnWhisperer(config='../configs/frameworks.ini', purge=False)
|
|
||||||
#vw.whisper_nessus()
|
|
Reference in New Issue
Block a user