diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c7cf395..892de80 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,20 +5,33 @@ Change Log This document records all notable changes to `nessus file analyzer by LimberDuck `_. This project adheres to `Semantic Versioning `_. +0.3.0 (2019-08-26) +--------------------- + +New Features + - **Drag & drop** - now you can drag and drop selected files or directories on *nessus file analyzer by LimberDuck* window to open nessus files. + +Bug Fixes + - **Validation of user input for custom suffix** - Settings > Target files > add custom suffix - now you will not be able to put chars like \\/:\*?"<>| which will let you save target file without any problem. + 0.2.0 (2019-08-19) --------------------- -* New option: Settings > Source files > vulnerabilities > skip None results - now you can skip findings reported by plugins with None Risk Factor, thanks to this, the resulting file size will be smaller. -* Updated option: Settings > Target files > add custom suffix - now input field for custom suffix is disabled by default. If you check this option input field becomes editable. Any text entered will result in automatic suffix change. Suffix will be cleared out if you uncheck this option or delete the entered text. +New Features + - **skip None results** - Settings > Source files > vulnerabilities > skip None results - now you can skip findings reported by plugins with None Risk Factor, thanks to this, the resulting file size will be smaller. + +Bug Fixes + - **custom suffix field works as desired** - Updated option: Settings > Target files > add custom suffix - now input field for custom suffix is disabled by default. If you check this option input field becomes editable. Any text entered will result in automatic suffix change. Suffix will be cleared out if you uncheck this option or delete the entered text. 0.1.1 (2019-07-21) --------------------- -* From now on if source file or source directory has been already selected target directory will be set base on path from selected source file or base on path from first file from selected source directory if you use option "set source directory as target directory". -* Typo in tooltip for "Open" button to open target directory fixed. -* Naming convention changed everywhere from "conversion" to "analysis". +Bug Fixes + - From now on if source file or source directory has been already selected target directory will be set base on path from selected source file or base on path from first file from selected source directory if you use option "set source directory as target directory". + - Typo in tooltip for "Open" button to open target directory fixed. + - Naming convention changed everywhere from "conversion" to "analysis". 0.1.0 (2019-06-23) diff --git a/README.rst b/README.rst index 62d5fa1..fcc3256 100644 --- a/README.rst +++ b/README.rst @@ -35,25 +35,27 @@ Main features Usage ===== -1. Go to Menu "File". -2. Choose: - - - "Open file\\-s" if you want to open one or more nessus files at once. - - or - - - "Open directory" if you want to open all nessus files from selected directory and its subdirectories. - -3. Select one or more report type: +1. To open nessus files: + 1.1 Open *nessus file analyzer by LimberDuck*, go to Menu "File" and choose: + - "Open file\\-s" if you want to open one or more nessus files at once. + - "Open directory" if you want to open all nessus files from selected directory and its subdirectories. + 1.2 On OS level select one or more nessus files: + a. Click RMB (Right Mouse Button) on them and choose from contextual menu option "Open with..." + b. Choose *nessus file analyzer by LimberDuck* to open selected files. + 1.3 On OS level select one or more nessus files or directories containing nessus files: + - simple drag and drop selected file\\-s on *nessus file analyzer by LimberDuck* window. + - simple drag and drop selected directory or directories on *nessus file analyzer by LimberDuck* window. + +2. Select one or more report type: - "scan" - if you want to see sum-up from point of view of whole scan - "host" - if you want to see sum-up from point of view of particular host from given scan - "vulnerabilities" - if you want to see list of vulnerabilities reported in this scan for all scanned hosts - "noncompliance" - if you want to see list of noncompliance reported in this scan for all scanned hosts -4. Click "Start" button to initiate analyze of all selected files. +3. Click "Start" button to initiate analyze of all selected files. -5. Click "Open" button to open target directory where output file has been placed. +4. Click "Open" button to open target directory where output file has been placed. Options ======= diff --git a/nessus_file_analyzer/__about__.py b/nessus_file_analyzer/__about__.py index 9c68084..396f228 100644 --- a/nessus_file_analyzer/__about__.py +++ b/nessus_file_analyzer/__about__.py @@ -33,8 +33,8 @@ "of scans performed by using Nessus by (C) Tenable, Inc. and exports parsed" \ "data to a Microsoft Excel Workbook for effortless analysis." __uri__ = "https://github.com/LimberDuck" -__version__ = "0.2.0" -__release_date__ = "2019.08.19" +__version__ = "0.3.0" +__release_date__ = "2019.08.26" __author__ = u"Damian Krawczyk" __email__ = "damian.krawczyk@limberduck.org" __license_name__ = "GNU GPLv3" diff --git a/nessus_file_analyzer/app.py b/nessus_file_analyzer/app.py index 0c908f1..410a83e 100644 --- a/nessus_file_analyzer/app.py +++ b/nessus_file_analyzer/app.py @@ -34,6 +34,8 @@ import platform import nessus_file_reader as nfr import nessus_file_analyzer as nfa +import urllib.parse +import fnmatch class MainWindow(QMainWindow, nfa.Ui_MainWindow): @@ -118,9 +120,14 @@ def __init__(self, parent=None): self.checkBox_set_source_directory_as_target_directory.stateChanged.connect( self.set_source_directory_as_target_directory_changed) self.checkBox_suffix_timestamp.stateChanged.connect(self.suffix_timestamp_changed) + self.lineEdit_suffix_custom_value.setDisabled(True) self.checkBox_suffix_custom.stateChanged.connect(self.check_box_suffix_state_changed) self.lineEdit_suffix_custom_value.textChanged.connect(self.line_edit_suffix_custom_value_changed) + # Match any character but \/:*?"<>| + reg_ex = QRegExp("[^\\\\/:*?\"<>|]+") + line_edit_suffix_custom_value_validator = QRegExpValidator(reg_ex, self.lineEdit_suffix_custom_value) + self.lineEdit_suffix_custom_value.setValidator(line_edit_suffix_custom_value_validator) self.pushButton_start.clicked.connect(self.parsing_thread_start) self.pushButton_target_dir_change.clicked.connect(self.change_target_directory) @@ -153,6 +160,19 @@ def __init__(self, parent=None): 'Hover mouse pointer here, to see tooltip for progress preview.', 'red') + self.setAcceptDrops(True) + + def dragEnterEvent(self, e): + + if e.mimeData().hasFormat('text/uri-list'): + e.accept() + else: + e.ignore() + + def dropEvent(self, e): + qurls = e.mimeData().urls() + self.open_files_by_drag_and_drop(qurls) + def print_settings(self): """ Function prints all settings specified by user. @@ -763,7 +783,7 @@ def open_files(self): Function get list of files via dialog window. Possible to select one or more files. """ - info = 'File\-s opening.' + info = 'File\\-s opening.' color = 'black' self.print_log(info, color=color) @@ -865,6 +885,48 @@ def open_directory(self): color = 'black' self.print_log(info, color=color) + def open_files_by_drag_and_drop(self, qurls): + """ + Function get list of files via Drag and Drop. + Possible to select one or more files or directories. + """ + info = 'File\\-s opening by Drag & Drop.' + color = 'black' + self.print_log(info, color=color) + + paths = [] + for qurl in qurls: + url = qurl.toString() + url_data = urllib.parse.urlparse(url) + path = urllib.parse.unquote(url_data.path) + os_name = platform.system() + if os_name == 'Windows': + path = os.path.abspath(path[1:]) + + extension = '*.nessus' + + if os.path.isfile(path): + if fnmatch.fnmatch(path, extension): + paths.append(path) + if self.checkBox_set_source_directory_as_target_directory.isChecked(): + target_directory = os.path.dirname(os.path.abspath(path)) + self.set_target_directory(target_directory) + self.get_target_directory_from_file() + + elif os.path.isdir(path): + os_separator = os.path.sep + target_directory = os.path.abspath(path) + if self.checkBox_set_source_directory_as_target_directory.isChecked(): + self.set_target_directory(target_directory) + self.get_target_directory_from_directory() + + files = glob.glob(target_directory + os_separator + '**' + os_separator + extension, recursive=True) + for file in files: + paths.append(file) + + if len(paths) > 0: + self.list_of_files_to_pars(paths) + def open_target_directory(self): """ Function open target directory taking into account Operating system: @@ -933,7 +995,7 @@ def list_of_files_to_pars(self, files): else: suffix = 's' info = 'Selected {0} file{1}.'.format(str(number_of_files), suffix) - color = 'black' + color = 'blue' self.print_log(info, color=color) self.print_status_bar_info(info) self.__files_to_pars = files @@ -2200,12 +2262,14 @@ def create_worksheet_for_vulnerabilities(self, workbook, list_of_source_files): worksheet.write(row_index, 14, plugin_version) if plugin_publication_date is not None: worksheet.write_datetime(row_index, 15, - nfr.plugin.plugin_date(plugin_publication_date), date_format) + nfr.plugin.plugin_date(plugin_publication_date), + date_format) else: worksheet.write_blank(row_index, 15, None) if plugin_modification_date is not None: worksheet.write_datetime(row_index, 16, - nfr.plugin.plugin_date(plugin_modification_date), date_format) + nfr.plugin.plugin_date(plugin_modification_date), + date_format) else: worksheet.write_blank(row_index, 16, None) worksheet.write(row_index, 17, plugin_description) @@ -2283,12 +2347,14 @@ def create_worksheet_for_vulnerabilities(self, workbook, list_of_source_files): worksheet.write(row_index, 19, plugin_version) if plugin_publication_date is not None: worksheet.write_datetime(row_index, 20, - nfr.plugin.plugin_date(plugin_publication_date), date_format) + nfr.plugin.plugin_date(plugin_publication_date), + date_format) else: worksheet.write_blank(row_index, 20, None) if plugin_modification_date is not None: worksheet.write_datetime(row_index, 21, - nfr.plugin.plugin_date(plugin_modification_date), date_format) + nfr.plugin.plugin_date(plugin_modification_date), + date_format) else: worksheet.write_blank(row_index, 21, None) worksheet.write(row_index, 22, plugin_description) diff --git a/version.rc b/version.rc index 6c97e38..bc82fe9 100644 --- a/version.rc +++ b/version.rc @@ -1,7 +1,7 @@ VSVersionInfo( ffi=FixedFileInfo( - filevers=(0, 2, 0, 0), - prodvers=(0, 2, 0, 0), + filevers=(0, 3, 0, 0), + prodvers=(0, 3, 0, 0), mask=0x3f, flags=0x0, OS=0x40004, @@ -16,12 +16,12 @@ VSVersionInfo( u'040904B0', [StringStruct(u'CompanyName', u'LimberDuck'), StringStruct(u'FileDescription', u'nessus file analyzer'), - StringStruct(u'FileVersion', u'0.2.0.0'), + StringStruct(u'FileVersion', u'0.3.0.0'), StringStruct(u'InternalName', u'nfa'), StringStruct(u'LegalCopyright', u'\xa9 Damian Krawczyk.'), StringStruct(u'OriginalFilename', u'nfa.exe'), StringStruct(u'ProductName', u'nessus file analyzer'), - StringStruct(u'ProductVersion', u'0.2.0.0')]) + StringStruct(u'ProductVersion', u'0.3.0.0')]) ]), VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) ]