Security

How to use ldapfilter with ldapsearch to get group names?

kiran331
Builder

Hi

I'm running a ldapsearch for groups to get its members, but I need only the group objects excluding the user objects, I'm trying to to use sAMAccountType to differentiate the groups and users of the parent group but its not working, is there any alternative option?

ldap search i'm using:

|ldapsearch domain="abc" search=(&(objectClass=group)(cn=tt_users))|ldapgroup |table cn member_name|mvexpand member_namemember|ldapfilter search "cn=$member_name$ attrs"sAMAccountType"|search sAMAccountType="Group_Object"|table cn member_name sAMAccountType

0 Karma

BigCosta
Path Finder

Hi!
This code leave only group objects, excluding the user objects.

| ldapsearch search="(&(objectClass=group)(cn=tt_users))" attrs="cn,distinguishedName"
| ldapgroup
| table cn member_name
| mvexpand member_name
| ldapfilter search="(&(objectClass=group)(cn=$member_name$))" attrs="objectSid"

alemarzu
Motivator

Hi there @kiran331

Im not quite sure what you are trying to accomplish, can u elaborate further ?

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...