From 8b751fe0d5d85d85c4b2f7d73752197589ec32d5 Mon Sep 17 00:00:00 2001 From: wil Date: Mon, 25 Nov 2024 23:10:29 +0100 Subject: [PATCH 1/2] Improve CA info --- VERSION | 2 +- ldeep/__main__.py | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index e9acec7..e7468c7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.75 +1.0.76 diff --git a/ldeep/__main__.py b/ldeep/__main__.py index 984eb23..c7e4b08 100755 --- a/ldeep/__main__.py +++ b/ldeep/__main__.py @@ -735,23 +735,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): """ From c74e58ff387ff893d07080fec68edce28d466fdf Mon Sep 17 00:00:00 2001 From: wil Date: Mon, 25 Nov 2024 23:11:53 +0100 Subject: [PATCH 2/2] Improve CA info --- ldeep/__main__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ldeep/__main__.py b/ldeep/__main__.py index c7e4b08..e1a04cf 100755 --- a/ldeep/__main__.py +++ b/ldeep/__main__.py @@ -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"]