PyADRecon-ADWS 0.3.9__tar.gz → 0.3.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/CHANGELOG.md +10 -10
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/PKG-INFO +3 -3
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/PyADRecon_ADWS.egg-info/PKG-INFO +3 -3
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/PyADRecon_ADWS.egg-info/SOURCES.txt +1 -2
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/README.md +2 -2
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/adws.py +38 -0
- pyadrecon_adws-0.3.11/package.json +3 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/pyadrecon_adws.py +63 -9
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/windows/README.md +3 -11
- pyadrecon_adws-0.3.9/package.json +0 -3
- pyadrecon_adws-0.3.9/windows/pyadrecon_adws.exe +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.dockerignore +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.github/FUNDING.yml +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.github/pyadrecon.png +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.github/workflows/conventional-commits.yml +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.github/workflows/pypi.yml +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/.gitignore +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/Dockerfile +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/LICENSE +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/PyADRecon_ADWS.egg-info/dependency_links.txt +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/PyADRecon_ADWS.egg-info/entry_points.txt +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/PyADRecon_ADWS.egg-info/requires.txt +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/PyADRecon_ADWS.egg-info/top_level.txt +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/__init__.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/__init__.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/__init__.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/encoder.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/__init__.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/attributes.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/constants.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/datatypes.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/elements.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/record.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/text.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/records/utils.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/encoder/xml_parser.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/ms_nmf.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/ms_nns.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws/soap_templates.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/helpers/adws_wrapper.py +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/pyproject.toml +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/requirements.txt +0 -0
- {pyadrecon_adws-0.3.9 → pyadrecon_adws-0.3.11}/setup.cfg +0 -0
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
## [0.3.
|
|
1
|
+
## [0.3.11](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.10...v0.3.11) (2026-02-20)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* properly traverse sids and display child/parent domain names for adcs certificate templates ([3e8b113](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/3e8b113832ab66e3139a081344fdad0dd38af59d))
|
|
7
7
|
|
|
8
|
-
## [0.3.
|
|
8
|
+
## [0.3.10](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.9...v0.3.10) (2026-02-20)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
### Bug Fixes
|
|
12
12
|
|
|
13
|
-
*
|
|
13
|
+
* properly catch referrals to parent ([3626f24](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/3626f2410301216b6969e724d8119e158ce372ff))
|
|
14
14
|
|
|
15
|
-
## [0.3.
|
|
15
|
+
## [0.3.9](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.8...v0.3.9) (2026-02-19)
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
### Bug Fixes
|
|
19
19
|
|
|
20
|
-
*
|
|
20
|
+
* columns coloring for user and computer stats tab ([c7b8b02](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/c7b8b0209722614685e5c4326a7d5c6d7328ec6d))
|
|
21
21
|
|
|
22
|
-
## [0.3.
|
|
22
|
+
## [0.3.8](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.7...v0.3.8) (2026-02-19)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
### Bug Fixes
|
|
26
26
|
|
|
27
|
-
*
|
|
27
|
+
* support forest-child enumerations with proper sid resolving ([15aff39](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/15aff39c015a5d017e8c6c9cb7a3dd4763af6d0b))
|
|
28
28
|
|
|
29
|
-
## [0.3.
|
|
29
|
+
## [0.3.7](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.6...v0.3.7) (2026-02-19)
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
### Bug Fixes
|
|
33
33
|
|
|
34
|
-
*
|
|
34
|
+
* forest support for child domain environments ([1deacd3](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/1deacd355dc4ce58e336a3b72ba758209e24297d))
|
|
35
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyADRecon-ADWS
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.11
|
|
4
4
|
Summary: Python Active Directory Reconnaissance Tool (ADRecon port) using ADWS with NTLM support.
|
|
5
5
|
Author: LRVT
|
|
6
6
|
License-Expression: MIT
|
|
@@ -53,7 +53,7 @@ pyadrecon_adws --version
|
|
|
53
53
|
````
|
|
54
54
|
|
|
55
55
|
> [!TIP]
|
|
56
|
-
> For Windows,
|
|
56
|
+
> For Windows, may read [this](https://github.com/l4rm4nd/PyADRecon/tree/main/windows). Only NTLM authentication works on Windows atm.
|
|
57
57
|
|
|
58
58
|
## Usage
|
|
59
59
|
|
|
@@ -88,7 +88,7 @@ options:
|
|
|
88
88
|
Comma-separated modules to collect (default: all)
|
|
89
89
|
--only-enabled Only collect enabled users/computers
|
|
90
90
|
--page-size PAGE_SIZE
|
|
91
|
-
ADWS query page size (default:
|
|
91
|
+
ADWS query page size (default: 256)
|
|
92
92
|
--dormant-days DORMANT_DAYS
|
|
93
93
|
Users/Computers with lastLogon older than X days are dormant (default: 90)
|
|
94
94
|
--password-age PASSWORD_AGE
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyADRecon-ADWS
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.11
|
|
4
4
|
Summary: Python Active Directory Reconnaissance Tool (ADRecon port) using ADWS with NTLM support.
|
|
5
5
|
Author: LRVT
|
|
6
6
|
License-Expression: MIT
|
|
@@ -53,7 +53,7 @@ pyadrecon_adws --version
|
|
|
53
53
|
````
|
|
54
54
|
|
|
55
55
|
> [!TIP]
|
|
56
|
-
> For Windows,
|
|
56
|
+
> For Windows, may read [this](https://github.com/l4rm4nd/PyADRecon/tree/main/windows). Only NTLM authentication works on Windows atm.
|
|
57
57
|
|
|
58
58
|
## Usage
|
|
59
59
|
|
|
@@ -88,7 +88,7 @@ options:
|
|
|
88
88
|
Comma-separated modules to collect (default: all)
|
|
89
89
|
--only-enabled Only collect enabled users/computers
|
|
90
90
|
--page-size PAGE_SIZE
|
|
91
|
-
ADWS query page size (default:
|
|
91
|
+
ADWS query page size (default: 256)
|
|
92
92
|
--dormant-days DORMANT_DAYS
|
|
93
93
|
Users/Computers with lastLogon older than X days are dormant (default: 90)
|
|
94
94
|
--password-age PASSWORD_AGE
|
|
@@ -33,7 +33,7 @@ pyadrecon_adws --version
|
|
|
33
33
|
````
|
|
34
34
|
|
|
35
35
|
> [!TIP]
|
|
36
|
-
> For Windows,
|
|
36
|
+
> For Windows, may read [this](https://github.com/l4rm4nd/PyADRecon/tree/main/windows). Only NTLM authentication works on Windows atm.
|
|
37
37
|
|
|
38
38
|
## Usage
|
|
39
39
|
|
|
@@ -68,7 +68,7 @@ options:
|
|
|
68
68
|
Comma-separated modules to collect (default: all)
|
|
69
69
|
--only-enabled Only collect enabled users/computers
|
|
70
70
|
--page-size PAGE_SIZE
|
|
71
|
-
ADWS query page size (default:
|
|
71
|
+
ADWS query page size (default: 256)
|
|
72
72
|
--dormant-days DORMANT_DAYS
|
|
73
73
|
Users/Computers with lastLogon older than X days are dormant (default: 90)
|
|
74
74
|
--password-age PASSWORD_AGE
|
|
@@ -343,6 +343,44 @@ class ADWSConnect:
|
|
|
343
343
|
detail_node = detail_node_s if detail_node_s is not None else detail_node_soapenv
|
|
344
344
|
detail_text = ElementTree.tostring(detail_node, encoding='unicode').strip() if detail_node is not None else "No detail"
|
|
345
345
|
|
|
346
|
+
# Check for AD referral errors (Win32ErrorCode 8235)
|
|
347
|
+
win32_error_code = None
|
|
348
|
+
referral_url = None
|
|
349
|
+
if detail_node is not None:
|
|
350
|
+
# Try to find Win32ErrorCode in the detail
|
|
351
|
+
ad_ns = "http://schemas.microsoft.com/2008/1/ActiveDirectory"
|
|
352
|
+
win32_code_elem = detail_node.find(f".//{{{ad_ns}}}Win32ErrorCode")
|
|
353
|
+
if win32_code_elem is not None and win32_code_elem.text:
|
|
354
|
+
try:
|
|
355
|
+
win32_error_code = int(win32_code_elem.text)
|
|
356
|
+
except ValueError:
|
|
357
|
+
pass
|
|
358
|
+
|
|
359
|
+
# Try to extract referral URL
|
|
360
|
+
referral_elem = detail_node.find(f".//{{{ad_ns}}}Referral")
|
|
361
|
+
if referral_elem is not None and referral_elem.text:
|
|
362
|
+
referral_url = referral_elem.text
|
|
363
|
+
|
|
364
|
+
# ERROR_DS_REFERRAL = 8235 - This happens in child domains when querying
|
|
365
|
+
# forest-level objects like Enterprise Admins or Schema Admins
|
|
366
|
+
if win32_error_code == 8235:
|
|
367
|
+
if referral_url:
|
|
368
|
+
logging.warning(f"AD Referral encountered: {referral_url}")
|
|
369
|
+
logging.debug(f"Skipping referral and continuing enumeration...")
|
|
370
|
+
else:
|
|
371
|
+
logging.warning(f"AD Referral encountered (Win32ErrorCode: 8235)")
|
|
372
|
+
# Return an empty response to continue enumeration instead of aborting
|
|
373
|
+
# Construct a minimal valid response structure
|
|
374
|
+
s_ns = NAMESPACES['s']
|
|
375
|
+
wsen_ns = NAMESPACES['wsen']
|
|
376
|
+
root = ElementTree.Element(f"{{{s_ns}}}Envelope")
|
|
377
|
+
body = ElementTree.SubElement(root, f"{{{s_ns}}}Body")
|
|
378
|
+
pull_response = ElementTree.SubElement(body, f"{{{wsen_ns}}}PullResponse")
|
|
379
|
+
items = ElementTree.SubElement(pull_response, f"{{{wsen_ns}}}Items")
|
|
380
|
+
# Add EndOfSequence to signal no more results for this referral
|
|
381
|
+
ElementTree.SubElement(pull_response, f"{{{wsen_ns}}}EndOfSequence")
|
|
382
|
+
return root
|
|
383
|
+
|
|
346
384
|
logging.error(f"SOAP Fault received: {reason}\nDetail: {detail_text}")
|
|
347
385
|
return None
|
|
348
386
|
|
|
@@ -69,7 +69,7 @@ except ImportError:
|
|
|
69
69
|
print("[*] openpyxl not available - Excel export disabled")
|
|
70
70
|
|
|
71
71
|
# Constants
|
|
72
|
-
VERSION = "v0.3.
|
|
72
|
+
VERSION = "v0.3.11" # Automatically updated by CI/CD pipeline during release
|
|
73
73
|
BANNER = f"""
|
|
74
74
|
╔═══════════════════════════════════════════════════════════════════
|
|
75
75
|
║ PyADRecon-ADWS {VERSION} - Python AD Reconnaissance Tool (ADWS)
|
|
@@ -294,8 +294,14 @@ def dn_to_fqdn(dn: str) -> str:
|
|
|
294
294
|
|
|
295
295
|
|
|
296
296
|
def sid_to_str(sid_bytes: bytes) -> str:
|
|
297
|
-
"""Convert binary SID to string format.
|
|
297
|
+
"""Convert binary SID to string format.
|
|
298
|
+
Handles both raw bytes and base64-encoded strings."""
|
|
298
299
|
try:
|
|
300
|
+
# Handle base64-encoded strings
|
|
301
|
+
if isinstance(sid_bytes, str):
|
|
302
|
+
import base64
|
|
303
|
+
sid_bytes = base64.b64decode(sid_bytes)
|
|
304
|
+
|
|
299
305
|
if IMPACKET_AVAILABLE:
|
|
300
306
|
return ldaptypes.LDAP_SID(sid_bytes).formatCanonical()
|
|
301
307
|
# Fallback manual parsing
|
|
@@ -703,7 +709,7 @@ class ADReconConfig:
|
|
|
703
709
|
password: str = ""
|
|
704
710
|
auth_method: str = "NTLM" # NTLM only for ADWS
|
|
705
711
|
port: int = 9389 # ADWS default port
|
|
706
|
-
page_size: int =
|
|
712
|
+
page_size: int = 256
|
|
707
713
|
dormant_days: int = 90
|
|
708
714
|
password_age_days: int = 180
|
|
709
715
|
only_enabled: bool = False
|
|
@@ -758,6 +764,7 @@ class PyADRecon:
|
|
|
758
764
|
self.results: Dict[str, List] = {}
|
|
759
765
|
self.start_time: datetime = datetime.now()
|
|
760
766
|
self._sid_cache: Dict[str, str] = {} # Cache for SID-to-name resolution
|
|
767
|
+
self.domain_sid_to_name: Dict[str, str] = {} # Mapping of domain SIDs to domain names from trusts
|
|
761
768
|
|
|
762
769
|
def connect(self) -> bool:
|
|
763
770
|
"""Establish ADWS connection."""
|
|
@@ -941,8 +948,9 @@ class PyADRecon:
|
|
|
941
948
|
current_domain = self.domain_sid if hasattr(self, 'domain_sid') and self.domain_sid else None
|
|
942
949
|
|
|
943
950
|
if current_domain and sid_domain != current_domain:
|
|
944
|
-
# Cross-domain SID -
|
|
945
|
-
|
|
951
|
+
# Cross-domain SID - try to resolve the domain name
|
|
952
|
+
domain_name = self.domain_sid_to_name.get(sid_domain, "Foreign Domain")
|
|
953
|
+
result = f"[{domain_name}] {well_known_rids[rid]}"
|
|
946
954
|
else:
|
|
947
955
|
result = well_known_rids[rid]
|
|
948
956
|
|
|
@@ -1008,6 +1016,21 @@ class PyADRecon:
|
|
|
1008
1016
|
except Exception as e:
|
|
1009
1017
|
logger.debug(f"Could not resolve SID {sid} in forest root: {e}")
|
|
1010
1018
|
|
|
1019
|
+
# Before returning just the SID, check if it belongs to a known domain
|
|
1020
|
+
if sid.startswith('S-1-5-21-'):
|
|
1021
|
+
parts = sid.split('-')
|
|
1022
|
+
if len(parts) >= 8:
|
|
1023
|
+
# Extract domain SID (everything except the RID)
|
|
1024
|
+
sid_domain = '-'.join(parts[:7])
|
|
1025
|
+
# Check if this domain is in our mapping
|
|
1026
|
+
domain_name = self.domain_sid_to_name.get(sid_domain)
|
|
1027
|
+
if domain_name:
|
|
1028
|
+
# Extract the RID for display
|
|
1029
|
+
rid = parts[-1]
|
|
1030
|
+
result = f"[{domain_name} SID] {sid} (RID: {rid})"
|
|
1031
|
+
self._sid_cache[sid] = result
|
|
1032
|
+
return result
|
|
1033
|
+
|
|
1011
1034
|
# Return SID if resolution failed
|
|
1012
1035
|
result = f"[SID] {sid}"
|
|
1013
1036
|
self._sid_cache[sid] = result
|
|
@@ -1409,13 +1432,16 @@ class PyADRecon:
|
|
|
1409
1432
|
return (enrollment_principals, auto_enrollment_principals, owner_principal)
|
|
1410
1433
|
|
|
1411
1434
|
# Parse each ACE in the DACL
|
|
1435
|
+
logger.debug(f"Parsing {len(sd['Dacl'].aces)} ACEs from security descriptor")
|
|
1412
1436
|
for ace in sd['Dacl'].aces:
|
|
1413
1437
|
try:
|
|
1414
1438
|
# Get SID from ACE
|
|
1415
1439
|
sid = ace['Ace']['Sid'].formatCanonical()
|
|
1440
|
+
logger.debug(f"Processing ACE with SID: {sid}")
|
|
1416
1441
|
|
|
1417
1442
|
# Resolve SID to name
|
|
1418
1443
|
principal_name = self._resolve_sid_to_name(sid)
|
|
1444
|
+
logger.debug(f" Resolved to: {principal_name}")
|
|
1419
1445
|
|
|
1420
1446
|
# Check if this is an ACCESS_ALLOWED_OBJECT_ACE
|
|
1421
1447
|
ace_type = ace['AceType']
|
|
@@ -1478,6 +1504,9 @@ class PyADRecon:
|
|
|
1478
1504
|
logger.debug(f"Error parsing security descriptor: {e}")
|
|
1479
1505
|
import traceback
|
|
1480
1506
|
logger.debug(traceback.format_exc())
|
|
1507
|
+
|
|
1508
|
+
logger.debug(f"Found {len(enrollment_principals)} enrollment principals: {enrollment_principals}")
|
|
1509
|
+
logger.debug(f"Found {len(auto_enrollment_principals)} auto-enrollment principals: {auto_enrollment_principals}")
|
|
1481
1510
|
|
|
1482
1511
|
return (enrollment_principals, auto_enrollment_principals, owner_principal)
|
|
1483
1512
|
|
|
@@ -1557,8 +1586,12 @@ class PyADRecon:
|
|
|
1557
1586
|
# Get domain SID
|
|
1558
1587
|
sid_bytes = get_attr(entry, 'objectSid')
|
|
1559
1588
|
self.domain_sid = sid_to_str(sid_bytes)
|
|
1589
|
+
|
|
1590
|
+
# Map current domain SID to its name for cross-domain resolution
|
|
1591
|
+
domain_name = dn_to_fqdn(self.base_dn)
|
|
1592
|
+
self.domain_sid_to_name[self.domain_sid] = domain_name
|
|
1560
1593
|
|
|
1561
|
-
results.append({"Category": "Name", "Value":
|
|
1594
|
+
results.append({"Category": "Name", "Value": domain_name})
|
|
1562
1595
|
results.append({"Category": "NetBIOS", "Value": get_attr(entry, 'name', '')})
|
|
1563
1596
|
results.append({"Category": "Functional Level", "Value": f"{func_level}Domain"})
|
|
1564
1597
|
results.append({"Category": "DomainSID", "Value": self.domain_sid})
|
|
@@ -3347,11 +3380,25 @@ class PyADRecon:
|
|
|
3347
3380
|
search_base=self.base_dn,
|
|
3348
3381
|
search_filter='(objectCategory=trustedDomain)',
|
|
3349
3382
|
attributes=['distinguishedName', 'trustPartner', 'trustDirection', 'trustType',
|
|
3350
|
-
'trustAttributes', 'whenCreated', 'whenChanged']
|
|
3383
|
+
'trustAttributes', 'whenCreated', 'whenChanged', 'securityIdentifier']
|
|
3351
3384
|
)
|
|
3352
3385
|
|
|
3353
3386
|
for entry in entries:
|
|
3354
3387
|
|
|
3388
|
+
# Get the trusted domain's SID and build mapping
|
|
3389
|
+
trusted_domain_sid_bytes = get_attr(entry, 'securityIdentifier')
|
|
3390
|
+
trusted_domain_name = get_attr(entry, 'trustPartner', '')
|
|
3391
|
+
|
|
3392
|
+
if trusted_domain_sid_bytes and trusted_domain_name:
|
|
3393
|
+
try:
|
|
3394
|
+
# Convert SID to string format (handles both bytes and base64 strings)
|
|
3395
|
+
trusted_domain_sid = sid_to_str(trusted_domain_sid_bytes)
|
|
3396
|
+
# Store mapping for SID resolution
|
|
3397
|
+
self.domain_sid_to_name[trusted_domain_sid] = trusted_domain_name
|
|
3398
|
+
logger.debug(f"Mapped trusted domain SID {trusted_domain_sid} to {trusted_domain_name}")
|
|
3399
|
+
except Exception as e:
|
|
3400
|
+
logger.debug(f"Failed to map trusted domain SID: {e}")
|
|
3401
|
+
|
|
3355
3402
|
trust_dir = get_attr(entry, 'trustDirection', 0)
|
|
3356
3403
|
trust_type = get_attr(entry, 'trustType', 0)
|
|
3357
3404
|
trust_attrs = get_attr(entry, 'trustAttributes', 0)
|
|
@@ -4196,6 +4243,13 @@ class PyADRecon:
|
|
|
4196
4243
|
def collect_certificate_templates(self) -> List[Dict]:
|
|
4197
4244
|
"""Collect AD Certificate Services certificate templates."""
|
|
4198
4245
|
logger.info("[-] Collecting ADCS Certificate Templates...")
|
|
4246
|
+
|
|
4247
|
+
# Warn if querying from child domain - ACLs may be incomplete
|
|
4248
|
+
if hasattr(self, 'forest_root_dn') and self.forest_root_dn != self.base_dn:
|
|
4249
|
+
logger.warning("[!] Connected to child domain - certificate template ACLs may be incomplete!")
|
|
4250
|
+
logger.warning(" For complete ACL data, connect to forest root DC instead.")
|
|
4251
|
+
logger.warning(f" Forest root: {dn_to_fqdn(self.forest_root_dn)}")
|
|
4252
|
+
|
|
4199
4253
|
results = []
|
|
4200
4254
|
|
|
4201
4255
|
try:
|
|
@@ -6815,8 +6869,8 @@ Examples:
|
|
|
6815
6869
|
help='Only collect enabled users/computers')
|
|
6816
6870
|
|
|
6817
6871
|
# Threshold options
|
|
6818
|
-
parser.add_argument('--page-size', type=int, default=
|
|
6819
|
-
help='ADWS query page size (default:
|
|
6872
|
+
parser.add_argument('--page-size', type=int, default=256,
|
|
6873
|
+
help='ADWS query page size (default: 256)')
|
|
6820
6874
|
parser.add_argument('--dormant-days', type=int, default=90,
|
|
6821
6875
|
help='Users/Computers with lastLogon older than X days are dormant (default: 90)')
|
|
6822
6876
|
parser.add_argument('--password-age', type=int, default=180,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# PyADRecon-ADWS on Windows
|
|
2
2
|
|
|
3
|
-
A guide for running **PyADRecon-ADWS** on Windows systems using either
|
|
3
|
+
A guide for running **PyADRecon-ADWS** on Windows systems using either an executable or Python.
|
|
4
4
|
|
|
5
5
|
>[!CAUTION]
|
|
6
|
-
>PyADRecon-ADWS.py as well as
|
|
6
|
+
>PyADRecon-ADWS.py as well as a standalone executable may be flagged by AV/EDR software.
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -45,7 +45,7 @@ The following ports must be accessible on the Domain Controller:
|
|
|
45
45
|
|
|
46
46
|
## Quick Start
|
|
47
47
|
|
|
48
|
-
### Using the
|
|
48
|
+
### Using the executable
|
|
49
49
|
|
|
50
50
|
#### NTLM Authentication
|
|
51
51
|
```powershell
|
|
@@ -97,14 +97,6 @@ klist
|
|
|
97
97
|
|
|
98
98
|
## Installation Methods
|
|
99
99
|
|
|
100
|
-
### Using Pre-built Executable
|
|
101
|
-
|
|
102
|
-
No installation required. Simply download and run `pyadrecon_adws.exe`.
|
|
103
|
-
|
|
104
|
-
See [Quick Start](#quick-start) for usage examples.
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
100
|
### Running with Python
|
|
109
101
|
|
|
110
102
|
For development, testing, or custom builds.
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|