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


Python Output.write方法代码示例

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


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

示例1: render_save

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
 def render_save(self, varlist, outputfile=None):
     """Render and save to file"""
     rendered_str = self.render(varlist)
     out = Output(outputfile)
     out.write(rendered_str)
     out.close()
     return outputfile
开发者ID:UdeM-LBIT,项目名称:CoreTracker,代码行数:9,代码来源:template.py

示例2: execute

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
    def execute(self, arguments):
        # print arguments.package_or_uri
        # package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_ACTIVITIES | common.PackageManager.GET_RECEIVERS | common.PackageManager.GET_PROVIDERS | common.PackageManager.GET_SERVICES)
        appname = arguments.package_or_uri
        # application = package.applicationInfo
        # appname = str(application.packageName)
        opHlr = Output(appname)

        node_injection = opHlr.insert("Injection")

        vulnerable = { 'projection': set([]), 'selection': set([]), 'uris': set([]) }
    
        if arguments.package_or_uri != None and arguments.package_or_uri.startswith("content://"):
            self.__test_uri(arguments.package_or_uri, vulnerable)
        else:
            for uri in self.findAllContentUris(arguments.package_or_uri):
                self.__test_uri(uri, vulnerable)

        # remove the collection of vulnerable URIs from the set of all URIs
        vulnerable['uris'] = vulnerable['uris'] - vulnerable['projection'] - vulnerable['selection']
                        
        # print out a report
        self.stdout.write("Not Vulnerable:\n")
        node_Not_Vulnerable = opHlr.insert("Not_Vulnerable", None, node_injection)
        if len(vulnerable['uris']) > 0:
            for uri in vulnerable['uris']:
                self.stdout.write("  %s\n" % uri)
                opHlr.insert("item", uri, node_Not_Vulnerable)
        else:
            self.stdout.write("  No non-vulnerable URIs found.\n")
            opHlr.insert("item", "No non-vulnerable URIs found", node_Not_Vulnerable)

        self.stdout.write("\nInjection in Projection:\n")
        node_Injection_Projection = opHlr.insert("Injection_Projection", None, node_injection)
        if len(vulnerable['projection']) > 0:
            for uri in vulnerable['projection']:
                self.stdout.write("  %s\n" % uri)
                opHlr.insert("item", uri, node_Injection_Projection)
        else:
            self.stdout.write("  No vulnerabilities found.\n")
            opHlr.insert("item", "No vulnerabilities found", node_Injection_Projection)

        self.stdout.write("\nInjection in Selection:\n")
        node_Injection_Selection = opHlr.insert("Injection_Selection", None, node_injection)
        if len(vulnerable['selection']) > 0:
            for uri in vulnerable['selection']:
                self.stdout.write("  %s\n" % uri)
                opHlr.insert("item", uri, node_Injection_Selection)
        else:
            self.stdout.write("  No vulnerabilities found.\n")
            opHlr.insert("item", "No vulnerabilities found", node_Injection_Selection)

        opHlr.write()
开发者ID:foolself,项目名称:bishebeifen,代码行数:55,代码来源:injection.py

示例3: execute

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
 def execute(self, arguments):
     package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_ACTIVITIES | common.PackageManager.GET_RECEIVERS | common.PackageManager.GET_PROVIDERS | common.PackageManager.GET_SERVICES)
     application = package.applicationInfo
     appname = str(application.packageName)
     opHlr = Output(appname)
     node_backup = opHlr.insert("Backup")
     if self.__write_manifest(package.packageName):
         print "ok"
         opHlr.insert("AllowBackup", "False", node_backup)
     else:
         opHlr.insert("AllowBackup", "True", node_backup)
         print "allowBackup"
     opHlr.write()
开发者ID:foolself,项目名称:bishebeifen,代码行数:15,代码来源:backup.py

示例4: execute

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
    def execute(self, arguments):
        filename = "permission"
        opHlr = Output(filename)
        node_per = opHlr.insert("permission")

        con = self.getContext() 
        pm = con.getPackageManager()
        res = con.getResources()

        if (arguments.permission):
            prot = self.__getProtLevel(pm, arguments.permission)
            if (prot != ""):
                self.stdout.write(self.__getDescription(pm, res, arguments.permission) + "\n")
                self.stdout.write(prot + "\n")
            else:
                self.stdout.write("No such permission defined\n")
        else:

            permissionList = []
            
            # Iterate through each package and get unique permissions
            for package in self.packageManager().getPackages(common.PackageManager.GET_PERMISSIONS):
                    if package.requestedPermissions != None:
                        for permission in package.requestedPermissions:
                            if permission not in permissionList:
                                permissionList.append(str(permission))
            
            # Print sorted
            for permission in sorted(permissionList):

                prot = self.__getProtLevel(pm, permission)
                display = False

                if (arguments.protectionlevel):
                    if (arguments.protectionlevel.upper() in prot.upper()):
                        display = True
                else:
                    display = True

                if (display):
                    node_item = opHlr.insert("item")
                    self.stdout.write(permission + "\n")
                    opHlr.insert("Name", permission, node_item)
                    self.stdout.write(self.__getDescription(pm, res, permission) + "\n")
                    opHlr.insert("Desc", self.__getDescription(pm, res, permission), node_item)
                    self.stdout.write(prot + "\n\n")
                    opHlr.insert("Prot", prot, node_item)
        opHlr.write()
开发者ID:foolself,项目名称:bishebeifen,代码行数:50,代码来源:permissions.py

