2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
stdenv,
|
|
|
|
zlib,
|
|
|
|
xz,
|
|
|
|
gzip,
|
|
|
|
bzip2,
|
|
|
|
gnutar,
|
|
|
|
p7zip,
|
|
|
|
cabextract,
|
|
|
|
cramfsprogs,
|
|
|
|
cramfsswap,
|
|
|
|
sasquatch,
|
|
|
|
squashfsTools,
|
|
|
|
matplotlib,
|
|
|
|
nose,
|
|
|
|
pycrypto,
|
|
|
|
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";
|
2024-06-05 15:53:02 +00:00
|
|
|
includes = [ "testing/tests/test_firmware_zip.py" ];
|
2021-12-06 16:07:01 +00:00
|
|
|
revert = true;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs =
|
|
|
|
[
|
|
|
|
zlib
|
|
|
|
xz
|
|
|
|
gzip
|
|
|
|
bzip2
|
|
|
|
gnutar
|
|
|
|
p7zip
|
|
|
|
cabextract
|
|
|
|
squashfsTools
|
|
|
|
xz
|
|
|
|
pycrypto
|
|
|
|
]
|
|
|
|
++ 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
|
|
|
};
|
|
|
|
}
|