diff --git a/plaso/engine/extractors.py b/plaso/engine/extractors.py index 55da00a5ae..949364d074 100644 --- a/plaso/engine/extractors.py +++ b/plaso/engine/extractors.py @@ -189,14 +189,14 @@ def _ParseFileEntryWithParser( # We catch IOError so we can determine the parser that generated the error. except (IOError, dfvfs_errors.BackEndError) as exception: - display_name = parser_mediator.GetDisplayName(file_entry) + display_name = parser_mediator.GetDisplayName(file_entry=file_entry) logger.warning( '{0:s} unable to parse file: {1:s} with error: {2!s}'.format( parser.NAME, display_name, exception)) result = self._PARSE_RESULT_FAILURE except errors.WrongParser as exception: - display_name = parser_mediator.GetDisplayName(file_entry) + display_name = parser_mediator.GetDisplayName(file_entry=file_entry) logger.debug( '{0:s} unable to parse file: {1:s} with error: {2!s}'.format( parser.NAME, display_name, exception)) @@ -240,7 +240,7 @@ def _ParseFileEntryWithParsers( parse_results = self._PARSE_RESULT_SUCCESS continue - display_name = parser_mediator.GetDisplayName(file_entry) + display_name = parser_mediator.GetDisplayName(file_entry=file_entry) logger.debug(( '[ParseFileEntryWithParsers] parsing file: {0:s} with parser: ' '{1:s}').format(display_name, parser_name)) diff --git a/plaso/parsers/bencode_parser.py b/plaso/parsers/bencode_parser.py index 82455f50bc..c578b30167 100644 --- a/plaso/parsers/bencode_parser.py +++ b/plaso/parsers/bencode_parser.py @@ -167,12 +167,12 @@ def ParseFileObject(self, parser_mediator, file_object): if not self._BENCODE_RE.match(header_data): raise errors.WrongParser('Not a valid Bencoded file.') + display_name = parser_mediator.GetDisplayName() bencode_file = BencodeFile() try: bencode_file.Open(file_object) except IOError as exception: - display_name = parser_mediator.GetDisplayName() raise errors.WrongParser( '[{0:s}] unable to parse file: {1:s} with error: {2!s}'.format( self.NAME, display_name, exception)) @@ -186,8 +186,6 @@ def ParseFileObject(self, parser_mediator, file_object): if parser_mediator.abort: break - file_entry = parser_mediator.GetFileEntry() - display_name = parser_mediator.GetDisplayName(file_entry) profiling_name = '/'.join([self.NAME, plugin.NAME]) parser_mediator.SampleFormatCheckStartTiming(profiling_name) diff --git a/plaso/parsers/czip.py b/plaso/parsers/czip.py index 06dc0ffac9..cc6d8b9b61 100644 --- a/plaso/parsers/czip.py +++ b/plaso/parsers/czip.py @@ -54,8 +54,6 @@ def ParseFileObject(self, parser_mediator, file_object): if parser_mediator.abort: break - file_entry = parser_mediator.GetFileEntry() - display_name = parser_mediator.GetDisplayName(file_entry) profiling_name = '/'.join([self.NAME, plugin.NAME]) parser_mediator.SampleFormatCheckStartTiming(profiling_name) diff --git a/plaso/parsers/esedb.py b/plaso/parsers/esedb.py index c5d6fb71e7..0abf010a97 100644 --- a/plaso/parsers/esedb.py +++ b/plaso/parsers/esedb.py @@ -114,6 +114,8 @@ def ParseFileObject(self, parser_mediator, file_object): 'unable to open file with error: {0!s}'.format(exception)) return + display_name = parser_mediator.GetDisplayName() + # Compare the list of available plugin objects. cache = ESEDBCache() try: @@ -121,8 +123,6 @@ def ParseFileObject(self, parser_mediator, file_object): if parser_mediator.abort: break - file_entry = parser_mediator.GetFileEntry() - display_name = parser_mediator.GetDisplayName(file_entry) profiling_name = '/'.join([self.NAME, plugin.NAME]) parser_mediator.SampleFormatCheckStartTiming(profiling_name) diff --git a/plaso/parsers/olecf.py b/plaso/parsers/olecf.py index d43cdc5324..2b471f66ee 100644 --- a/plaso/parsers/olecf.py +++ b/plaso/parsers/olecf.py @@ -64,6 +64,8 @@ def ParseFileObject(self, parser_mediator, file_object): if not root_item: return + display_name = parser_mediator.GetDisplayName() + # Get a list of all items in the root item from the OLECF file. item_names = [item.name for item in root_item.sub_items] @@ -79,8 +81,6 @@ def ParseFileObject(self, parser_mediator, file_object): if parser_mediator.abort: break - file_entry = parser_mediator.GetFileEntry() - display_name = parser_mediator.GetDisplayName(file_entry) profiling_name = '/'.join([self.NAME, plugin.NAME]) parser_mediator.SampleFormatCheckStartTiming(profiling_name) diff --git a/plaso/parsers/plist.py b/plaso/parsers/plist.py index d1275a3529..b2e3994081 100644 --- a/plaso/parsers/plist.py +++ b/plaso/parsers/plist.py @@ -142,6 +142,7 @@ def ParseFileObject(self, parser_mediator, file_object): parser_mediator.ProduceExtractionWarning( 'XML plist file with leading whitespace') + display_name = parser_mediator.GetDisplayName() filename_lower_case = filename.lower() try: @@ -156,8 +157,6 @@ def ParseFileObject(self, parser_mediator, file_object): if parser_mediator.abort: break - file_entry = parser_mediator.GetFileEntry() - display_name = parser_mediator.GetDisplayName(file_entry) profiling_name = '/'.join([self.NAME, plugin.NAME]) parser_mediator.SampleFormatCheckStartTiming(profiling_name) diff --git a/plaso/parsers/sqlite.py b/plaso/parsers/sqlite.py index fdac0c9122..386564e8f5 100644 --- a/plaso/parsers/sqlite.py +++ b/plaso/parsers/sqlite.py @@ -438,7 +438,7 @@ def ParseFileEntry(self, parser_mediator, file_entry): # Create a cache in which the resulting tables are cached. cache = SQLiteCache() - display_name = parser_mediator.GetDisplayName(file_entry) + display_name = parser_mediator.GetDisplayName(file_entry=file_entry) try: for plugin in self._plugins_per_name.values(): @@ -465,7 +465,7 @@ def ParseFileEntry(self, parser_mediator, file_entry): # Create a cache in which the resulting tables are cached. cache = SQLiteCache() - display_name = parser_mediator.GetDisplayName(wal_file_entry) + display_name = parser_mediator.GetDisplayName(file_entry=wal_file_entry) try: for plugin in self._plugins_per_name.values():