当前位置: 首页>>代码示例>>Python>>正文


Python Target._print方法代码示例

本文整理汇总了Python中target.Target._print方法的典型用法代码示例。如果您正苦于以下问题:Python Target._print方法的具体用法?Python Target._print怎么用?Python Target._print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在target.Target的用法示例。


在下文中一共展示了Target._print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start

# 需要导入模块: from target import Target [as 别名]
# 或者: from target.Target import _print [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
开发者ID:SergioLazaro,项目名称:apkdissector,代码行数:55,代码来源:threadAnalyzer.py


注:本文中的target.Target._print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。