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


Python Database.keys方法代码示例

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


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

示例1: __iterate_data

# 需要导入模块: from golismero.api.data.db import Database [as 别名]
# 或者: from golismero.api.data.db.Database import keys [as 别名]
 def __iterate_data(self, identities = None, data_type = None, data_subtype = None):
     if identities is None:
         identities = list(Database.keys(data_type))
     if identities:
         for page in xrange(0, len(identities), 100):
             for data in Database.get_many(identities[page:page + 100], data_type):
                 yield data
开发者ID:elcodigok,项目名称:golismero,代码行数:9,代码来源:rst.py

示例2: do_audit_results

# 需要导入模块: from golismero.api.data.db import Database [as 别名]
# 或者: from golismero.api.data.db.Database import keys [as 别名]
    def do_audit_results(self, audit_name, data_type = "all"): # TODO: control audits with error at start
        """
        Implementation of: /audit/results

        :param audit_name: Name of the audit to query.
        :type audit_name: str

        :param data_type: Data type to request. Case insensitive.
            Must be one of the following values:
             - "all": All data types.
             - "information": Information type.
             - "resource": Resource type.
             - "vulnerability": Vulnerability type.
        :type data_type: str

        :returns: Result IDs.
        :rtype: list(str)

        :raises KeyError: Data type unknown.
        """
        if self.is_audit_running(audit_name):
            with SwitchToAudit(audit_name):
                i_data_type = {
                    "all": None,
                    "information": Data.TYPE_INFORMATION,
                    "resource": Data.TYPE_RESOURCE,
                    "vulnerability": Data.TYPE_VULNERABILITY,
                    }[data_type.strip().lower()]
                return sorted( Database.keys(i_data_type) )
        else:
            # XXX TODO open the database manually here
            raise NotImplementedError(
                "Querying finished audits is not implemented yet!")
开发者ID:qiuyuanchunwei,项目名称:golismero,代码行数:35,代码来源:server_plugin.py

示例3: test_import

# 需要导入模块: from golismero.api.data.db import Database [as 别名]
# 或者: from golismero.api.data.db.Database import keys [as 别名]
def test_import():
    print "Testing OpenVAS importer..."
    orchestrator_config = OrchestratorConfig()
    orchestrator_config.ui_mode = "disabled"
    audit_config = AuditConfig()
    audit_config.targets  = ["192.168.56.101"]
    audit_config.audit_db = ":memory:"
    with PluginTester(orchestrator_config, audit_config) as t:
        t.run_plugin("import/xml_openvas", path.join(here, "test_openvas.xml"))
        results = Database.get_many( Database.keys(Data.TYPE_VULNERABILITY) )
        assert len(results) == 1, len(results)
        v = results[0]
        assert v.level == "informational", v.level
        assert v.plugin_id == "import/xml_openvas", v.plugin_id
        assert "Remote web server does not reply with 404 error code." in v.description, v.description
开发者ID:IFGHou,项目名称:golismero,代码行数:17,代码来源:test_openvas.py

示例4: common_get_resources

# 需要导入模块: from golismero.api.data.db import Database [as 别名]
# 或者: from golismero.api.data.db.Database import keys [as 别名]
    def common_get_resources(self, data_type=None, data_subtype=None):
        """
        Get a list of datas.

        :return: List of resources.
        :rtype: list(Resource)
        """
        # Get each resource
        m_resource = None
        m_len_urls = Database.count(data_type, data_type)
        if m_len_urls < 200:   # increase as you see fit...
            # fast but memory consuming method
            m_resource   = Database.get_many( Database.keys(data_type=data_type, data_subtype=data_subtype))
        else:
            # slow but lean method
            m_resource   = Database.iterate(data_type=data_type, data_subtype=data_subtype)

        return m_resource
开发者ID:jekkay,项目名称:golismero,代码行数:20,代码来源:html.py

示例5: __iterate

# 需要导入模块: from golismero.api.data.db import Database [as 别名]
# 或者: from golismero.api.data.db.Database import keys [as 别名]
 def __iterate(self, data_type = None, data_subtype = None):
     if Database.count(data_type, data_type) < 100:
         return Database.get_many(
             Database.keys(data_type=data_type, data_subtype=data_subtype)
         )
     return Database.iterate(data_type=data_type, data_subtype=data_subtype)
开发者ID:jekkay,项目名称:golismero,代码行数:8,代码来源:text.py

示例6: list

# 需要导入模块: from golismero.api.data.db import Database [as 别名]
# 或者: from golismero.api.data.db.Database import keys [as 别名]
             - "resource": Resource type.
             - "vulnerability": Vulnerability type.
        :type data_type: str

        :returns: Result IDs.
        :rtype: list(str)

        :raises KeyError: Data type unknown.
        """
        i_data_type = {
                      "all": None,
              "information": Data.TYPE_INFORMATION,
                 "resource": Data.TYPE_RESOURCE,
            "vulnerability": Data.TYPE_VULNERABILITY,
        }[data_type.strip().lower()]
        return sorted( Database.keys(i_data_type) )


    #--------------------------------------------------------------------------
    def do_scan_details(self, id_list):
        """
        Implementation of: /scan/details

        :param id_list: List of result IDs.
        :type id_list: list(str)
        """
        return Database.get_many(id_list)


    #--------------------------------------------------------------------------
    def do_plugin_list(self):
开发者ID:atimorin,项目名称:golismero,代码行数:33,代码来源:web_ui_plugin.py


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