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