本文整理汇总了Python中hooker_common.Logger.getLogger方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.getLogger方法的具体用法?Python Logger.getLogger怎么用?Python Logger.getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hooker_common.Logger
的用法示例。
在下文中一共展示了Logger.getLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeConfigurationOnEmulator
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def writeConfigurationOnEmulator(emulator, idXP, reportingConfiguration):
logger = Logger.getLogger(__name__)
configurationContent = """# Hooker Analysis Configuration File
# Network configuration
[elasticsearch]
elasticsearch_mode={0}
elasticsearch_nb_thread={1}
elasticsearch_ip={2}
elasticsearch_port={3}
elasticsearch_index={4}
elasticsearch_doctype={5}
# File configuration
[file]
file_mode={6}
file_name={7}
[analysis]
idXP={8}
""".format(reportingConfiguration.elasticsearchMode,
1,
"10.0.2.2",
reportingConfiguration.elasticsearchPort,
reportingConfiguration.elasticsearchIndex,
reportingConfiguration.elasticsearchDoctype,
reportingConfiguration.fileMode,
"events.logs",
idXP)
logger.debug("Deploy the following configuration on emulator {0}: \n{1}".format(emulator.name, configurationContent))
# Write on the emulator
emulator.writeContentOnSdCard("experiment.conf", configurationContent)
示例2: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, esNodes):
"""Creates and initializes the connection to the specified elasticsearch cluster.
The esNodes attributes refers to a list of nodes we should connect to."""
self._logger = Logger.getLogger(__name__)
self.esNodes = esNodes
self.__initializeConnection()
示例3: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, adbPort, name, mainConfiguration):
self._logger = Logger.getLogger(__name__)
self.name = name
self.mainConfiguration = mainConfiguration
self.adbPort = adbPort
self._hookerDir = "/mnt/sdcard/hooker/"
self.serialNumber = ''
self.state = AndroidDevice.STATE_NOT_PREPARED
示例4: executeCommand
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def executeCommand(commandAndArgs):
logger = Logger.getLogger(__name__)
if isinstance(commandAndArgs, str):
commandAndArgs = shlex.split(commandAndArgs)
logger.debug("Executing command {0}".format(commandAndArgs))
return subprocess.check_output(commandAndArgs, stderr=subprocess.STDOUT)
示例5: createTemporaryFolder
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def createTemporaryFolder():
"""Create a random named temporary folder."""
logger = Logger.getLogger(__name__)
logger.debug("Create temporary directory.")
tmpName = "tmp_"+str(uuid.uuid4())
createDirectory(tmpName)
return tmpName
示例6: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, reporter, idXp, emulator, emulatorNumber, host="127.0.0.1"):
self._logger = Logger.getLogger(__name__)
self.emulatorNumber = emulatorNumber
self.emulator = emulator
self.reporter = reporter
self.idXp = idXp
self.__telnetPort = 5554 + (self.emulatorNumber*2)
self.__emulatorSerialNumber = "emulator-{0}".format(self.__telnetPort)
self.__host = host
示例7: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, emulatorNumber, name, mainConfiguration):
self._logger = Logger.getLogger(__name__)
self.name = name
self.state = AVDEmulator.STATE_NOT_PREPARED
self.mainConfiguration = mainConfiguration
self.emulatorNumber = emulatorNumber
self.emulatorPort = 5554 + (self.emulatorNumber*2)
self.emulatorSerialNumber = "emulator-{0}".format(self.emulatorPort)
self.__emulatorProcess = None
self.__duplicateAVD()
示例8: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, avdName, avdDir, sdkPath):
self._logger = Logger.getLogger(__name__)
self.__avdName = avdName
self.__sdkPath = sdkPath
self.__avdDir = avdDir
self.__adbPath = "{}/platform-tools/adb".format(self.__sdkPath)
self.__emulatorPath = "{}/tools/emulator".format(self.__sdkPath)
self.__android_path = "{}/tools/android".format(self.__sdkPath)
self.__emulatorProcess = None
self.__arch = None
示例9: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, emulatorId, name, mainConfiguration):
self._logger = Logger.getLogger(__name__)
super(AVDEmulator, self).__init__(5554 + (int(emulatorId) * 2), name, mainConfiguration)
self.__emulatorProcess = None
self.emulatorId = emulatorId
self.__duplicateAVD()
self.serialNumber = "emulator-{0}".format(self.adbPort)
if self.mainConfiguration.typeOfDevice!='emulated':
raise Exception("Type of device is not emulated, please check your configuration")
示例10: executeCommand
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def executeCommand(commandAndArgs):
logger = Logger.getLogger(__name__)
if isinstance(commandAndArgs, str):
commandAndArgs = shlex.split(commandAndArgs)
logger.debug("Executing command {0}".format(commandAndArgs))
try:
return subprocess.check_output(commandAndArgs, stderr=subprocess.STDOUT)
except Exception, e:
logger.error("Error occured while executing command : {0}".format(e))
return None
示例11: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, adbPort, name, mainConfiguration, backupDirectory, analysisType):
super(PhysicalDevice, self).__init__(adbPort, name, mainConfiguration)
self.__backupDir = backupDirectory
self._logger = Logger.getLogger(__name__)
# Check if backup directory contains 2 folders named sdcard and partitions
self.__checkBackupDirectories()
self.serialNumber = name
self.analysisType = analysisType
self.checkAPKInstrumenter()
# Put the state directly in started, since there is no FS preparation for real device
self.state = AndroidDevice.STATE_STARTED
示例12: createEmulator
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def createEmulator(emulatorNumber, emulatorName, mainConfiguration):
logger = Logger.getLogger(__name__)
if emulatorNumber is None or int(emulatorNumber)<0:
raise Exception("Cannot create an emulator with an invalid emulator number, must be >0")
if emulatorName is None or len(emulatorName)==0:
raise Exception("Cannot create an emulator if not name is provided.")
logger.debug("Creation of new emulator named '{0}'.".format(emulatorName))
return AVDEmulator(emulatorNumber, emulatorName, mainConfiguration)
示例13: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self):
self._logger = Logger.getLogger(__name__)
self.parser = None
self.manualAnalysisRequested = False
self.automaticAnalysisRequested = False
self.mainOptions = dict()
self.manualOptions = dict()
self.automaticOptions = dict()
self.reportingOptions = dict()
self.usage = "usage: %prog [options]"
self.__parse()
示例14: __init__
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def __init__(self, reporter, idXp, emulator, host="127.0.0.1"):
self._logger = Logger.getLogger(__name__)
self.emulator = emulator
self.emulatorNumber = emulator.emulatorId
self.reporter = reporter
self.idXp = idXp
self.__telnetPort = 5554 + (self.emulatorNumber*2)
self.__host = host
if emulator.mainConfiguration.typeOfDevice=='emulated':
self.__emulatorSerialNumber = "emulator-{0}".format(self.__telnetPort)
else:
self.__emulatorSerialNumber = emulator.name
示例15: createDirectory
# 需要导入模块: from hooker_common import Logger [as 别名]
# 或者: from hooker_common.Logger import getLogger [as 别名]
def createDirectory(directory, force=True):
"""Create the specified directory but fails if the directory already
exists unless force is set to True. In that case, we delete it and re-create it"""
logger = Logger.getLogger(__name__)
logger.debug("Create directory {0} (force={1})".format(directory, force))
if os.path.exists(directory):
if force:
shutil.rmtree(directory)
else:
raise Exception("Specified directoryalready exists, cannot create it.")
else:
os.mkdirs(directory)