Skip to content

Commit

Permalink
Merge pull request #92 from obsidianforensics/packaging-fixes
Browse files Browse the repository at this point in the history
Add missing dependency and more exception handling.
  • Loading branch information
obsidianforensics authored Apr 27, 2021
2 parents d939645 + 359d9b8 commit 3810027
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
20 changes: 13 additions & 7 deletions hindsight.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,22 +224,25 @@ def write_jsonl(analysis_session):
if plugin in completed_plugins:
continue

log.debug(" - Loading '{}'".format(plugin))
log.debug(f" - Loading '{plugin}'")
try:
module = importlib.import_module("pyhindsight.plugins.{}".format(plugin))
module = importlib.import_module(f'pyhindsight.plugins.{plugin}')
except ImportError as e:
log.error(" - Error: {}".format(e))
log.error(f' - Error: {e}')
print((format_plugin_output(plugin, "-unknown", 'import failed (see log)')))
continue
except Exception as e:
log.error(f' - Exception in {plugin} plugin: {e}')

try:
log.info(" - Running '{}' plugin".format(module.friendlyName))
log.info(f" - Running '{module.friendlyName}' plugin")
parsed_items = module.plugin(analysis_session)
print((format_plugin_output(module.friendlyName, module.version, parsed_items)))
log.info(" - Completed; {}".format(parsed_items))
log.info(f' - Completed; {parsed_items}')
completed_plugins.append(plugin)
except Exception as e:
print((format_plugin_output(module.friendlyName, module.version, 'failed')))
log.info(" - Failed; {}".format(e))
log.info(f' - Failed; {e}')

# Then look for any custom user-provided plugins in a 'plugins' directory
log.info(" Custom Plugins:")
Expand Down Expand Up @@ -275,9 +278,12 @@ def write_jsonl(analysis_session):
try:
module = __import__(plugin)
except ImportError as e:
log.error(" - Error: {}".format(e))
log.error(f' - Error: {e}')
print((format_plugin_output(plugin, "-unknown", 'import failed (see log)')))
continue
except Exception as e:
log.error(f' - Exception in {plugin} plugin: {e}')

try:
log.info(" - Running '{}' plugin".format(module.friendlyName))
parsed_items = module.plugin(analysis_session)
Expand Down
5 changes: 4 additions & 1 deletion pyhindsight/plugins/unfurl_interpretation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
import logging
# Disable most Unfurl logs, as we're about to shove a lot of garbage at it
# and don't want to swamp the Hindsight log.
unfurl.log.setLevel(logging.CRITICAL)
try:
unfurl.log.setLevel(logging.CRITICAL)
except Exception:
pass

# Config
friendlyName = "Unfurl"
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
packages=find_packages(),
include_package_data=True,
scripts=['hindsight.py', 'hindsight_gui.py'],
version='20210426',
version='20210427',
description='Browser forensics for Google Chrome/Chromium',
url='https://github.com/obsidianforensics/hindsight',
author='Ryan Benson',
Expand All @@ -19,6 +19,7 @@
'pycryptodomex>=3.9.7',
# 'pypiwin32>=219',
'pytz>=2020.1',
'xlsxwriter>=1.2.9'
'xlsxwriter>=1.2.9',
'puremagic>=1.10'
]
)

0 comments on commit 3810027

Please sign in to comment.