ldapconsole icon indicating copy to clipboard operation
ldapconsole copied to clipboard

[bug] Error 'str' object has no attribute 'decode' when using the preset query all_users

Open LightxR opened this issue 1 year ago • 0 comments

When I tried the preset query all_users on a brand new Windows Server 2019, I got this error :

image

By changing code in the get_all_users function, it works fine (don't know if it's the intended way though) :

image

Modification in the get_all_users : removing the [0].decode(utf-8) part and [0] on _sAMAccountName and _sid variables respectively :

        if len(results.keys()) != 0:
            if attributes == ["objectSid", "sAMAccountName"]:
                for distinguishedName in results.keys():
                    _sAMAccountName = results[distinguishedName]["sAMAccountName"]
                    _sid = format_sid(results[distinguishedName]["objectSid"])
                    print(" | \x1b[93m%-25s\x1b[0m : \x1b[96m%s\x1b[0m" % (_sAMAccountName, _sid))

LightxR avatar Jul 18 '24 07:07 LightxR