PyADRecon-ADWS 0.3.6__tar.gz → 0.3.8__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.
Files changed (45) hide show
  1. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/CHANGELOG.md +10 -10
  2. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/PKG-INFO +1 -1
  3. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/PyADRecon_ADWS.egg-info/PKG-INFO +1 -1
  4. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws_wrapper.py +9 -0
  5. pyadrecon_adws-0.3.8/package.json +3 -0
  6. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/pyadrecon_adws.py +127 -14
  7. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/windows/pyadrecon_adws.exe +0 -0
  8. pyadrecon_adws-0.3.6/package.json +0 -3
  9. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.dockerignore +0 -0
  10. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.github/FUNDING.yml +0 -0
  11. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  12. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  13. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.github/pyadrecon.png +0 -0
  14. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.github/workflows/conventional-commits.yml +0 -0
  15. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.github/workflows/pypi.yml +0 -0
  16. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/.gitignore +0 -0
  17. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/Dockerfile +0 -0
  18. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/LICENSE +0 -0
  19. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/PyADRecon_ADWS.egg-info/SOURCES.txt +0 -0
  20. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/PyADRecon_ADWS.egg-info/dependency_links.txt +0 -0
  21. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/PyADRecon_ADWS.egg-info/entry_points.txt +0 -0
  22. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/PyADRecon_ADWS.egg-info/requires.txt +0 -0
  23. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/PyADRecon_ADWS.egg-info/top_level.txt +0 -0
  24. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/README.md +0 -0
  25. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/__init__.py +0 -0
  26. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/__init__.py +0 -0
  27. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/adws.py +0 -0
  28. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/__init__.py +0 -0
  29. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/encoder.py +0 -0
  30. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/__init__.py +0 -0
  31. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/attributes.py +0 -0
  32. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/constants.py +0 -0
  33. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/datatypes.py +0 -0
  34. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/elements.py +0 -0
  35. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/record.py +0 -0
  36. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/text.py +0 -0
  37. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/records/utils.py +0 -0
  38. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/encoder/xml_parser.py +0 -0
  39. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/ms_nmf.py +0 -0
  40. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/ms_nns.py +0 -0
  41. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/helpers/adws/soap_templates.py +0 -0
  42. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/pyproject.toml +0 -0
  43. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/requirements.txt +0 -0
  44. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/setup.cfg +0 -0
  45. {pyadrecon_adws-0.3.6 → pyadrecon_adws-0.3.8}/windows/README.md +0 -0
@@ -1,35 +1,35 @@
1
- ## [0.3.6](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.5...v0.3.6) (2026-02-19)
1
+ ## [0.3.8](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.7...v0.3.8) (2026-02-19)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * adjust ace parsing for adcs and fix esc4 detection ([56b91d1](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/56b91d19b2534553b8d1cf672d6a037db780b9b6))
6
+ * support forest-child enumerations with proper sid resolving ([15aff39](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/15aff39c015a5d017e8c6c9cb7a3dd4763af6d0b))
7
7
 
8
- ## [0.3.5](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.4...v0.3.5) (2026-02-19)
8
+ ## [0.3.7](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.6...v0.3.7) (2026-02-19)
9
9
 
10
10
 
11
11
  ### Bug Fixes
12
12
 
13
- * make --page-size and -v working ([e4bb00d](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/e4bb00d348f82b3685c11c90ab5bfaedf0452e3b))
13
+ * forest support for child domain environments ([1deacd3](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/1deacd355dc4ce58e336a3b72ba758209e24297d))
14
14
 
15
- ## [0.3.4](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.3...v0.3.4) (2026-02-19)
15
+ ## [0.3.6](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.5...v0.3.6) (2026-02-19)
16
16
 
17
17
 
18
18
  ### Bug Fixes
19
19
 
20
- * adcs ca parsing ([bde2e18](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/bde2e18b938e7be809ef4183294e0a025d2e1e26))
20
+ * adjust ace parsing for adcs and fix esc4 detection ([56b91d1](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/56b91d19b2534553b8d1cf672d6a037db780b9b6))
21
21
 
22
- ## [0.3.3](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.2...v0.3.3) (2026-02-19)
22
+ ## [0.3.5](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.4...v0.3.5) (2026-02-19)
23
23
 
24
24
 
25
25
  ### Bug Fixes
26
26
 
27
- * cell coloring; remove requirement for dns lookups and just lookup dumped dns records ([46d3d2a](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/46d3d2afc2b3980df396d5bccc1f5114b9033a61))
27
+ * make --page-size and -v working ([e4bb00d](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/e4bb00d348f82b3685c11c90ab5bfaedf0452e3b))
28
28
 
