1{ lib
2, buildPythonPackage
3, capstone
4, click
5, cryptography
6, dnfile
7, fetchFromGitHub
8, pefile
9, pycryptodomex
10, pyelftools
11, pythonOlder
12, pytestCheckHook
13, typing-extensions
14, yara-python
15}:
16
17buildPythonPackage rec {
18 pname = "malduck";
19 version = "4.3.2";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchFromGitHub {
25 owner = "CERT-Polska";
26 repo = pname;
27 rev = "refs/tags/v${version}";
28 hash = "sha256-3joIfhQBJzKdoU3FNW/yAHsQa/lMMbw3wGEQTyOBrOQ=";
29 };
30
31 propagatedBuildInputs = [
32 capstone
33 click
34 cryptography
35 dnfile
36 pefile
37 pycryptodomex
38 pyelftools
39 typing-extensions
40 yara-python
41 ];
42
43 postPatch = ''
44 substituteInPlace requirements.txt \
45 --replace "pefile==2019.4.18" "pefile" \
46 --replace "dnfile==0.11.0" "dnfile"
47 '';
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 ];
52
53 pythonImportsCheck = [
54 "malduck"
55 ];
56
57 meta = with lib; {
58 description = "Helper for malware analysis";
59 homepage = "https://github.com/CERT-Polska/malduck";
60 changelog = "https://github.com/CERT-Polska/malduck/releases/tag/v${version}";
61 license = with licenses; [ bsd3 ];
62 maintainers = with maintainers; [ fab ];
63 };
64}