netanelcyber / netanelcyber/AdPentestAI-Python

Performance: LDAP and SMB connection pooling

Open
#16 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help-wanted networking optimization performance v1.1.0
Dominant language
Python
Stars
5
Forks
2
Avg merge
22h 25m
Merged PRs (30d)
7

Description

Description

Implement connection pooling for LDAP and SMB connections to avoid repeated connection overhead during parallel tool execution.

Current Behavior

  • Each tool creates new LDAP connection
  • Each tool creates new SMB connection
  • Redundant TLS handshakes
  • Redundant NTLM negotiation

Proposed Implementation

  1. LDAP Connection Pool

    • Reuse anonymous bind connections across tools
    • RootDSE queries share connection
    • Per-DC pool (multiple DCs may be discovered)
    • Connection timeout and re-establishment
  2. SMB Connection Pool

    • Reuse authenticated SMB sessions
    • Share enumeration reuses connections
    • Null session pooling (if available)
    • Automatic reconnection on timeout
  3. Pool Management

    • Max 10 connections per DC (configurable)
    • Idle timeout: 300 seconds
    • LRU eviction policy
    • Health check before reuse

Implementation

  • Create: adpentest/connection_pool.py
  • Singleton pattern for pool management
  • Thread-safe with locks
  • Metrics tracking (hit rate, misses, timeouts)

Files to Update

  • adpentest/core.py - Use pooled connections
  • Create: adpentest/connection_pool.py

Success Criteria

  • 50%+ reduction in connection overhead
  • No connection pool exhaustion under 16 concurrent tools
  • Transparent to existing code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading adpentest/core.py to trace how LDAP and SMB connections are created during parallel tool execution. Then design the thread-safe singleton in the new adpentest/connection_pool.py, including per-DC pooling, limits, timeouts, reconnection, eviction, health checks, and metrics. Done means core.py uses the pools transparently and the stated concurrency and connection-overhead criteria are met.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.