29
- ## [0.3.2](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.1...v0.3.2) (2026-02-19)
29
+ ## [0.3.4](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.3.3...v0.3.4) (2026-02-19)
30
30
 
31
31
 
32
32
  ### Bug Fixes
33
33
 
34
- * add example commands as epilog ([a49e9c7](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/a49e9c77ca10c9c13630ceab4d4b543df94d414d))
34
+ * adcs ca parsing ([bde2e18](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/bde2e18b938e7be809ef4183294e0a025d2e1e26))
35
35
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyADRecon-ADWS
3
- Version: 0.3.6
3
+ Version: 0.3.8
4
4
  Summary: Python Active Directory Reconnaissance Tool (ADRecon port) using ADWS with NTLM support.
5
5
  Author: LRVT
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyADRecon-ADWS
3
- Version: 0.3.6
3
+ Version: 0.3.8
4
4
  Summary: Python Active Directory Reconnaissance Tool (ADRecon port) using ADWS with NTLM support.
5
5
  Author: LRVT
6
6
  License-Expression: MIT
@@ -216,7 +216,16 @@ class ADWSConnection:
216
216
  rootdse = self._adws_client.get_rootdse_contexts(self.server.host, self._adws_client._nmf)
217
217
  self._root_dn = rootdse.get('defaultNamingContext') or rootdse.get('rootDomainNamingContext')
218
218
  if self._root_dn:
219
+ # Store all naming contexts from RootDSE for proper forest queries
219
220
  self.server.info.other['defaultNamingContext'] = [self._root_dn]
221
+
222
+ # Store other naming contexts if available (critical for child domains)
223
+ if rootdse.get('configurationNamingContext'):
224
+ self.server.info.other['configurationNamingContext'] = [rootdse['configurationNamingContext']]
225
+ if rootdse.get('schemaNamingContext'):
226
+ self.server.info.other['schemaNamingContext'] = [rootdse['schemaNamingContext']]
227
+ if rootdse.get('rootDomainNamingContext'):
228
+ self.server.info.other['rootDomainNamingContext'] = [rootdse['rootDomainNamingContext']]
220
229
 
221
230
  self._bound = True
222
231
  return True
@@ -0,0 +1,3 @@
1
+ {
2
+ "version": "0.3.8"
3
+ }
@@ -69,7 +69,7 @@ except ImportError:
69
69
  print("[*] openpyxl not available - Excel export disabled")
70
70
 
71
71
  # Constants
