Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 693 Bytes

ldap_commands.md

File metadata and controls

31 lines (25 loc) · 693 Bytes

list naming Contexts

ldapsearch -h 10.10.10.161 -x -s base namingContexts

# output
...
...
dn:
namingContexts: DC=htb,DC=local
namingContexts: CN=Configuration,DC=htb,DC=local
namingContexts: CN=Schema,CN=Configuration,DC=htb,DC=local
...
...

search a base and show structures and data

ldapsearch -h 10.10.10.161 -x -b "DC=htb,DC=local"

filter an object class from base data

ldapsearch -h 10.10.10.161 -x -b "DC=htb,DC=local" '(ObjectClass=User)'

list all user accounts # will miss service accounts

ldapsearch -h 10.10.10.161 -x -b "DC=htb,DC=local" '(ObjectClass=User)' sAMAccountName | grep sAMAccountName | sed 's/.*: //g'