2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-02-13 14:23:35 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, zlib
|
|
|
|
, xz
|
|
|
|
, ncompress
|
|
|
|
, 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 {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "binwalk";
|
2021-04-25 03:57:28 +00:00
|
|
|
version = "2.3.1";
|
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}";
|
2021-04-25 03:57:28 +00:00
|
|
|
sha256 = "108mj4jjffdmaz6wjvglbv44j7fkhspaxz1rj2bi1fcnwsri5wsm";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
propagatedBuildInputs = [ zlib xz ncompress 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)
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkInputs = [ nose ];
|
|
|
|
|
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";
|
|
|
|
maintainers = [ maintainers.koral ];
|
2021-04-25 03:57:28 +00:00
|
|
|
license = licenses.mit;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|