72
- VERSION = "v0.3.6" # Automatically updated by CI/CD pipeline during release
72
+ VERSION = "v0.3.8" # Automatically updated by CI/CD pipeline during release
73
73
  BANNER = f"""
74
74
  ╔═══════════════════════════════════════════════════════════════════
75
75
  ║ PyADRecon-ADWS {VERSION} - Python AD Reconnaissance Tool (ADWS)
@@ -753,6 +753,7 @@ class PyADRecon:
753
753
  self.base_dn: str = ""
754
754
  self.config_dn: str = ""
755
755
  self.schema_dn: str = ""
756
+ self.forest_root_dn: str = ""
756
757
  self.domain_sid: str = ""
757
758
  self.results: Dict[str, List] = {}
758
759
  self.start_time: datetime = datetime.now()
@@ -806,15 +807,39 @@ class PyADRecon:
806
807
  default_nc = self.conn.server.info.other.get('defaultNamingContext', [])
807
808
  if default_nc:
808
809
  self.base_dn = default_nc[0] if isinstance(default_nc, list) else default_nc
810
+
811
+ # Get Configuration DN from RootDSE (critical for child domains - it's forest-wide)
812
+ config_nc = self.conn.server.info.other.get('configurationNamingContext', [])
813
+ if config_nc:
814
+ self.config_dn = config_nc[0] if isinstance(config_nc, list) else config_nc
815
+
816
+ # Get Schema DN from RootDSE (also forest-wide)
817
+ schema_nc = self.conn.server.info.other.get('schemaNamingContext', [])
818
+ if schema_nc:
819
+ self.schema_dn = schema_nc[0] if isinstance(schema_nc, list) else schema_nc
809
820
 
810
- # Derive other DNs from base DN
821
+ # Fallback: Derive from base DN if not provided by RootDSE
811
822
  if not self.base_dn and self.config.domain:
812
823
  # Construct from domain name
813
824
  parts = self.config.domain.split('.')
814
825
  self.base_dn = ','.join([f'DC={part}' for part in parts])
815
826
 
816
- self.config_dn = f"CN=Configuration,{self.base_dn}"
817
- self.schema_dn = f"CN=Schema,{self.config_dn}"
827
+ # For child domains, derive forest root DN (Configuration/Schema are forest-wide)
828
+ forest_root_dn = self.base_dn
829
+ if self.base_dn:
830
+ dn_parts = [part.strip() for part in self.base_dn.split(',') if part.strip().startswith('DC=')]
831
+ if len(dn_parts) >= 3: # Child domain detected
832
+ forest_root_dn = ','.join(dn_parts[1:])
833
+ logger.info(f"[*] Child domain detected - using forest root DN: {forest_root_dn}")
834
+
835
+ # Store forest root DN for use in forest-wide queries
836
+ self.forest_root_dn = forest_root_dn
837
+
838
+ # Fallback for config/schema if RootDSE didn't provide them
839
+ if not hasattr(self, 'config_dn') or not self.config_dn:
840
+ self.config_dn = f"CN=Configuration,{forest_root_dn}"
841
+ if not hasattr(self, 'schema_dn') or not self.schema_dn:
842
+ self.schema_dn = f"CN=Schema,{self.config_dn}"
818
843
 
819
844
  logger.info(f"[*] Base DN: {self.base_dn}")
820
845
  logger.info(f"[*] Config DN: {self.config_dn}")
@@ -853,7 +878,8 @@ class PyADRecon:
853
878
  return []
854
879
 
855
880
  def _resolve_sid_to_name(self, sid: str) -> str:
856
- """Resolve a SID to a readable name (user/group) with caching."""
881
+ """Resolve a SID to a readable name (user/group) with caching.
882
+ Handles cross-domain SIDs in forest environments."""
857
883
  # Check cache first
858
884
  if sid in self._sid_cache:
859
885
  return self._sid_cache[sid]
@@ -879,7 +905,51 @@ class PyADRecon:
879
905
  self._sid_cache[sid] = result
880
906
  return result
881
907
 
882
- # Try to resolve from domain
908
+ # Well-known RIDs (work with any domain SID)
909
+ well_known_rids = {
910
+ '498': 'Enterprise Read-only Domain Controllers',
911
+ '500': 'Administrator',
912
+ '501': 'Guest',
913
+ '502': 'KRBTGT',
914
+ '512': 'Domain Admins',
915
+ '513': 'Domain Users',
916
+ '514': 'Domain Guests',
917
+ '515': 'Domain Computers',
918
+ '516': 'Domain Controllers',
919
+ '517': 'Cert Publishers',
920
+ '518': 'Schema Admins',
921
+ '519': 'Enterprise Admins',
922
+ '520': 'Group Policy Creator Owners',
923
+ '521': 'Read-only Domain Controllers',
924
+ '522': 'Cloneable Domain Controllers',
925
+ '525': 'Protected Users',
926
+ '526': 'Key Admins',
927
+ '527': 'Enterprise Key Admins',
928
+ '553': 'RAS and IAS Servers',
929
+ '571': 'Allowed RODC Password Replication Group',
930
+ '572': 'Denied RODC Password Replication Group',
931
+ }
932
+
933
+ # Check if this is a domain SID with a well-known RID
934
+ if sid.startswith('S-1-5-21-'):
935
+ parts = sid.split('-')
936
+ if len(parts) >= 8:
937
+ rid = parts[-1]
938
+ if rid in well_known_rids:
939
+ # Check if it's from a different domain
940
+ sid_domain = '-'.join(parts[:7]) # S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx
941
+ current_domain = self.domain_sid if hasattr(self, 'domain_sid') and self.domain_sid else None
942
+
943
+ if current_domain and sid_domain != current_domain:
944
+ # Cross-domain SID - mark it as from another domain
945
+ result = f"[Foreign Domain] {well_known_rids[rid]}"
946
+ else:
947
+ result = well_known_rids[rid]
948
+
949
+ self._sid_cache[sid] = result
950
+ return result
951
+
952
+ # Try to resolve from current domain
883
953
  try:
884
954
  # Search for the object by objectSid
885
955
  entries = self.search(
@@ -907,7 +977,36 @@ class PyADRecon:
907
977
  self._sid_cache[sid] = result
908
978
  return result
909
979
  except Exception as e:
910
- logger.debug(f"Could not resolve SID {sid}: {e}")
980
+ logger.debug(f"Could not resolve SID {sid} in current domain: {e}")
981
+
982
+ # If not found in current domain and we're in a child domain, try forest root
983
+ if hasattr(self, 'forest_root_dn') and self.forest_root_dn != self.base_dn:
984
+ try:
985
+ entries = self.search(
986
+ self.forest_root_dn,
987
+ f"(objectSid={sid})",
988
+ ['sAMAccountName', 'cn', 'distinguishedName', 'objectClass']
989
+ )
990
+
991
+ if entries:
992
+ entry = entries[0]
993
+ sam_name = get_attr(entry, 'sAMAccountName', '')
994
+ cn_name = get_attr(entry, 'cn', '')
995
+ obj_classes = get_attr_list(entry, 'objectClass')
996
+
997
+ if 'computer' in obj_classes:
998
+ result = f"[Computer] {sam_name or cn_name}"
999
+ elif 'group' in obj_classes:
1000
+ result = f"[Group] {sam_name or cn_name}"
1001
+ elif 'user' in obj_classes:
1002
+ result = f"[User] {sam_name or cn_name}"
1003
+ else:
1004
+ result = sam_name or cn_name
1005
+
1006
+ self._sid_cache[sid] = result
1007
+ return result
1008
+ except Exception as e:
1009
+ logger.debug(f"Could not resolve SID {sid} in forest root: {e}")
911
1010
 
912
1011
  # Return SID if resolution failed
913
1012
  result = f"[SID] {sid}"
@@ -1506,7 +1605,8 @@ class PyADRecon:
1506
1605
  attributes=['msDS-Behavior-Version', 'fSMORoleOwner', 'msDS-EnabledFeature', 'distinguishedName']
1507
1606
  )
1508
1607
 
1509
- forest_name = dn_to_fqdn(self.base_dn)
1608
+ # Use forest root DN (not current domain's base_dn) for forest name
1609
+ forest_name = dn_to_fqdn(self.forest_root_dn if hasattr(self, 'forest_root_dn') else self.base_dn)
1510
1610
  forest_fl = 0
1511
1611
 
1512
1612
  if entries:
@@ -1528,11 +1628,18 @@ class PyADRecon:
1528
1628
  if naming_entries:
1529
1629
  naming_owner = get_attr(naming_entries[0], 'fSMORoleOwner', '')
1530
1630
  if naming_owner:
1531
- # Extract DC name from DN
1631
+ # Extract DC FQDN from DN: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Site,... -> DC1.domain.local
1632
+ # The DN contains domain components that tell us the actual domain
1532
1633
  parts = str(naming_owner).split(',')
1533
1634
  if len(parts) > 1:
1534
- dc_name = parts[1].replace('CN=', '')
1535
- results.append({"Category": "Domain Naming Master", "Value": f"{dc_name.lower()}.{forest_name}"})
1635
+ dc_name = parts[1].replace('CN=', '').strip()
1636
+ # Extract domain DN from the rest of the path
1637
+ domain_dn_parts = [p for p in parts if p.strip().upper().startswith('DC=')]
1638
+ if domain_dn_parts:
1639
+ domain_fqdn = dn_to_fqdn(','.join(domain_dn_parts))
1640
+ results.append({"Category": "Domain Naming Master", "Value": f"{dc_name.lower()}.{domain_fqdn}"})
1641
+ else:
1642
+ results.append({"Category": "Domain Naming Master", "Value": f"{dc_name.lower()}.{forest_name}"})
1536
1643
  except:
1537
1644
  pass
1538
1645
 
@@ -1548,8 +1655,14 @@ class PyADRecon:
1548
1655
  if schema_owner:
1549
1656
  parts = str(schema_owner).split(',')
1550
1657
  if len(parts) > 1:
1551
- dc_name = parts[1].replace('CN=', '')
1552
- results.append({"Category": "Schema Master", "Value": f"{dc_name.lower()}.{forest_name}"})
1658
+ dc_name = parts[1].replace('CN=', '').strip()
1659
+ # Extract domain DN from the DN path
1660
+ domain_dn_parts = [p for p in parts if p.strip().upper().startswith('DC=')]
1661
+ if domain_dn_parts:
1662
+ domain_fqdn = dn_to_fqdn(','.join(domain_dn_parts))
1663
+ results.append({"Category": "Schema Master", "Value": f"{dc_name.lower()}.{domain_fqdn}"})
1664
+ else:
1665
+ results.append({"Category": "Schema Master", "Value": f"{dc_name.lower()}.{forest_name}"})
1553
1666
  except:
1554
1667
  pass
1555
1668
 
@@ -3424,7 +3537,7 @@ class PyADRecon:
3424
3537
  search_bases = [
3425
3538
  self.base_dn,
3426
3539
  f"DC=DomainDnsZones,{self.base_dn}",
3427
- f"DC=ForestDnsZones,{self.base_dn}",
3540
+ f"DC=ForestDnsZones,{self.forest_root_dn}",
3428
3541
  ]
3429
3542
 
3430
3543
  for search_base in search_bases:
@@ -1,3 +0,0 @@
1
- {
2
- "version": "0.3.6"
3
- }
File without changes
File without changes
File without changes