nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 asn1crypto,
5 badldap,
6 buildPythonPackage,
7 certipy,
8 cryptography,
9 dnspython,
10 fetchFromGitHub,
11 hatchling,
12 kerbad,
13 pytestCheckHook,
14 winacl,
15}:
16
17buildPythonPackage (finalAttrs: {
18 pname = "bloodyad";
19 version = "2.5.4";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "CravateRouge";
24 repo = "bloodyAD";
25 tag = "v${finalAttrs.version}";
26 hash = "sha256-6ZSJTupjVhvyU9G/eePJiXk16w9HwpsOFwdwTSLb7tU=";
27 };
28
29 pythonRelaxDeps = [ "cryptography" ];
30
31 pythonRemoveDeps = [
32 "kerbad"
33 "badldap"
34 ];
35
36 build-system = [ hatchling ];
37
38 # Upstream provides two package scripts: bloodyad and bloodyAD,
39 # but this causes a FileAlreadyExists error during installation
40 # on Darwin (case-insensitive filesystem).
41 # https://github.com/CravateRouge/bloodyAD/issues/99
42 postPatch = lib.optionals stdenv.hostPlatform.isDarwin ''
43 substituteInPlace pyproject.toml \
44 --replace-fail "bloodyAD = \"bloodyAD.main:main\"" ""
45 '';
46
47 dependencies = [
48 asn1crypto
49 badldap
50 cryptography
51 dnspython
52 kerbad
53 winacl
54 ];
55
56 nativeCheckInputs = [
57 certipy
58 pytestCheckHook
59 ];
60
61 pythonImportsCheck = [ "bloodyAD" ];
62
63 disabledTests = [
64 # Tests require network access
65 "test_kerberos_authentications"
66 "test_01AuthCreateUser"
67 "test_02SearchAndGetChildAndGetWritable"
68 "test_03UacOwnerGenericShadowGroupPasswordDCSync"
69 "test_04ComputerRbcdGetSetAttribute"
70 "test_06AddRemoveGetDnsRecord"
71 "test_certificate_authentications"
72 "test_04ComputerRbcdRestoreGetSetAttribute"
73 ];
74
75 disabledTestPaths = [
76 # TypeError: applyFormatters() takes 1 positional argument but 2 were given
77 # https://github.com/CravateRouge/bloodyAD/issues/98
78 "tests/test_formatters.py"
79 ];
80
81 meta = {
82 description = "Module for Active Directory Privilege Escalations";
83 homepage = "https://github.com/CravateRouge/bloodyAD";
84 changelog = "https://github.com/CravateRouge/bloodyAD/releases/tag/${finalAttrs.src.tag}";
85 license = lib.licenses.mit;
86 maintainers = with lib.maintainers; [ fab ];
87 };
88})