-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathset-custom-icons.py
More file actions
executable file
·106 lines (92 loc) · 3.81 KB
/
set-custom-icons.py
File metadata and controls
executable file
·106 lines (92 loc) · 3.81 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
#!/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)
url = "http://127.0.0.1:8080/api/v2/custom-nodes"
def update_icon(base_url, bearer, kind_name, icon_name, icon_color, icon_type="font-awesome", verify=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")
# 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}"
update_icon(url, args.bearer, "NetworkShareSMB", "folder-tree", "#ffb1a3")
update_icon(url, args.bearer, "NetworkShareDFS", "folder-tree", "#ffb1a3")
update_icon(url, args.bearer, "File", "file", "#eaeaea")
update_icon(url, args.bearer, "Directory", "folder", "#ffe08c")
update_icon(url, args.bearer, "NetworkShareHost", "server", "#878a89")