File: //opt/microsoft/mdatp/tools/client_analyzer/python/mde_tools/certinfocollection.py
import logging
import subprocess
from .constants import LOGGER_NAME, WDAVENGINE_PATH
from .utils import log
log = logging.getLogger(LOGGER_NAME)
def certinfocollection(args):
log.info("Cert information collection started")
log.debug("Running chmod on mde_tools/cert_hashes.sh")
subprocess.run(["chmod", "a+x", "mde_tools/cert_hashes.sh"])
log.debug("Running mde_tools/cert_hashes.sh")
with open(args.target_file, 'w') as f:
subprocess.run(["sudo", "mde_tools/cert_hashes.sh", WDAVENGINE_PATH], stdout=f)
log.info(f"Cert information has been logged in file: {args.target_file}")