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