Package modules :: Package auxiliary :: Module installcert
[hide private]
[frames] | no frames]

Source Code for Module modules.auxiliary.installcert

 1  # Copyright (C) 2010-2013 Claudio Guarnieri. 
 2  # Copyright (C) 2014-2016 Cuckoo Foundation. 
 3  # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org 
 4  # See the file 'docs/LICENSE' for copying permission. 
 5   
 6  import logging 
 7  import os.path 
 8  import subprocess 
 9   
10  from lib.common.abstracts import Auxiliary 
11   
12  log = logging.getLogger(__name__) 
13   
14 -class InstallCertificate(Auxiliary):
15 """Install our man in the middle certificate into the Trusted Root 16 Certification Authorities certificate store so we can listen in on https 17 traffic."""
18 - def start(self):
19 if "cert" not in self.options: 20 return 21 22 cert_path = self.options["cert"] 23 24 if not cert_path.endswith(".p12"): 25 log.error("An invalid certificate has been provided - only " 26 "PFX certificates, with file extension .p12, are " 27 "supported.") 28 return 29 30 if not os.path.exists(cert_path): 31 log.error("Certificate file not found: %s. (Keep in mind that " 32 "the certificate must be located in the " 33 "analyzer/windows/ directory).", cert_path) 34 return 35 36 p = subprocess.Popen(["certutil.exe", "-importpfx", cert_path], 37 stdin=subprocess.PIPE, stdout=subprocess.PIPE, 38 stderr=subprocess.PIPE) 39 40 # Send an empty string as certutil expects to see a password for our 41 # certificate on the command-line. Our certificate has no password. 42 p.communicate("") 43 44 log.info("Successfully installed PFX certificate.")
45