-
Notifications
You must be signed in to change notification settings - Fork 362
Open
Description
Here i'm trying to gather information from the internal domain which is accessed through ligolo tunnel. Net exec and other tools work fine in this setup but bloodhound python fails to do so.
Here is the sample ldap connection that i have written to test if is is a library issue but here it works fine
Here is the connection with bloodhound python to the same server in similar env
Here the connection remains close but on the sample script that i've used has a connection open
from ldap3 import Server, Connection, NTLM, ALL
ldap_server = 'ldap://{IP}:389'
domain = ''
username = ''
password = ''
user_ntlm = f"{domain}\\{username}"
print("[DEBUG] LDAP server URL:", ldap_server)
print("[DEBUG] NTLM User:", user_ntlm)
try:
print("[DEBUG] Creating server object...")
server = Server(ldap_server, get_info=ALL) # Use get_info=ALL for full server info
print("[DEBUG] Server object created:", server)
print("[DEBUG] Establishing connection with NTLM authentication...")
conn = Connection(
server,
user=user_ntlm,
password=password,
authentication=NTLM,
auto_bind=True
)
print(conn)
print("[INFO] Successfully connected and bound to the LDAP server!")
search_base = 'DC=,DC='
search_filter = '(objectClass=user)'
attributes = ['cn']
print(f"[DEBUG] Performing LDAP search in base '{search_base}' with filter '{search_filter}'...")
conn.search(search_base, search_filter, attributes=attributes)
except Exception as e:
print("[ERROR] An error occurred during LDAP operation:")
print(e)
finally:
if 'conn' in locals() and conn.bound:
print("[DEBUG] Unbinding connection...")
conn.unbind()
print("[INFO] Connection unbound.")
print("Connection unbound.")
Metadata
Metadata
Assignees
Labels
No labels

