From acad484398fc41c6c08f6e20ba9401989e74b3ea Mon Sep 17 00:00:00 2001 From: Austin Taylor Date: Sun, 18 Jun 2017 18:12:12 -0400 Subject: [PATCH] Database Integration --- .idea/vcs.xml | 6 + bin/vuln_whisperer | 38 ++++ configs/frameworks_example.ini | 10 ++ setup.py | 30 ++++ vulnwhisp/__init__.py | 0 vulnwhisp/base/__init__.py | 0 vulnwhisp/base/config.py | 22 +++ vulnwhisp/database/report_tracker.db | Bin 0 -> 8192 bytes vulnwhisp/frameworks/__init__.py | 0 vulnwhisp/frameworks/nessus.py | 219 +++++++++++++++++++++++ vulnwhisp/utils/__init__.py | 0 vulnwhisp/utils/cli.py | 16 ++ vulnwhisp/vulnwhisp.py | 255 +++++++++++++++++++++++++++ 13 files changed, 596 insertions(+) create mode 100644 .idea/vcs.xml create mode 100644 bin/vuln_whisperer create mode 100755 configs/frameworks_example.ini create mode 100644 setup.py create mode 100755 vulnwhisp/__init__.py create mode 100644 vulnwhisp/base/__init__.py create mode 100644 vulnwhisp/base/config.py create mode 100644 vulnwhisp/database/report_tracker.db create mode 100755 vulnwhisp/frameworks/__init__.py create mode 100755 vulnwhisp/frameworks/nessus.py create mode 100644 vulnwhisp/utils/__init__.py create mode 100644 vulnwhisp/utils/cli.py create mode 100755 vulnwhisp/vulnwhisp.py diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/bin/vuln_whisperer b/bin/vuln_whisperer new file mode 100644 index 0000000..8f9d0ab --- /dev/null +++ b/bin/vuln_whisperer @@ -0,0 +1,38 @@ +#!/usr/bin/env python + + +#Written by Austin Taylor +#www.austintaylor.io + +from vulnwhisp.vulnwhisp import vulnWhisperer +from vulnwhisp.utils.cli import bcolors + +import argparse +import sys + +def main(): + + parser = argparse.ArgumentParser(description=""" VulnWhisperer is designed to create actionable data from\ + your vulnerability scans through aggregation of historical scans.""") + parser.add_argument('-c', '--config', dest='config', required=False, default='frameworks.ini', + help='Path of config file') + parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=True, + help='Prints status out to screen (defaults to True)') + args = parser.parse_args() + + try: + + vw = vulnWhisperer(config=args.config, + verbose=args.verbose) + + vw.whisper_nessus() + + except Exception as e: + if args.verbose: + print('{red}ERROR: {error}{endc}'.format(red=bcolors.FAIL, error=e, endc=bcolors.ENDC)) + sys.exit(0) + + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/configs/frameworks_example.ini b/configs/frameworks_example.ini new file mode 100755 index 0000000..4ef1716 --- /dev/null +++ b/configs/frameworks_example.ini @@ -0,0 +1,10 @@ +[nessus] +enabled=true +hostname=localhost +port=8834 +username=nessus_username +password=nessus_password +write_path=path_to_scans +trash=false +verbose=true + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6472c38 --- /dev/null +++ b/setup.py @@ -0,0 +1,30 @@ +from setuptools import setup, find_packages + +setup( + name='VulnWhisperer', + version='1.0a', + packages=find_packages(), + url='https://github.com/austin-taylor/vulnwhisperer', + license="""MIT License + Copyright (c) 2016 Austin Taylor + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE.""", + author='Austin Taylor', + author_email='email@austintaylor.io', + description='Vulnerability assessment framework aggregator', + scripts=['bin/vuln_whisperer'] +) + diff --git a/vulnwhisp/__init__.py b/vulnwhisp/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/vulnwhisp/base/__init__.py b/vulnwhisp/base/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/vulnwhisp/base/config.py b/vulnwhisp/base/config.py new file mode 100644 index 0000000..3a7d40d --- /dev/null +++ b/vulnwhisp/base/config.py @@ -0,0 +1,22 @@ +import os +import sys + +# Support for python3 +if (sys.version_info > (3, 0)): + import configparser as cp +else: + import ConfigParser as cp + + +class vwConfig(object): + + def __init__(self, config_in=None): + self.config_in = config_in + self.config = cp.RawConfigParser() + self.config.read(self.config_in) + + def get(self, section, option): + return self.config.get(section, option) + + def getbool(self, section, option): + return self.config.getboolean(section, option) \ No newline at end of file diff --git a/vulnwhisp/database/report_tracker.db b/vulnwhisp/database/report_tracker.db new file mode 100644 index 0000000000000000000000000000000000000000..e4678756adb2985d21ce22ca71dce0736361dd5c GIT binary patch literal 8192 zcmeI#O>5LZ7zglV8`?H&q6tXsh%5+?J~4ZE9^yjXi& zz4$5o8bU$u-n{5VKZ1Do=4^M@ZjpM`!wd=gB+qP~Kfl{_c6ZWB0+km7Rsr8ywrtzF z4}fJ^EBbEed%CXb!kIqkUwfv$s9dq&&o>LB%}WcGzRWTLM!*Od0V7}pjDQg^0!F|H z7y%>j?*)d3cJun`s{Q(A#ge`(Im_a1T2^^+JX<#&JZ^97wZY!T=1v>TcEGJvfHbS* zfh@pbkq%gK40`f-ZM-XE0|_emvYI@fZC(R?R#x#K7pY360D@I=4XCs)XZ|DdqpY7Z z5m%}H&Ui~9d0vQ^=XF+1C+n~0b-|~j>RQhkPdzMhF3VC6n1sANI+8mJC)QH7_;vA- zF3d6lM!*Od0V7}pjDQg^0!F|H7=iyxV0g`GS)uK)X5&VEd9Rxnd413Y4`p?f7d_C? zhu7Br*7v*9PCV(vqfU%ajJz1(C=6(XaJbIP7aL!8-;?I2&vV 2: + self.vprint("Processing %s/%s for scan: %s" % (scan_count, len(scan_history), scan_name)) + clean_csv['CVSS'] = clean_csv['CVSS'].astype(str).apply(self.cleanser) + clean_csv['CVE'] = clean_csv['CVE'].astype(str).apply(self.cleanser) + clean_csv['Description'] = clean_csv['Description'].astype(str).apply(self.cleanser) + clean_csv['Synopsis'] = clean_csv['Description'].astype(str).apply(self.cleanser) + clean_csv['Solution'] = clean_csv['Solution'].astype(str).apply(self.cleanser) + clean_csv['See Also'] = clean_csv['See Also'].astype(str).apply(self.cleanser) + clean_csv['Plugin Output'] = clean_csv['Plugin Output'].astype(str).apply(self.cleanser) + clean_csv.to_csv(relative_path_name, index=False) + record_meta = ( + scan_name, scan_id, norm_time, file_name, time.time(), clean_csv.shape[0], 'nessus', uuid, + 1) + 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)) + else: + record_meta = ( + scan_name, scan_id, norm_time, file_name, time.time(), clean_csv.shape[0], 'nessus', uuid, + 1) + self.record_insert(record_meta) + self.vprint(file_name + ' has no host available... Updating database and skipping!') + self.conn.commit() + self.conn.close() + + else: + 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() \ No newline at end of file