Skip to content

Add NativeLdapRootDse method for direct LDAP queries - #75

Open
netanelcyber wants to merge 1 commit into
claude/pentesting-active-directory-bfghhzfrom
claude/project-thread-c2l4r8
Open

netanelcyber wants to merge 1 commit into
claude/pentesting-active-directory-bfghhzfrom
claude/project-thread-c2l4r8

Conversation

@netanelcyber

Copy link
Copy Markdown
Owner

Requested by NETANEL · project thread

Summary

Before: The LDAP scan workflow had an incomplete line (var s=new) that would not compile, and there was no native C# method to query LDAP RootDSE attributes directly.

After: A complete NativeLdapRootDse(string ip) method queries RootDSE via System.DirectoryServices.Protocols with anonymous bind and returns a JObject containing all standard AD attributes (defaultNamingContext, forestFunctionality, dnsHostName, supportedLDAPVersion, etc.).

The fixed calling pattern:

var ldapResult = NativeLdapRootDse(ip);
scanResults["ldap_rootdse"] = ldapResult;

How

  • Added System.DirectoryServices.Protocols assembly reference and namespace import
  • Added System.Net namespace import (for credentials support)
  • Implemented NativeLdapRootDse as a static method returning JObject with:
    • Anonymous LDAP bind on port 389 with 10s timeout
    • Queries 15 standard RootDSE attributes
    • Multi-valued attributes stored as JArray, single-valued as strings
    • Error handling for LdapException (with error code) and general exceptions

🤖 Generated with Claude Code

https://claude.ai/code/session_01W6vJrahr1eQimvjAuoAbpJ


Generated by Claude Code

Adds a C# method that queries LDAP RootDSE attributes (defaultNamingContext,
forestFunctionality, dnsHostName, etc.) directly via System.DirectoryServices.Protocols,
returning results as a JObject. Includes anonymous bind with 10s timeout and
proper error handling for LdapException.

Also adds the required assembly reference and namespace imports for
System.DirectoryServices.Protocols and System.Net.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6vJrahr1eQimvjAuoAbpJ
@netanelcyber netanelcyber self-assigned this Sep 28, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants