From 81ee86b9bb1f712770c0847976c0f3f628c244ba Mon Sep 17 00:00:00 2001 From: zblurx Date: Mon, 11 Dec 2023 11:51:28 +0100 Subject: [PATCH] fixes and better handling of version --- donpapi/entry.py | 9 ++++++--- donpapi/lib/certificates.py | 9 ++++++--- donpapi/reporting.py | 3 +-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/donpapi/entry.py b/donpapi/entry.py index 7f35122..64b145c 100644 --- a/donpapi/entry.py +++ b/donpapi/entry.py @@ -17,6 +17,7 @@ # @Byt3bl3d33r for CME (lots of inspiration and code comes from CME : https://github.com/byt3bl33d3r/CrackMapExec ) # All the Team of @LoginSecurite for their help in debugging my shity code (special thanks to @layno & @HackAndDo for that) +import importlib.metadata import argparse import json import logging @@ -33,10 +34,12 @@ from donpapi.lib.toolbox import split_targets global assets assets={} -BANNER = """ +VERSION = importlib.metadata.version("donpapi") + +BANNER = f""" - , - , V1.2.0 - Refresh Token Edition \U0001F480 + , version: {VERSION} + , Refresh Token Edition \U0001F480 ( . by Touf & Zblurx @ Login Sécurité &&&&&& diff --git a/donpapi/lib/certificates.py b/donpapi/lib/certificates.py index acba829..debbcf4 100644 --- a/donpapi/lib/certificates.py +++ b/donpapi/lib/certificates.py @@ -1,4 +1,5 @@ import hashlib +import logging import ntpath,copy import os from typing import Any, Dict, List, Literal, Tuple @@ -410,9 +411,11 @@ class CertificatesTriage(): pkey = self.decrypt_privatekey(key=masterkey['key'], privatekey_bytes=data) pkeys[hashlib.md5(pkey.public_key().export_key('DER')).hexdigest()] = (pkey_guid,pkey) except Exception as e: - import traceback - traceback.print_exc() - self.logging.debug(str(e)) + if self.logging.getLogger().level == logging.DEBUG: + import traceback + traceback.print_exc() + self.logging.debug(str(e)) + pass return pkeys def loot_certificates(self, certificates_paths: List[str]) -> Dict[str, x509.Certificate]: diff --git a/donpapi/reporting.py b/donpapi/reporting.py index ec7b4f6..b843013 100644 --- a/donpapi/reporting.py +++ b/donpapi/reporting.py @@ -432,8 +432,7 @@ class Reporting: data += f"""({len(results)})""" for index, cred in enumerate(results): _, pfx_filepath, guid, issuer, subject, \ - client_auth, pillaged_from_computerid, pillaged_from_userid = cred[7] - + client_auth, pillaged_from_computerid, pillaged_from_userid = cred computer_ip, hostname = list(self.get_computer_infos(pillaged_from_computerid))[0] computer_info = f"{computer_ip} | {hostname}" if pillaged_from_userid is not None: