2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchpatch
|
2021-02-13 14:23:35 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, zlib
|
|
|
|
, xz
|
|
|
|
, gzip
|
|
|
|
, bzip2
|
|
|
|
, gnutar
|
2020-06-18 07:06:33 +00:00
|
|
|
, p7zip
|
2020-04-24 23:36:52 +00:00
|
|
|
, cabextract
|
2020-08-20 17:08:02 +00:00
|
|
|
, cramfsprogs
|
|
|
|
, cramfsswap
|
2020-10-27 00:29:36 +00:00
|
|
|
, sasquatch
|
|
|
|
, squashfsTools
|
2020-08-20 17:08:02 +00:00
|
|
|
, matplotlib
|
2020-04-24 23:36:52 +00:00
|
|
|
, nose
|
|
|
|
, pycrypto
|
2021-02-05 17:12:51 +00:00
|
|
|
, pyqtgraph
|
|
|
|
, visualizationSupport ? false }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
buildPythonPackage rec {
|
2022-03-05 16:20:37 +00:00
|
|
|
pname = "binwalk${lib.optionalString visualizationSupport "-full"}";
|
2023-02-22 10:55:15 +00:00
|
|
|
version = "2.3.4";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-02-13 14:23:35 +00:00
|
|
|
owner = "ReFirmLabs";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "binwalk";
|
2021-02-13 14:23:35 +00:00
|
|
|
rev = "v${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-hlPbzqGRSXcIqlI+SNKq37CnnHd1IoMBNSjhyeAM1TE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
patches = [
|
|
|
|
# test_firmware_zip fails with 2.3.3 upgrade
|
|
|
|
# https://github.com/ReFirmLabs/binwalk/issues/566
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/ReFirmLabs/binwalk/commit/dd4f2efd275c9dd1001130e82e0f985110cd2754.patch";
|
|
|
|
sha256 = "1707n4nf1d1ay1yn4i8qlrvj2c1120g88hjwyklpsc2s2dcnqj9r";
|
|
|
|
includes = [
|
|
|
|
"testing/tests/test_firmware_zip.py"
|
|
|
|
];
|
|
|
|
revert = true;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-10-17 02:12:59 +00:00
|
|
|
propagatedBuildInputs = [ zlib xz gzip bzip2 gnutar p7zip cabextract squashfsTools xz pycrypto ]
|
2021-02-13 14:23:35 +00:00
|
|
|
++ lib.optionals visualizationSupport [ matplotlib pyqtgraph ]
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ cramfsprogs cramfsswap sasquatch ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# setup.py only installs version.py during install, not test
|
|
|
|
postPatch = ''
|
|
|
|
echo '__version__ = "${version}"' > src/binwalk/core/version.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
# binwalk wants to access ~/.config/binwalk/magic
|
|
|
|
preCheck = ''
|
|
|
|
HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ nose ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
pythonImportsCheck = [ "binwalk" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/ReFirmLabs/binwalk";
|
|
|
|
description = "A tool for searching a given binary image for embedded files";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "binwalk";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ maintainers.koral ];
|
2021-04-25 03:57:28 +00:00
|
|
|
license = licenses.mit;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|