ADExplorerSnapshot.py
ADExplorerSnapshot.py copied to clipboard
Unable to Pickle wchar[]
Traceback (most recent call last):
File "/home/USER/Downloads/ADExplorerSnapshot.py/ADExplorerSnapshot.py", line 2, in <module>
adexpsnapshot.main()
File "/home/USER/Downloads/ADExplorerSnapshot.py/adexpsnapshot/__init__.py", line 1133, in main
ades.outputBloodHound()
File "/home/USER/Downloads/ADExplorerSnapshot.py/adexpsnapshot/__init__.py", line 129, in outputBloodHound
self.preprocessCached()
File "/home/USER/Downloads/ADExplorerSnapshot.py/adexpsnapshot/__init__.py", line 178, in preprocessCached
Pickler(open(cachePath, "wb")).dump(dico)
_pickle.PicklingError: Can't pickle <class 'types.wchar[]'>: attribute lookup wchar[] on types failed
Temporary solution was: init.py
@@ -126,7 +126,8 @@ class ADExplorerSnapshot(object):
self.log.success(f"Output written to {outputfile}")
def outputBloodHound(self):
- self.preprocessCached()
+ # self.preprocessCached()
+ self.preprocess()
self.numUsers = 0
self.numGroups = 0
this fix worked for me, just logged in to comment and thank @t94j0
This issue rises since one of the dependencies got updated, since it works for with an older version.
The code crashes on line 178, since the dict we're trying to pickle has a few sub-dicts, which have keys that are of type "wchar[]" instead of "str" (as it was in the older version)
Fixed it by turning each wchar[] back to 'str', hopefully it didn't break anything important:
File __init__.py,
line 194:
objectSid = ADUtils.get_entry_property(obj, 'objectSid')
objectSid = str(objectSid)
line 199:
distinguishedName = ADUtils.get_entry_property(obj, 'distinguishedName')
distinguishedName = str(distinguishedName)
line 215:
ncname = ADUtils.get_entry_property(obj, 'nCName')
ncname = str(ncname)
line 221:
dnshostname = ADUtils.get_entry_property(obj, 'dNSHostname')
dnshostname = str(dnshostname)
lines 226-231:
if 'pkienrollmentservice' in obj.classes:
name = ADUtils.get_entry_property(obj, 'name')
name = str(name)
if ADUtils.get_entry_property(obj, 'certificateTemplates'):
templates = ADUtils.get_entry_property(obj, 'certificateTemplates')\
templates = str(templates)
for template in templates:
self.certtemplates[template].add(name)
@YairCyeSec worked, thanks!
@YairCyeSec thx!
my bad for not pinning versions 💛