Skip to content

Commit

Permalink
Changes for representing sanitized path specification
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Jan 21, 2024
1 parent 8ba364c commit 33b4c3c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions plaso/cli/status_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ def _GetPathSpecificationString(self, path_spec):
Returns:
str: printable string representation of the path specification.
"""
return path_spec.comparable.translate(
definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
return '\n'.join([
line.translate(definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
for line in path_spec.comparable.split('\n')])

def _PrintAnalysisStatusUpdateFile(self, processing_status):
"""Prints an analysis status update in file mode.
Expand Down
5 changes: 3 additions & 2 deletions plaso/cli/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ def _GetPathSpecificationString(self, path_spec):
if not path_spec:
return 'N/A'

return path_spec.comparable.translate(
definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
return '\n'.join([
line.translate(definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
for line in path_spec.comparable.split('\n')])

def _ParseInformationalOptions(self, options):
"""Parses the informational options.
Expand Down
5 changes: 3 additions & 2 deletions plaso/engine/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ def _GetPathSpecificationString(self, path_spec):
Returns:
str: printable string representation of the path specification.
"""
return path_spec.comparable.translate(
definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
return '\n'.join([
line.translate(definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
for line in path_spec.comparable.split('\n')])

def ExtractPathSpecs(
self, path_spec, find_specs=None, recurse_file_system=True,
Expand Down
6 changes: 3 additions & 3 deletions plaso/multi_process/extraction_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,9 @@ def _GetPathSpecificationString(self, path_spec):
Returns:
str: printable string representation of the path specification.
"""
return path_spec.comparable.translate(
definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
return ', '.join([
line.translate(definitions.NON_PRINTABLE_CHARACTER_TRANSLATION_TABLE)
for line in path_spec.comparable.split('\n')])

def _MergeAttributeContainer(self, storage_writer, merge_helper, container):
"""Merges an attribute container from a task store into the storage writer.
Expand Down Expand Up @@ -708,7 +709,6 @@ def _ProcessEventSources(self, storage_writer, session_identifier):

else:
path_spec_string = self._GetPathSpecificationString(task.path_spec)
path_spec_string = path_spec_string.replace('\n', ' ')
logger.debug((
f'Scheduled task: {task.identifier:s} for path specification: '
f'{path_spec_string:s}'))
Expand Down

0 comments on commit 33b4c3c

Please sign in to comment.