Skip to content

Commit

Permalink
Merge pull request #119 from franc-pentest/improve-adcs
Browse files Browse the repository at this point in the history
Improve adcs
  • Loading branch information
tiyeuse authored Nov 25, 2024
2 parents 9238d16 + c74e58f commit 8d82e99
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.75
1.0.76
46 changes: 30 additions & 16 deletions ldeep/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ def default(o):
print(f"{field}: {value}")
elif "domain" in record["objectClass"]:
print(record["dn"])
elif "pKIEnrollmentService" in record["objectClass"]:
print(record["dNSHostName"])
elif (
"msDS-AuthNPolicy" in record["objectClass"]
or "msDS-AuthNPolicySilo" in record["objectClass"]
Expand Down Expand Up @@ -735,23 +733,39 @@ def list_pkis(self, kwargs):
if verbose:
attributes = self.engine.all_attributes()
else:
attributes = ["dNSHostName", "objectClass"]
attributes = [
"cACertificateDN",
"certificateTemplates",
"dNSHostName",
"name",
]

self.display(
self.engine.query(
self.engine.PKI_FILTER(),
attributes,
base=",".join(
[
"CN=Enrollment Services,CN=Public Key Services,CN=Services",
self.engine.ldap.server.info.other[
"configurationNamingContext"
][0],
]
),
ca_info = self.engine.query(
self.engine.PKI_FILTER(),
attributes,
base=",".join(
[
"CN=Enrollment Services,CN=Public Key Services,CN=Services",
self.engine.ldap.server.info.other["configurationNamingContext"][0],
]
),
verbose,
)
if verbose:
self.display(ca_info, verbose)
return
else:
ca_number = 1
print("Certificate Authorities")
for ca in ca_info:
print(ca_number)
print(f"{'CA Name':<30}: {ca.get('name')}")
print(f"{'DNS Name':<30}: {ca.get('dNSHostName')}")
print(f"{'Certificate Subject':<30}: {ca.get('cACertificateDN')}")
if ca.get("certificateTemplates"):
print(f"{'Associated Templates':<30}")
for template in ca.get("certificateTemplates"):
print(f"{' ' * 32}{template}")
ca_number += 1

def list_templates(self, kwargs):
"""
Expand Down

0 comments on commit 8d82e99

Please sign in to comment.