Skip to content

Commit

Permalink
Merge pull request #117 from franc-pentest/Improve-ADCS
Browse files Browse the repository at this point in the history
Improve ADCS parsing
  • Loading branch information
tiyeuse authored Nov 15, 2024
2 parents 20a659c + 3fb7f15 commit 38bc7e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.73
1.0.74
28 changes: 16 additions & 12 deletions ldeep/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,30 +822,34 @@ def list_templates(self, kwargs):
print(f"{'Template Name':<30}: {template.get('name')}")
print(f"{'Display Name':<30}: {template.get('displayName')}")

is_enabled = False
cert_authorities = []
for ca in adcs_infos:
if template.get("name") in adcs_infos[ca]:
is_enabled = True
cert_auth = ca
break
else:
is_enabled = False
cert_authorities.append(ca)

if is_enabled:
print(f"{'Certificate Authority':<30}: {cert_authorities[0]}")
for cert_auth in cert_authorities[1:]:
print(f"{' ' * 32}{cert_auth}")
print(f"{'Enabled':<30}: True")
print(f"{'Certificate Authority':<30}: {ca}")
else:
print(f"{'Enabled':<30}: False")

ekus = []
client_auth = False
for eku in template.get("pKIExtendedKeyUsage"):
if eku in AUTHENTICATING_EKUS.keys():
if "pKIExtendedKeyUsage" in template.keys():
for eku in template.get("pKIExtendedKeyUsage"):
if eku in AUTHENTICATING_EKUS.keys():
client_auth = True
try:
ekus.append(OID_TO_STR_MAP[eku])
except KeyError:
ekus.append(eku)
if template.get("pKIExtendedKeyUsage") == []:
client_auth = True
try:
ekus.append(OID_TO_STR_MAP[eku])
except KeyError:
ekus.append(eku)
if template.get("pKIExtendedKeyUsage") == []:
else:
client_auth = True
print(f"{'Client Authentication':<30}: {client_auth}")

Expand Down

0 comments on commit 38bc7e8

Please sign in to comment.