FS#69621 - [binwalk] Entropy plotting feature is broken due to missing dependencies
Attached to Project:
Community Packages
Opened by aaedef (nada10583) - Thursday, 11 February 2021, 21:33 GMT
Last edited by freswa (frederik) - Friday, 12 May 2023, 20:37 GMT
Opened by aaedef (nada10583) - Thursday, 11 February 2021, 21:33 GMT
Last edited by freswa (frederik) - Friday, 12 May 2023, 20:37 GMT
|
Details
Description:
Package is missing a matplotlib dependency, but even after installing that dependency the entropy feature does not work. Additional info: * package version: 2.2.0-4 Steps to reproduce: Running: $> binwalk -E binary.bin Returns: WARNING: Failed to import matplotlib module, visual entropy graphing will be disabled Upon installing matplotlib via pacman (i.e. pacman -S python-matplotlib) the error changes to: Entropy Exception: module 'cairo' has no attribute 'version_info' ---------------------------------------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/binwalk/core/module.py", line 596, in main retval = self.run() File "/usr/lib/python3.9/site-packages/binwalk/modules/entropy.py", line 123, in run self._run() File "/usr/lib/python3.9/site-packages/binwalk/modules/entropy.py", line 135, in _run import matplotlib.pyplot as plt File "/usr/lib/python3.9/site-packages/matplotlib/pyplot.py", line 2336, in <module> switch_backend(rcParams["backend"]) File "/usr/lib/python3.9/site-packages/matplotlib/__init__.py", line 703, in __getitem__ plt.switch_backend(rcsetup._auto_backend_sentinel) File "/usr/lib/python3.9/site-packages/matplotlib/pyplot.py", line 256, in switch_backend switch_backend(candidate) File "/usr/lib/python3.9/site-packages/matplotlib/pyplot.py", line 276, in switch_backend class backend_mod(matplotlib.backend_bases._Backend): File "/usr/lib/python3.9/site-packages/matplotlib/pyplot.py", line 277, in backend_mod locals().update(vars(importlib.import_module(backend_name))) File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/usr/lib/python3.9/site-packages/matplotlib/backends/backend_gtk3agg.py", line 5, in <module> from . import backend_cairo File "/usr/lib/python3.9/site-packages/matplotlib/backends/backend_cairo.py", line 16, in <module> if cairo.version_info < (1, 11, 0): AttributeError: module 'cairo' has no attribute 'version_info' ---------------------------------------------------------------------------------------------------- |
This task depends upon
Closed by freswa (frederik)
Friday, 12 May 2023, 20:37 GMT
Reason for closing: Fixed
Additional comments about closing: Commited to trunk
Friday, 12 May 2023, 20:37 GMT
Reason for closing: Fixed
Additional comments about closing: Commited to trunk
So both `python-matplotlib` and `python-pyqtgraph` should ideally be added as dependencies for binwalk to have full functionality.
Please add python-matplotlib as optional dependency
I have a different bug in my system:
DECIMAL HEXADECIMAL ENTROPY
--------------------------------------------------------------------------------
Entropy Exception: Failed in nopython mode pipeline (step: nopython frontend)
NameError: name 'np' is not defined
----------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/binwalk/core/module.py", line 595, in main
retval = self.run()
File "/usr/lib/python3.10/site-packages/binwalk/modules/entropy.py", line 136, in run
self._run()
File "/usr/lib/python3.10/site-packages/binwalk/modules/entropy.py", line 158, in _run
self.calculate_file_entropy(fp)
File "/usr/lib/python3.10/site-packages/binwalk/modules/entropy.py", line 199, in calculate_file_entropy
entropy = self.algorithm(data[i:i + block_size])
File "/usr/lib/python3.10/site-packages/binwalk/modules/entropy.py", line 256, in shannon_numpy
return self._shannon_numpy(bytes2str(data))
File "/home/ttv20/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 468, in _compile_for_args
error_rewrite(e, 'typing')
File "/home/ttv20/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 409, in error_rewrite
raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
NameError: name 'np' is not defined
----------------------------------------------------------------------------------------------------
I think it happen because mix of pacman python modules and pip python modules