def __init__(self, path): self.path = path self.sdk_path = os.getenv("SDK", None) self.dx = system.which("dx") self.javac = system.which("javac") self.__check_build_path_ready()
def make_jks_trust_store(self): """ Prepare a JKS TrustStore, for the CA. """ keytool = system.which('keytool') argv = [keytool, "-import", "-trustcacerts", "-noprompt", "-alias", "mercuryCA", "-file", self.ca_certificate_path(), "-keystore", self.__jks_path('mercury-ca'), "-storetype", "JKS", "-storepass", "mercury"] if keytool != None: if os.spawnve(os.P_WAIT, argv[0], argv, os.environ) == 0: return self.__bks_path('mercury-ca') else: argv[0] = "keytool" print "Could not compile the JKS trust store, because keytool could not be located on your system." print "Run:" print " ".join(argv) return False
def make_bks_trust_store(self): """ Prepare a BouncyCastle TrustStore, for the CA. """ keytool = system.which('keytool') argv = [keytool, "-import", "-trustcacerts", "-noprompt", "-alias", "mercuryCA", "-file", self.ca_certificate_path(), "-keystore", self.__bks_path('mercury-ca'), "-storetype", "BKS", "-storepass", "mercury", "-provider", "org.bouncycastle.jce.provider.BouncyCastleProvider", "-providerpath", os.path.abspath(os.path.join(os.path.dirname(__file__), "bcprov-ext-jdk15on-1.46.jar"))] if keytool != None: if os.spawnve(os.P_WAIT, argv[0], argv, os.environ) == 0: return self.__bks_path('mercury-ca') else: argv[0] = "keytool" print "Could not compile the BKS trust store, because keytool could not be located on your system." print "Run:" print " ".join(argv) return False
def make_bks_key_store(self, cn, p12_path, export_password, store_password, key_password): """ Prepare a BouncyCastle KeyStore from a PKCS12 bundle. """ keytool = system.which('keytool') argv = [keytool, "-importkeystore", "-deststorepass", store_password, "-destkeypass", key_password, "-destkeystore", self.__bks_path(cn), "-deststoretype", "BKS", "-provider", "org.bouncycastle.jce.provider.BouncyCastleProvider", "-providerpath", os.path.abspath(os.path.join(os.path.dirname(__file__), "bcprov-ext-jdk15on-1.46.jar")), "-srckeystore", p12_path, "-srcstoretype", "PKCS12", "-srcstorepass", export_password, "-alias", "mercury"] if keytool != None: if os.spawnve(os.P_WAIT, argv[0], argv, os.environ) == 0: return self.__bks_path(cn) else: argv[0] = "keytool" print "Could not compile the BKS keystore, because keytool could not be located on your system." print "Run:" print " ".join(argv) return False
def make_bks_trust_store(self): """ Prepare a BouncyCastle TrustStore, for the CA. """ keytool = system.which('keytool') argv = [ keytool, "-import", "-trustcacerts", "-alias", "mercuryCA", "-file", self.ca_certificate_path(), "-keystore", self.__bks_path('mercury-ca'), "-storetype", "BKS", "-storepass", "mercury", "-provider", "org.bouncycastle.jce.provider.BouncyCastleProvider", "-providerpath", os.path.abspath( os.path.join(os.path.dirname(__file__), "bcprov-ext-jdk15on-1.46.jar")) ] if keytool != None: if os.spawnve(os.P_WAIT, argv[0], argv, os.environ) == 0: return self.__bks_path('mercury-ca') else: argv[0] = "keytool" print "Could not compile the BKS trust store, because keytool could not be located on your system." print "Run:" print " ".join(argv) return False
def make_bks_key_store(self, cn, p12_path, export_password, store_password, key_password): """ Prepare a BouncyCastle KeyStore from a PKCS12 bundle. """ keytool = system.which('keytool') argv = [ keytool, "-importkeystore", "-deststorepass", store_password, "-destkeypass", key_password, "-destkeystore", self.__bks_path(cn), "-deststoretype", "BKS", "-provider", "org.bouncycastle.jce.provider.BouncyCastleProvider", "-providerpath", os.path.abspath( os.path.join(os.path.dirname(__file__), "bcprov-ext-jdk15on-1.46.jar")), "-srckeystore", p12_path, "-srcstoretype", "PKCS12", "-srcstorepass", export_password, "-alias", "mercury" ] if keytool != None: if os.spawnve(os.P_WAIT, argv[0], argv, os.environ) == 0: return self.__bks_path(cn) else: argv[0] = "keytool" print "Could not compile the BKS keystore, because keytool could not be located on your system." print "Run:" print " ".join(argv) return False
def executable(cls, name): """ Fetch a System executable, as specified in the configuration, or attempt to find it on the PATH """ path = None if cls.get("executables", name) == None: path = system.which(name) else: path = cls.get("executables", name) if path == None or path == "": sys.stderr.write("Could not find %s.\nEnsure that %s is installed and on your PATH. If this error persists please add the path to your .drozer_config.\n" % (name, name)) return path
def executable(cls, name): """ Fetch a System executable, as specified in the configuration, or attempt to find it on the PATH """ path = None if cls.get("executables", name) == None: path = system.which(name) else: path = cls.get("executables", name) if path == None or path == "": sys.stderr.write("Could not find %s. Please ensure that it is installed and on your PATH.\n\nIf this error persists, specify the path in the ~/.andsploit_config file:\n\n [executables]\n %s = %s\n" % (name, name, platform.system() == "Windows" and "C:\\path\\to\\" + name or "/path/to/" + name)) return path
def executable(cls, name): """ Fetch an executable, could be bundled in the lib, specified in the configuration, or attempt to find it on the PATH """ #check the library path = cls.library(name) #is the required exe available on the PATH? if path == None and cls.get("executables", name) == None: path = system.which(name) if path == None: path = cls.get("executables", name) if path == None or path == "": sys.stderr.write("Could not find %s. Please ensure that it is installed and on your PATH.\n\nIf this error persists, specify the path in the ~/.drozer_config file:\n\n [executables]\n %s = %s\n" % (name, name, platform.system() == "Windows" and "C:\\path\\to\\" + name or "/path/to/" + name)) return path
def executable(cls, name): """ Fetch an executable, could be bundled in the lib, specified in the configuration, or attempt to find it on the PATH """ #check the library path = cls.library(name) #is the required exe available on the PATH? if path is None and cls.get("executables", name) is None: path = system.which(name) if path is None: path = cls.get("executables", name) if path is None or path == "": sys.stderr.write("Could not find %s. Please ensure that it is installed and on your PATH.\n\nIf this error persists, specify the path in the ~/.drozer_config file:\n\n [executables]\n %s = %s\n" % (name, name, platform.system() == "Windows" and "C:\\path\\to\\" + name or "/path/to/" + name)) return path