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