示例5: execute

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
    def execute(self, arguments):
        package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_ACTIVITIES | common.PackageManager.GET_RECEIVERS | common.PackageManager.GET_PROVIDERS | common.PackageManager.GET_SERVICES)
        application = package.applicationInfo
        appname = str(application.packageName)
        opHlr = Output(appname)
        uris = self.findAllContentUris(arguments.package)
        node_FindUri = opHlr.insert("FindUri")
        if len(uris) > 0:
            for uri in uris:
                self.stdout.write("%s\n" % uri[uri.upper().find("CONTENT"):])
                opHlr.insert("item", uri[uri.upper().find("CONTENT"):], node_FindUri)

        else:
            self.stdout.write("No Content URIs found.\n")
            opHlr.insert("item", "No Content URIs found", node_FindUri)
        opHlr.write()
开发者ID:foolself,项目名称:bishebeifen,代码行数:18,代码来源:provider.py

示例6: execute

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
    def execute(self, arguments):

        package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_ACTIVITIES | common.PackageManager.GET_RECEIVERS | common.PackageManager.GET_PROVIDERS | common.PackageManager.GET_SERVICES)
        application = package.applicationInfo
        appname = str(application.packageName)
        opHlr = Output(appname)
        try:
            if arguments.package == None:
                for package in self.packageManager().getPackages(common.PackageManager.GET_ACTIVITIES):
                    self.__get_activities(arguments, package, opHlr)
            else:
                package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_ACTIVITIES)
                self.__get_activities(arguments, package, opHlr)
            opHlr.write()
        except IOError, e:
            self.stdout.write("something wrong with file")
            self.stdout.write(e)
            return 0
开发者ID:foolself,项目名称:bishebeifen,代码行数:20,代码来源:activity.py

示例7: execute

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
    def execute(self, arguments):
        appname = arguments.package_or_uri
        opHlr = Output(appname)

        node_SqlTables = opHlr.insert("SqlTables")

        results = []
        if arguments.package_or_uri != None and arguments.package_or_uri.startswith("content://"):
            results.append(self.__test_uri(arguments.package_or_uri, opHlr, node_SqlTables))
        else:
            for uri in self.findAllContentUris(arguments.package_or_uri):
                results.append(self.__test_uri(uri, opHlr, node_SqlTables))
        
        if results: 
            self.stdout.write('\n'.join(filter(None, results)) + '\n')
        else:
            node_table = opHlr.insert("Table", None, node_SqlTables)
            self.stdout.write("No results found.\n")
            opHlr.insert("item", "No results found.", node_table)
        opHlr.write()
开发者ID:foolself,项目名称:bishebeifen,代码行数:22,代码来源:sql_table_dump.py

示例8: walk

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
 def walk(self):
     self.co.create()
     output = Output(self.kind)
     output.now_dir()
     print '[+] now path: ' + str(output.nowpath())
     output.out_dir()
     output.out_file()
     print '[+] target path: ' + str(self.__path)
     header = "target : " + self.__path + '\n'
     print '[+] please wait ...'
     output.write(header)
     for root, dirs, files in os.walk(self.__path):
         level = root.replace(self.__path, '').count(os.sep)
         indent = ' ' * 4 * (level)
         out = '{0}--=> {1}/'.format(indent, os.path.basename(root)) + '\n'
         output.write(out)
         subindent = ' ' * 4 * (level + 1)
         for f in files:
             #c_path = os.path.basename(root) + '/' + f
             f_name = f
             f_path = os.path.join(root, f)
             if self.checking(f_path) == 2:
                 f_md5 = self.md5(f_path)
                 self.co.into(self.kind, f_name, f_path, f_md5)
             out = '{0}=> {1}'.format(subindent, f) + '\n'
             output.write(out)
     self.co.close()
     output.close()
开发者ID:AnwarMohamed,项目名称:Catcher,代码行数:30,代码来源:extractor.py

示例9: execute

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import write [as 别名]
    def execute(self, arguments):
        package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_ACTIVITIES | common.PackageManager.GET_RECEIVERS | common.PackageManager.GET_PROVIDERS | common.PackageManager.GET_SERVICES)
        application = package.applicationInfo
        appname = str(application.packageName)
        opHlr = Output(appname)
        try:
            if arguments.package != None:
                package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_ACTIVITIES | common.PackageManager.GET_RECEIVERS | common.PackageManager.GET_PROVIDERS | common.PackageManager.GET_SERVICES)
                application = package.applicationInfo

                activities = self.match_filter(package.activities, 'exported', True)
                receivers = self.match_filter(package.receivers, 'exported', True)
                providers = self.match_filter(package.providers, 'exported', True)
                services = self.match_filter(package.services, 'exported', True)
                
                self.stdout.write("Attack Surface:\n")
                self.stdout.write("  %d activities exported\n" % len(activities))
                self.stdout.write("  %d broadcast receivers exported\n" % len(receivers))
                self.stdout.write("  %d content providers exported\n" % len(providers))
                self.stdout.write("  %d services exported\n" % len(services))
                node_Attack_Surface = opHlr.insert("Attack_Surface")
                opHlr.insert("activities_exported", len(activities), node_Attack_Surface)
                opHlr.insert("broadcast_receivers_exported", len(receivers), node_Attack_Surface)
                opHlr.insert("content_providers_exported", len(providers), node_Attack_Surface)
                opHlr.insert("services_exported", len(services), node_Attack_Surface)

                if (application.flags & application.FLAG_DEBUGGABLE) != 0:
                    self.stdout.write("    is debuggable\n")

                if package.sharedUserId != None:
                    self.stdout.write("    Shared UID (%s)\n" % package.sharedUserId)
                opHlr.write()
            else:
                self.stdout.write("No package specified\n")
        except IOError, e:
            self.stdout.write("something wrong with file")
            self.stdout.write(e)
            return 0
开发者ID:foolself,项目名称:bishebeifen,代码行数:40,代码来源:package.py


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