1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
stdenv,
zlib,
xz,
gzip,
bzip2,
gnutar,
p7zip,
cabextract,
cramfsprogs,
cramfsswap,
sasquatch,
squashfsTools,
matplotlib,
nose,
pycrypto,
pyqtgraph,
visualizationSupport ? false,
}:
buildPythonPackage rec {
pname = "binwalk${lib.optionalString visualizationSupport "-full"}";
version = "2.3.4";
format = "setuptools";
src = fetchFromGitHub {
owner = "ReFirmLabs";
repo = "binwalk";
rev = "v${version}";
hash = "sha256-hlPbzqGRSXcIqlI+SNKq37CnnHd1IoMBNSjhyeAM1TE=";
};
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;
})
];
propagatedBuildInputs =
[
zlib
xz
gzip
bzip2
gnutar
p7zip
cabextract
squashfsTools
xz
pycrypto
]
++ lib.optionals visualizationSupport [
matplotlib
pyqtgraph
]
++ lib.optionals (!stdenv.isDarwin) [
cramfsprogs
cramfsswap
sasquatch
];
# 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)
'';
nativeCheckInputs = [ nose ];
pythonImportsCheck = [ "binwalk" ];
meta = with lib; {
homepage = "https://github.com/ReFirmLabs/binwalk";
description = "Tool for searching a given binary image for embedded files";
mainProgram = "binwalk";
maintainers = [ maintainers.koral ];
license = licenses.mit;
};
}
|