本文整理汇总了Python中target.Target.restore_session方法的典型用法代码示例。如果您正苦于以下问题:Python Target.restore_session方法的具体用法?Python Target.restore_session怎么用?Python Target.restore_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类target.Target
的用法示例。
在下文中一共展示了Target.restore_session方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from target import Target [as 别名]
# 或者: from target.Target import restore_session [as 别名]
def start(self):
#Call to Analyze APK
#Creating directory for the current apk
apkname = os.path.basename(os.path.splitext(self.apkpath)[0])
dir = self.config.outputdir + str(apkname) + "/"
#Creating directory if not exists
if not os.path.exists(dir):
#print "Creating directory " + str(dir) + " for APK " + str(apkname) + "..."
os.makedirs(dir)
os.chmod(dir,0755)
static_target = str(self.apkpath) #this must be the complete path of apk file
logpath = self.config.outputdir + apkname + '/log.txt'
log = Logger(logpath)
#Opening APK with Androguard
targetapp = Target(static_target,self.config)
if targetapp.status: #If open APK result is OK, we continue...
if targetapp.package_name is not None:
session_name = targetapp.package_name #usare md5, meglio
else:
session_name = "dummyname"
#Check if the current APK has a cache file
if os.path.isfile(dir + "cache"):
log.write("Restoring session for " + apkname)
targetapp.restore_session(dir + "cache")
else:
log.write("Saving session for " + apkname)
targetapp.save_session(dir + "cache")
# Creating database connection
database = hashesDB(self.config.dbpath)
database.connect()
manifestInfo = Manifest(targetapp)
#Changing stdout to apkName.txt file (Normal output and errors)
manifestAnalysis = ManifestAnalyzer(manifestInfo,targetapp);
log.write("analyzing...\n" + targetapp._print())
#manifestInfo.checkPermissions(self.config,apkname,targetapp.package_name,log) <- JSON
manifestInfo.checkPermissionsInDB(self.config, apkname, database) # <- DB
log.write(apkname + " has been analyzed.")
print apkname + " has been analyzed."
print "**********************************************************"
#Check frida option
if self.launch_writer:
frida = Frida(self.apkpath)
log.close()
database.close()
else:
shutil.rmtree(dir) #Deleting folder for apk analysis