def handleThreadResults(self): """ Handle thread results """ self.log.info(os.linesep) self.log.info('Handling thread results...') if not self.endTimeStr: endTime = datetime.datetime.now() self.endTimeStr = '%s %s' % (Utils.getLogDateAsString(endTime), Utils.getLogTimeAsString(endTime)) fileMd5 = self.apkObj.getMd5Hash().upper() # Create report directory apkReportDir = self.__createReportDir(fileMd5) # Store resources #self._storeResources(apkReportDir, fileMd5) # Do clear work self._doClearWork(fileMd5) # Update Database self.log.info("Update database") self.__updateDatabase()
def run(self): """ Run the thread """ fileMd5 = self.apkObj.getMd5Hash().upper() # Log information self.log.info('Start thread to analyzing...') self.log.info('FileMD5: %s' % fileMd5) # build database session self.log.info('Create SqlAlchemy Session...') '''dataModel = DataModel(self.configParser.getDbUsr(), self.configParser.getDbPswd(), self.configParser.getDbHost(), self.configParser.getDbPort(), self.configParser.getDbName() ) try: Session = dataModel.createSession(False) self.session = Session() except Exception,e: self.log.exce("Create SqlAlchemy session error %s" % e) return ''' # Run try: startTime = datetime.datetime.now() self.startTimeStr = '%s %s' % (Utils.getLogDateAsString(startTime), Utils.getLogTimeAsString(startTime)) self.logcatFile = self.__getLogcatFilePath() # Static Analysis self.checkForCancelation() self.log.info(os.linesep) self.log.info('==Static Analysis...') self.staticAnalyze() # Dynamic Analysis self.checkForCancelation() #self.log.info(os.linesep) #self.log.info('==Dynamic Analysis...') #self.dynamicAnalyze() # Shutdown Emulator #self.log.info('Shutdown emulator %s' % self.avdName) #self.emulator.shutDown() # Logcat Analysis #self.log.info(os.linesep) #self.log.info('== Analyze Logcat file...') #self.logcatAnalyze(self.logcatFile ) # End endTime = datetime.datetime.now() self.endTimeStr = '%s %s' % (Utils.getLogDateAsString(endTime), Utils.getLogTimeAsString(endTime)) except Exception: exc = traceback.format_exc() self.log.exce(exc)