angr-management
angr-management copied to clipboard
Get rid of soft-dependencies (excluding plugins)
Description
Right now angr management has multiple soft dependencies:
In interaction_view.py, for example, we soft require: archr, keystone-engine, nclib, and slacrs (though, this view seems useless without any of these installed).
pyinstaller gives us a frozen python environment, which means these features are simply not-usable for many of our users. I would (and still do) suggest moving something like the interactions_view into a plugin, but if it is a default plugin we ship, it will simply be unusable for users of the pyinstaller build.
With that in mind, I think we should do one of the following:
- Get rid of these soft dependencies by moving the features into non-default plugins.
- Make these soft dependencies required.
- Move any code requiring a soft dependency into a (default) plugin, adding the python packages as
extras_requirein ourpyproject.toml. Users who installedangr managementvia either git or pip could then install these extra dependencies as needed via something likepip install angrmanagement[docker], which could installarchrandkeystone-enginefor docker image target support. The pyinstaller build would then need to be built either without these options, preventing users from using these default plugins at all, or with all of these options, allowing users to use all of the default plugins.
Alternatives
Do 1 as much as possible, then do 3 as much as possible for the rest, then apply strategy 2 for any remaining soft dependencies. This is probably the best choice.
Additional context
No response
@ltfish @rhelmot Thoughts?
interaction view can probably be axed entirely. it was a cute idea from a hackathon long past, probably should have been a plugin.
What about other soft dependency things? This is an incomplete list but a grep -r ImportError -B 2 gives the snippet below. From this I see, from non-plugin files, bintrace, archr, keystone, angr.angrdb.AngrDB, nclib, slacrs, argument_resolver, qtpy, binsync, qtconsole, PySide6, sqlalchemy, pyqodeng and xdg; I realize some of these are default included, but others are not.
For example, docker targets require at leastarchr and keystrone-engine. We can either make these hard dependencies, remove this functionality and make it a non-default plugin, or make this a default plugin that requires extras installed via pip install angrmanagement[docker] where the pyinstaller build has this by default. I imagine at least some of the other soft dependencies are for other features where the same question is applicable.
zwimer@Lotus ~/D/W/a/angr-management>
angrmanagement/ui/main_window.py-try:
angrmanagement/ui/main_window.py- from angr.angrdb import AngrDB
angrmanagement/ui/main_window.py:except ImportError:
--
angrmanagement/ui/main_window.py- import archr
angrmanagement/ui/main_window.py- import keystone
angrmanagement/ui/main_window.py:except ImportError:
--
angrmanagement/ui/toolbars/file_toolbar.py-try:
angrmanagement/ui/toolbars/file_toolbar.py- import archr
angrmanagement/ui/toolbars/file_toolbar.py:except ImportError:
--
angrmanagement/ui/views/call_explorer_view.py-try:
angrmanagement/ui/views/call_explorer_view.py- from bintrace import TraceEvent
angrmanagement/ui/views/call_explorer_view.py:except ImportError as e:
--
angrmanagement/ui/views/interaction_view.py-try:
angrmanagement/ui/views/interaction_view.py- import nclib
angrmanagement/ui/views/interaction_view.py:except ImportError:
--
angrmanagement/ui/views/interaction_view.py-try:
angrmanagement/ui/views/interaction_view.py- import keystone
angrmanagement/ui/views/interaction_view.py:except ImportError:
--
angrmanagement/ui/views/interaction_view.py-try:
angrmanagement/ui/views/interaction_view.py- import archr
angrmanagement/ui/views/interaction_view.py:except ImportError:
--
angrmanagement/ui/views/interaction_view.py- import slacrs
angrmanagement/ui/views/interaction_view.py- import slacrs.model
angrmanagement/ui/views/interaction_view.py:except ImportError:
--
angrmanagement/config/config_manager.py- import argument_resolver # pylint:disable=import-outside-toplevel,unused-import
angrmanagement/config/config_manager.py- return True
angrmanagement/config/config_manager.py: except ImportError:
--
angrmanagement/plugins/log_fatigue/log_fatigue_plugin.py- from slacrs import Slacrs
angrmanagement/plugins/log_fatigue/log_fatigue_plugin.py- from slacrs.model import HumanFatigue
angrmanagement/plugins/log_fatigue/log_fatigue_plugin.py:except ImportError as ex:
--
angrmanagement/plugins/log_human_activities/log_human_activities.py- from slacrs import Slacrs
angrmanagement/plugins/log_human_activities/log_human_activities.py- from slacrs.model import HumanActivity, HumanActivityEnum
angrmanagement/plugins/log_human_activities/log_human_activities.py:except ImportError as ex:
--
angrmanagement/plugins/seed_table/seed_table.py- from slacrs import Slacrs
angrmanagement/plugins/seed_table/seed_table.py- from slacrs.model import Input, InputTag
angrmanagement/plugins/seed_table/seed_table.py:except ImportError as ex:
--
angrmanagement/plugins/trace_viewer/multi_trace.py- from slacrs import Slacrs
angrmanagement/plugins/trace_viewer/multi_trace.py- from slacrs.model import Input
angrmanagement/plugins/trace_viewer/multi_trace.py:except ImportError as ex:
--
angrmanagement/plugins/trace_viewer/chess_trace_list.py-try:
angrmanagement/plugins/trace_viewer/chess_trace_list.py- import slacrs
angrmanagement/plugins/trace_viewer/chess_trace_list.py:except ImportError:
--
angrmanagement/plugins/log_reverse_engineering/log_reverse_engineering_plugin.py- from slacrs import Slacrs
angrmanagement/plugins/log_reverse_engineering/log_reverse_engineering_plugin.py- from slacrs.model import VariableRename, FunctionRename, ReverseEngineeringProgress
angrmanagement/plugins/log_reverse_engineering/log_reverse_engineering_plugin.py:except ImportError as ex:
--
angrmanagement/plugins/chess_manager/summary_view.py- from slacrs import Slacrs
angrmanagement/plugins/chess_manager/summary_view.py- from slacrs.model import PluginMessage
angrmanagement/plugins/chess_manager/summary_view.py:except ImportError as ex:
--
angrmanagement/plugins/chess_manager/diagnose_handler.py- from slacrs import Slacrs
angrmanagement/plugins/chess_manager/diagnose_handler.py- from slacrs.model import Poi
angrmanagement/plugins/chess_manager/diagnose_handler.py:except ImportError as _:
--
angrmanagement/plugins/chess_manager/chess_connector.py-try:
angrmanagement/plugins/chess_manager/chess_connector.py- import slacrs
angrmanagement/plugins/chess_manager/chess_connector.py:except ImportError:
--
angrmanagement/plugins/chess_manager/backend_selector_dialog.py-try:
angrmanagement/plugins/chess_manager/backend_selector_dialog.py- import slacrs
angrmanagement/plugins/chess_manager/backend_selector_dialog.py:except ImportError:
--
angrmanagement/plugins/chess_manager/backend_selector_dialog.py-
angrmanagement/plugins/chess_manager/backend_selector_dialog.py- if slacrs is None:
angrmanagement/plugins/chess_manager/backend_selector_dialog.py: raise ImportError("The slacrs module is not installed")
--
angrmanagement/plugins/chess_manager/target_selector.py-try:
angrmanagement/plugins/chess_manager/target_selector.py- import slacrs
angrmanagement/plugins/chess_manager/target_selector.py:except ImportError:
--
angrmanagement/plugins/chess_manager/multi_poi.py- from slacrs import Slacrs
angrmanagement/plugins/chess_manager/multi_poi.py- from slacrs.model import Input
angrmanagement/plugins/chess_manager/multi_poi.py:except ImportError as ex:
--
angrmanagement/plugins/coverage/coverage.py-try:
angrmanagement/plugins/coverage/coverage.py- import slacrs.model
angrmanagement/plugins/coverage/coverage.py:except ImportError as ex:
--
angrmanagement/logic/debugger/bintrace.py- from bintrace.debugger_angr import AngrTraceDebugger
angrmanagement/logic/debugger/bintrace.py- from bintrace import TraceEvent
angrmanagement/logic/debugger/bintrace.py:except ImportError as e:
--
angrmanagement/__init__.py- os.environ['QT_API'] = 'pyside6'
angrmanagement/__init__.py- import qtpy
angrmanagement/__init__.py:except ImportError:
--
angrmanagement/utils/__init__.py- import binsync
angrmanagement/utils/__init__.py- return True
angrmanagement/utils/__init__.py: except ImportError:
--
angrmanagement/data/trace.py- import bintrace
angrmanagement/data/trace.py- from bintrace.debugger_angr import get_angr_project_load_options_from_trace
angrmanagement/data/trace.py:except ImportError:
--
angrmanagement/data/jobs/loading.py-try:
angrmanagement/data/jobs/loading.py- import archr
angrmanagement/data/jobs/loading.py:except ImportError:
--
angrmanagement/data/jobs/dependency_analysis.py- from argument_resolver.transitive_closure import transitive_closures_from_defs
angrmanagement/data/jobs/dependency_analysis.py- from argument_resolver.call_trace_visitor import CallTraceSubject
angrmanagement/data/jobs/dependency_analysis.py:except ImportError:
--
angrmanagement/data/jobs/job.py- m.check_all = True
angrmanagement/data/jobs/job.py- m.check()
angrmanagement/data/jobs/job.py: except ImportError:
--
angrmanagement/__main__.py- try:
angrmanagement/__main__.py- import PySide6
angrmanagement/__main__.py: except ImportError:
--
angrmanagement/__main__.py- try:
angrmanagement/__main__.py- import qtconsole
angrmanagement/__main__.py: except ImportError:
--
angrmanagement/__main__.py- try:
angrmanagement/__main__.py- import sqlalchemy
angrmanagement/__main__.py: except ImportError:
--
angrmanagement/__main__.py- try:
angrmanagement/__main__.py- import pyqodeng.core
angrmanagement/__main__.py: except ImportError:
--
angrmanagement/__main__.py- try:
angrmanagement/__main__.py- import xdg
angrmanagement/__main__.py: except ImportError:
This is a good start :) https://github.com/angr/angr-management/pull/848
Related: https://github.com/angr/angr-management/issues/861