summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/capa/default.nix
blob: 4aeb280f6ad11bfa314cf11c99a2b973b9bb6abf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
  lib,
  buildPythonPackage,
  colorama,
  deptry,
  dncil,
  dnfile,
  fetchFromGitHub,
  humanize,
  ida-netnode,
  ida-settings,
  jschema-to-python,
  msgspec,
  mypy-protobuf,
  mypy,
  networkx,
  pefile,
  protobuf,
  psutil,
  pydantic,
  pyelftools,
  pyghidra,
  pygithub,
  pytest-instafail,
  pytest-sugar,
  pytestCheckHook,
  python-flirt,
  pyyaml,
  requests,
  rich,
  ruamel-yaml,
  sarif-om,
  setuptools-scm,
  setuptools,
  stix2,
  types-colorama,
  types-protobuf,
  types-psutil,
  types-pyyaml,
  types-requests,
  viv-utils,
  vivisect,
  writableTmpDirAsHomeHook,
  xmltodict,
}:

buildPythonPackage (finalAttrs: {
  pname = "capa";
  version = "9.4.0";
  pyproject = true;

  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "mandiant";
    repo = "capa";
    tag = "v${finalAttrs.version}";
    hash = "sha256-h9ML+TJe9NprBEy4W7XKahmUTM0d4vY0zIFs6MxYzZ8=";
    fetchSubmodules = true;
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    colorama
    dncil
    dnfile
    humanize
    ida-netnode
    ida-settings
    msgspec
    networkx
    pefile
    protobuf
    pydantic
    pyelftools
    python-flirt
    pyyaml
    rich
    ruamel-yaml
    viv-utils
    vivisect
    xmltodict
  ];

  optional-dependencies = {
    ghidra = [ pyghidra ];
    scripts = [
      jschema-to-python
      psutil
      requests
      sarif-om
      stix2
    ];
  };

  nativeCheckInputs = [
    pygithub
    pytestCheckHook
    pytest-instafail
    pytest-sugar
    types-colorama
    types-protobuf
    types-psutil
    types-pyyaml
    types-requests
    writableTmpDirAsHomeHook
  ];

  pythonImportsCheck = [ "capa" ];

  disabledTests = [
    # AssertionError
    "test_is_dev_environment"
    "test_rule_cache_dev_environment"
    "test_scripts"
    "test_binexport_scripts"
  ];

  meta = {
    description = "Tool to identify capabilities in executable files";
    homepage = "https://github.com/mandiant/capa";
    changelog = "https://github.com/mandiant/capa/blob/${finalAttrs.src.tag}/CHANGELOG.md";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ fab ];
    mainProgram = "capa";
  };
})