-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathset-custom-icons.py
More file actions
executable file
·118 lines (99 loc) · 4.13 KB
/
set-custom-icons.py
File metadata and controls
executable file
·118 lines (99 loc) · 4.13 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File name : set-custom-icons.py
# Author : Remi Gascou (@podalirius_)
# Date created : 19 Sep 2025
import argparse
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def update_icon(base_url, bearer, kind_name, icon_name, icon_color, icon_type="font-awesome", verify=False, debug=False):
api_v2_custom_nodes_route = "api/v2/custom-nodes"
r = requests.get(
url=f"{base_url}/{api_v2_custom_nodes_route}/{kind_name}",
headers={
"Authorization": f"Bearer {bearer}",
"Content-Type": "application/json"
},
verify=verify
)
if r.status_code == 404:
print(f"[>] Custom icon for {kind_name} does not exist (HTTP {r.status_code}), creating it...")
r = requests.post(
url=f"{base_url}/{api_v2_custom_nodes_route}",
headers={
"Authorization": f"Bearer {bearer}",
"Content-Type": "application/json"
},
json={
"custom_types": {
kind_name: {
"icon": {
"type": icon_type,
"name": icon_name,
"color": icon_color
}
}
}
},
verify=verify
)
if r.status_code == 200:
print(f" └──[+] Custom icon for {kind_name} updated successfully")
else:
print(f" └──[!] Failed to update custom icon for {kind_name} (HTTP {r.status_code})")
print(r.text)
return
elif r.status_code == 200:
print(f"[>] Custom icon for {kind_name} already exists (HTTP {r.status_code}), updating it...")
r = requests.put(
url=f"{base_url}/{api_v2_custom_nodes_route}/{kind_name}",
headers={
"Authorization": f"Bearer {bearer}",
"Content-Type": "application/json"
},
json={
"config": {
"icon": {
"type": icon_type,
"name": icon_name,
"color": icon_color
}
}
},
verify=verify
)
if r.status_code == 200:
print(f" └──[+] Custom icon for {kind_name} updated successfully")
else:
print(f" └──[!] Failed to update custom icon for {kind_name} (HTTP {r.status_code})")
print(r.text)
return
else:
print(f"[!] Failed to get status of custom icon for {kind_name} (HTTP {r.status_code})")
print(r.text)
return
def parse_args():
parser = argparse.ArgumentParser(description="Set custom icons for nodes")
parser.add_argument("--debug", action="store_true", help="Debug mode")
# BloodHound configuration
bloodhound_group = parser.add_argument_group('BloodHound Configuration')
bloodhound_group.add_argument("-H", "--host", type=str, default="127.0.0.1", help="BloodHound host")
bloodhound_group.add_argument("-P", "--port", type=int, default=8080, help="BloodHound port")
bloodhound_group.add_argument("-b", "--bearer", type=str, required=True, help="Bearer token for authentication")
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
url = f"http://{args.host}:{args.port}"
kinds = [
("KeyCredential", "vault", "#c3d1da"),
("KeyCredentialUnknownKeyMaterial", "key", "#dcd4e0"),
("KeyCredentialDSAPrivateKey", "key", "#ebded3"),
("KeyCredentialRSAPrivateKey", "key", "#ebded3"),
("KeyCredentialECCPrivateKey", "key", "#ebded3"),
("KeyCredentialDSAPublicKey", "key", "#a1d7d7"),
("KeyCredentialRSAPublicKey", "key", "#a1d7d7"),
("KeyCredentialECCPublicKey", "key", "#a1d7d7")
]
for kind, icon_name, icon_color in kinds:
update_icon(base_url=url, bearer=args.bearer, kind_name=kind, icon_name=icon_name, icon_color=icon_color, debug=args.debug)