def __linuxCheckLibsodium(self): logger.info("Checking libsodium.") if (checkPlatform() == "MacOS"): logger.warn( "MacOS does not support detection of libsodium, please ensure that libsodium is installed." ) return True try: process = subprocess.Popen("ldconfig -p | grep libsodium", shell=True, stdout=subprocess.PIPE) try: out = process.communicate(timeout=15)[0] except subprocess.TimeoutExpired: process.terminate() out, errs = process.communicate() logger.exception(out.decode("utf-8") + errs.decode("utf-8")) return False logger.debug("ldconfig : {}".format(out)) if ("libsodium" not in out.decode("utf-8")): return False return True except: logger.exception("") return False
def check(self): pfInfo = checkPlatform() if (pfInfo == "Windows"): self.__checks(self.__winRequire) elif (pfInfo == "Linux" or pfInfo == "MacOS"): self.__linuxCheck() else: logger.critical("Unsupport platform !") sys.exit(1)
def __init__(self): self.testMethod = "SOCKET" self.proxyType = "SSR" self.webMode = False self.colors = "origin" self.sortMethod = "" self.testMode = "TCP_PING" self.subscriptionUrl = "" self.configFile = "" self.__client = None self.__parser = None self.__stc = None self.__platformInfo = checkPlatform() self.__results = [] self.__status = "stopped"
loggerList.append(logger) formatter = logging.Formatter( "[%(asctime)s][%(levelname)s][%(thread)d][%(filename)s:%(lineno)d]%(message)s" ) fileHandler = logging.FileHandler( "./logs/" + time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()) + ".log", encoding="utf-8") fileHandler.setFormatter(formatter) consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(formatter) VERSION = config["VERSION"] if (__name__ == "__main__"): pfInfo = checkPlatform() if (pfInfo == "Unknown"): logger.critical( "Your system does not supported.Please contact developer.") sys.exit(1) DEBUG = False CONFIG_LOAD_MODE = 0 #0 for import result,1 for guiconfig,2 for subscription url CONFIG_FILENAME = "" CONFIG_URL = "" IMPORT_FILENAME = "" FILTER_KEYWORD = [] FILTER_GROUP_KRYWORD = [] FILTER_REMARK_KEYWORD = [] EXCLUDE_KEYWORD = [] EXCLUDE_GROUP_KEYWORD = []
def _checkPlatform(self): return checkPlatform()