def main(): parser = argparse.ArgumentParser(description=\ "An APK Analysis SandBox.") parser.add_argument('-r, --runHeadless', action='store_true',default=False, dest='runHeadless', help='Run emulator without window.') parser.add_argument('-v, --version', action='version', version='SandDroid v0.1beta') #args = parser.parse_args([-p','santoku']) args = parser.parse_args() # SandDroid sandDroid = SandDroid(SandDroidConst.CONFIG_FILE_PATH, theLogger=Logger()) # Set SandDroid sandDroid.runHeadless = args.runHeadless sandDroid.startTime = datetime.datetime.now() # Build logger sandDroid._createLogDir(sandDroid._getLogDir()) logLevel = LogLevel.INFO logger = Logger(theLevel=logLevel, theMode=LogMode.FILE, theLogFile='%s/%s-SandDroid-run.log' % (sandDroid._getLogDir(), Utils.getTimeAsString(sandDroid.startTime)), thePrintAlwaysFlag=True) sandDroid.log = logger sandDroid.run() sandDroid.log.log.close()
def _getLogDir(self): """ Get log directory """ logRootDir = self.configParser.getLogDir() logDir = '%s/%s-%s' % (logRootDir, Utils.getDateAsString(self.startTime), Utils.getTimeAsString(self.startTime)) return logDir
def __getThreadLogFile(self, fileMd5): """ Return log file name for app runner thread """ analyzeDateTime = datetime.datetime.now() analyzeDate = Utils.getDateAsString(analyzeDateTime) analyzeTime = Utils.getTimeAsString(analyzeDateTime) logFileName = '%s-%s-%s.log' % (fileMd5, analyzeDate, analyzeTime) return logFileName