1{
2 lib,
3 stdenv,
4 asn1crypto,
5 buildPythonPackage,
6 defusedxml,
7 dissect-btrfs,
8 dissect-cim,
9 dissect-clfs,
10 dissect-cstruct,
11 dissect-esedb,
12 dissect-etl,
13 dissect-eventlog,
14 dissect-evidence,
15 dissect-extfs,
16 dissect-fat,
17 dissect-ffs,
18 dissect-hypervisor,
19 dissect-ntfs,
20 dissect-regf,
21 dissect-shellitem,
22 dissect-sql,
23 dissect-thumbcache,
24 dissect-util,
25 dissect-volume,
26 dissect-xfs,
27 docutils,
28 fetchFromGitHub,
29 flow-record,
30 fusepy,
31 impacket,
32 ipython,
33 paho-mqtt,
34 pycryptodome,
35 pytestCheckHook,
36 pythonOlder,
37 ruamel-yaml,
38 setuptools,
39 setuptools-scm,
40 structlog,
41 tomli,
42 yara-python,
43 zstandard,
44}:
45
46buildPythonPackage rec {
47 pname = "dissect-target";
48 version = "3.20.1";
49 pyproject = true;
50
51 disabled = pythonOlder "3.9";
52
53 src = fetchFromGitHub {
54 owner = "fox-it";
55 repo = "dissect.target";
56 tag = version;
57 hash = "sha256-kB1RhLnmsK77V5uI/GesRQX//awWKVAtWUGgtj38URM=";
58 };
59
60 postPatch = ''
61 substituteInPlace pyproject.toml \
62 --replace-fail "flow.record~=" "flow.record>="
63 '';
64
65 build-system = [
66 setuptools
67 setuptools-scm
68 ];
69
70 dependencies = [
71 defusedxml
72 dissect-cstruct
73 dissect-eventlog
74 dissect-evidence
75 dissect-hypervisor
76 dissect-ntfs
77 dissect-regf
78 dissect-util
79 dissect-volume
80 flow-record
81 structlog
82 ];
83
84 optional-dependencies = {
85 full = [
86 asn1crypto
87 dissect-btrfs
88 dissect-cim
89 dissect-clfs
90 dissect-esedb
91 dissect-etl
92 dissect-extfs
93 dissect-fat
94 dissect-ffs
95 dissect-shellitem
96 dissect-sql
97 dissect-thumbcache
98 dissect-xfs
99 fusepy
100 ipython
101 pycryptodome
102 ruamel-yaml
103 yara-python
104 zstandard
105 ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
106 yara = [ yara-python ] ++ optional-dependencies.full;
107 smb = [ impacket ] ++ optional-dependencies.full;
108 mqtt = [ paho-mqtt ] ++ optional-dependencies.full;
109 };
110
111 nativeCheckInputs = [
112 docutils
113 pytestCheckHook
114 ] ++ optional-dependencies.full;
115
116 pythonImportsCheck = [ "dissect.target" ];
117
118 disabledTests =
119 [
120 "test_cpio"
121 "test_env_parser"
122 "test_cp_directory"
123 "test_cp_subdirectories"
124 "test_shell_cli"
125 "test_shell_cmd"
126 # Test requires rdump
127 "test_exec_target_command"
128 # Issue with tar file
129 "test_dpapi_decrypt_blob"
130 "test_md"
131 "test_nested_md_lvm"
132 "test_notifications_appdb"
133 "test_notifications_wpndatabase"
134 "test_tar_anonymous_filesystems"
135 "test_tar_sensitive_drive_letter"
136 # Tests compare dates and times
137 "yum"
138 # Filesystem access, windows defender tests
139 "test_config_tree_plugin"
140 "test_defender_quarantine_recovery"
141 "test_execute_pipeline"
142 "test_keychain_register_keychain_file"
143 "test_plugins_child_docker"
144 "test_plugins_child_wsl"
145 "test_reg_output"
146 "test_regflex"
147 "test_systemd_basic_syntax"
148 "test_target"
149 "test_yara"
150 ]
151 ++
152 # test is broken on Darwin
153 lib.optional stdenv.hostPlatform.isDarwin "test_fs_attrs_no_os_listxattr";
154
155 disabledTestPaths = [
156 # Tests are using Windows paths, missing test files
157 "tests/plugins/apps/"
158 # ValueError: Invalid Locate file magic. Expected /x00LOCATE02/x00
159 "tests/plugins/os/unix/locate/"
160 # Missing plugin support
161 "tests/plugins/child/"
162 "tests/tools/test_dump.py"
163 "tests/plugins/os/"
164 "tests/test_container.py"
165 "tests/plugins/filesystem/"
166 "tests/test_registration.py"
167 "tests/filesystems/"
168 "tests/test_filesystem.py"
169 "tests/loaders/"
170 ];
171
172 meta = with lib; {
173 description = "Dissect module that provides a programming API and command line tools";
174 homepage = "https://github.com/fox-it/dissect.target";
175 changelog = "https://github.com/fox-it/dissect.target/releases/tag/${src.tag}";
176 license = licenses.agpl3Only;
177 maintainers = with maintainers; [ fab ];
178 };
179}