2021-01-25 09:26:54 +01:00
|
|
|
{ lib
|
2018-10-15 17:47:16 +02:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-02-06 15:00:36 +01:00
|
|
|
, stdenv
|
2018-10-15 17:47:16 +02:00
|
|
|
, zlib
|
|
|
|
, xz
|
|
|
|
, ncompress
|
|
|
|
, gzip
|
|
|
|
, bzip2
|
|
|
|
, gnutar
|
2020-06-11 15:17:03 +02:00
|
|
|
, p7zip
|
2018-10-15 17:47:16 +02:00
|
|
|
, cabextract
|
2020-07-31 01:30:44 +02:00
|
|
|
, cramfsprogs
|
|
|
|
, cramfsswap
|
2020-10-26 03:22:19 +01:00
|
|
|
, sasquatch
|
|
|
|
, squashfsTools
|
2018-10-15 17:47:16 +02:00
|
|
|
, lzma
|
2020-08-16 13:13:17 +02:00
|
|
|
, matplotlib
|
2020-01-17 22:57:00 +01:00
|
|
|
, nose
|
2018-10-15 17:47:16 +02:00
|
|
|
, pycrypto
|
2021-02-01 19:17:58 +01:00
|
|
|
, pyqtgraph
|
|
|
|
, visualizationSupport ? false }:
|
2018-10-15 17:47:16 +02:00
|
|
|
|
2021-02-06 15:00:36 +01:00
|
|
|
buildPythonPackage rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "binwalk";
|
2021-02-06 15:00:36 +01:00
|
|
|
version = "2.2.0";
|
2018-10-15 17:47:16 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-02-06 15:00:36 +01:00
|
|
|
owner = "ReFirmLabs";
|
2018-10-15 17:47:16 +02:00
|
|
|
repo = "binwalk";
|
2021-02-06 15:00:36 +01:00
|
|
|
rev = "v${version}";
|
2020-01-17 22:57:00 +01:00
|
|
|
sha256 = "1bxgj569fzwv6jhcbl864nmlsi9x1k1r20aywjxc8b9b1zgqrlvc";
|
2018-10-15 17:47:16 +02:00
|
|
|
};
|
|
|
|
|
2021-02-06 15:00:36 +01:00
|
|
|
propagatedBuildInputs = [ zlib xz ncompress gzip bzip2 gnutar p7zip cabextract squashfsTools lzma pycrypto ]
|
|
|
|
++ lib.optionals visualizationSupport [ matplotlib pyqtgraph ]
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ cramfsprogs cramfsswap sasquatch ];
|
2020-01-17 22:57:00 +01: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)
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkInputs = [ nose ];
|
2018-10-15 17:47:16 +02:00
|
|
|
|
2021-02-06 15:00:36 +01:00
|
|
|
pythonImportsCheck = [ "binwalk" ];
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-12-08 17:50:31 +01:00
|
|
|
homepage = "https://github.com/ReFirmLabs/binwalk";
|
2018-10-15 17:47:16 +02:00
|
|
|
description = "A tool for searching a given binary image for embedded files";
|
|
|
|
maintainers = [ maintainers.koral ];
|
|
|
|
};
|
|
|
|
}
|