sense-of-security / ADRecon

ADRecon is a tool which gathers information about the Active Directory and generates a report which can provide a holistic picture of the current state of the target AD environment.
https://senseofsecurity.com.au/
GNU Affero General Public License v3.0
1.7k stars 279 forks source link

Improper parser of ManagedBy when Accounts are Entered Last, First #20

Open cramos6520 opened 4 years ago

cramos6520 commented 4 years ago

My domain uses Last, First format for the accounts. When the script parses the ManagedByValue it returns only the Last Name. The DN is a follow:

CN=Ramos\, Carlos,OU=Technology_HQ,OU=Users,DC=Domain,DC=local

Script result is Ramos\

I thought I could fix with the follow code replacement but not sure why it is not wording. Your Code: ManagedBy = (ManagedByValue.Split(',')[0]).Split('=')[1]; Replacement: ManagedBy = (ManagedByValue.Split(',OU=')[0]).Replace('\,',',').Replace('CN=','');

I see your code uses a Class. Never used them so wondering it the syntax of it is not acceptable in a class.

I would think it would be advantages for your script to be able to handle such a situation. I have worked with several large companies and they all used Last, First for accounts. Only ran into one merge where the other company use first last.

Any help is appreciated.

Thanks,

Carlos

PS Beautiful work on the script. Thanks for sharing it.