We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b14c3f commit 6e59002Copy full SHA for 6e59002
1 file changed
nxc/parsers/ldap_results.py
@@ -8,6 +8,15 @@ def parse_result_attributes(ldap_response):
8
continue
9
attribute_map = {}
10
for attribute in entry["attributes"]:
11
- attribute_map[str(attribute["type"])] = str(attribute["vals"][0])
+ val_list = []
12
+ for val in attribute["vals"].components:
13
+ try:
14
+ # Attempt to decode as UTF-8
15
+ decoded_val = val.decode("utf-8")
16
+ except (UnicodeDecodeError, AttributeError):
17
+ # If it fails, fall back to hexadecimal representation
18
+ decoded_val = val.hex() if isinstance(val, bytes) else str(val)
19
+ val_list.append(decoded_val)
20
+ attribute_map[str(attribute["type"])] = val_list if len(val_list) > 1 else val_list[0]
21
parsed_response.append(attribute_map)
- return parsed_response
22
+ return parsed_response
0 commit comments