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.23.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-WOFtDFCN3OfhEjfhEgwtJN/tQVRGvd2RMQzcKtf0atU=";
58 fetchLFS = true;
59 };
60
61 postPatch = ''
62 substituteInPlace pyproject.toml \
63 --replace-fail "flow.record~=" "flow.record>="
64 '';
65
66 build-system = [
67 setuptools
68 setuptools-scm
69 ];
70
71 dependencies = [
72 defusedxml
73 dissect-cstruct
74 dissect-eventlog
75 dissect-evidence
76 dissect-hypervisor
77 dissect-ntfs
78 dissect-regf
79 dissect-util
80 dissect-volume
81 flow-record
82 structlog
83 ];
84
85 optional-dependencies = {
86 full = [
87 asn1crypto
88 dissect-btrfs
89 dissect-cim
90 dissect-clfs
91 dissect-esedb
92 dissect-etl
93 dissect-extfs
94 dissect-fat
95 dissect-ffs
96 dissect-shellitem
97 dissect-sql
98 dissect-thumbcache
99 dissect-xfs
100 fusepy
101 ipython
102 pycryptodome
103 ruamel-yaml
104 yara-python
105 zstandard
106 ]
107 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
108 yara = [ yara-python ] ++ optional-dependencies.full;
109 smb = [ impacket ] ++ optional-dependencies.full;
110 mqtt = [ paho-mqtt ] ++ optional-dependencies.full;
111 };
112
113 nativeCheckInputs = [
114 docutils
115 pytestCheckHook
116 ]
117 ++ optional-dependencies.full;
118
119 pythonImportsCheck = [ "dissect.target" ];
120
121 disabledTests = [
122 "test_cp_directory"
123 "test_cp_subdirectories"
124 "test_cpio"
125 "test_env_parser"
126 "test_list_json"
127 "test_list"
128 "test_shell_cli"
129 "test_shell_cmd"
130 "test_shell_prompt_tab_autocomplete"
131 # Test requires rdump
132 "test_exec_target_command"
133 # Issue with tar file
134 "test_dpapi_decrypt_blob"
135 "test_md"
136 "test_nested_md_lvm"
137 "test_notifications_appdb"
138 "test_notifications_wpndatabase"
139 "test_tar_anonymous_filesystems"
140 "test_tar_sensitive_drive_letter"
141 # Tests compare dates and times
142 "yum"
143 # Filesystem access, windows defender tests
144 "test_config_tree_plugin"
145 "test_defender_quarantine_recovery"
146 "test_execute_pipeline"
147 "test_keychain_register_keychain_file"
148 "test_plugins_child_docker"
149 "test_plugins_child_wsl"
150 "test_reg_output"
151 "test_regflex"
152 "test_systemd_basic_syntax"
153 "test_target"
154 "test_yara"
155 ]
156 ++
157 # test is broken on Darwin
158 lib.optional stdenv.hostPlatform.isDarwin "test_fs_attrs_no_os_listxattr";
159
160 disabledTestPaths = [
161 # Tests are using Windows paths, missing test files
162 "tests/plugins/apps/"
163 # ValueError: Invalid Locate file magic. Expected /x00LOCATE02/x00
164 "tests/plugins/os/unix/locate/"
165 # Missing plugin support
166 "tests/plugins/child/"
167 "tests/tools/test_dump.py"
168 "tests/plugins/os/"
169 "tests/test_container.py"
170 "tests/plugins/filesystem/"
171 "tests/filesystems/"
172 "tests/test_filesystem.py"
173 "tests/loaders/"
174 ];
175
176 meta = with lib; {
177 description = "Dissect module that provides a programming API and command line tools";
178 homepage = "https://github.com/fox-it/dissect.target";
179 changelog = "https://github.com/fox-it/dissect.target/releases/tag/${src.tag}";
180 license = licenses.agpl3Only;
181 maintainers = with maintainers; [ fab ];
182 };
183}