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


Python PacketsExample.set_expected方法代码示例

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


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

示例1: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'www.nic.cl', 'qtype': 1}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'www.uchile.cl', 'qtype': 1}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'www.123456.cl', 'qtype': 2}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'www.123.cl', 'qtype': 1}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'dcc.uchile.cl', 'qtype': 1}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'www.niclabs.cl', 'qtype': 2}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'a.cl', 'qtype': 3}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'b.cl', 'qtype': 3}]})

        data.set_expected(1, {10: 2, 13: 2})
        data.set_expected(2, {13: 1, 14: 1})
        data.set_expected(3, {4: 2})

        data.put_information('QtypeVSQnamelen', [1, 2, 3])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:28,代码来源:test_qtype_vs_qnamelen.py

示例2: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()
        for i in range(30):
            data.add_packet({'flags': '0', 'source': '12345678', 'queries': [
                            {'qname': 'www.nic.cl.', 'qtype': 1}]})

        for i in range(12):
            data.add_packet({'flags': '0', 'source': '87654321', 'queries': [
                            {'qname': 'www.niclabs.cl.', 'qtype': 2}]})
            data.add_packet({'flags': '0', 'source': '8765432100', 'queries': [
                            {'qname': 'www.niclabs.cl.', 'qtype': 2}]})

        for i in range(25):
            data.add_packet({'flags': '0', 'source': '12348765', 'queries': [
                            {'qname': 'www.uchile.cl.', 'qtype': 3}]})
            data.add_packet({'flags': '0', 'source': '1234876500', 'queries': [
                            {'qname': 'www.uchile.cl.', 'qtype': 3}]})
            data.add_packet({'flags': '0', 'source': '12345678', 'queries': [
                            {'qname': 'www.uchile.cl.', 'qtype': 3}]})

        data.set_expected('IPv4', {1: 30, 2: 12, 3: 50})
        data.set_expected('IPv6', {2: 12, 3: 25})

        data.put_information('DnsIpVersionVSQtype', ['IPv4', 'IPv6'])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:28,代码来源:test_dns_ip_version_vs_qtype.py

示例3: data_repeat_error

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_repeat_error(self):
        data = PacketsExample()
        data.put_information('problematicQNames', {
            'www.ni_c.cl', 'www.nic_labs.cl'})

        expected_list = []
        for i in range(3):
            data.add_packet({'dest': 'encrypted(dnsip1)',
                             'source': 'encrypted(ip1)',
                             'flags': '0',
                             'queries': [
                                 {'qname': 'www.ni_c.cl', 'qtype': '1'}]})
            expected_list.append({'server': 'encrypted(dnsip1)',
                                  'sender': 'encrypted(ip1)',
                                  'query': {
                                      'qname': 'www.ni_c.cl', 'qtype': '1'}})
        data.set_expected('www.ni_c.cl', expected_list)

        expected_list = []
        for i in range(2):
            data.add_packet({'dest': 'encrypted(dnsip2)',
                             'source': 'encrypted(ip2)',
                             'flags': '0',
                             'queries': [
                                 {'qname': 'www.nic_labs.cl', 'qtype': '2'}]})
            expected_list.append({'server': 'encrypted(dnsip2)',
                                  'sender': 'encrypted(ip2)',
                                  'query': {
                                      'qname': 'www.nic_labs.cl',
                                      'qtype': '2'}})
        data.set_expected('www.nic_labs.cl', expected_list)

        return data
开发者ID:jaimesanz,项目名称:ratadns-filters,代码行数:35,代码来源:test_qwhn.py

示例4: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()
        for i in range(50):
            data.add_packet({'flags': '0', 'queries': [
                            {'qname': 'www.nic.cl.', 'qtype': 1}]})
            data.add_packet({'flags': '0', 'queries': [
                            {'qname': 'www.uchile.cl.', 'qtype': 2}]})

        for i in range(50):
            data.add_packet({'flags': '0', 'queries': [
                            {'qname': 'www.google.com.', 'qtype': 1}]})
            data.add_packet({'flags': '0', 'queries': [
                            {'qname': 'www.facebook.com.', 'qtype': 2}]})

        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'www.asdf.net.', 'qtype': 3}]})
        data.add_packet({'flags': '0', 'queries': [
                        {'qname': 'www.qwerty.net.', 'qtype': 3}]})

        data.set_expected(1, {'cl': 50, 'com': 50})
        data.set_expected(2, {'cl': 50, 'com': 50})
        data.set_expected(3, {'net': 2})

        data.put_information('QtypeVSTld', [1, 2, 3])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:28,代码来源:test_qtype_vs_tld.py

示例5: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()
        for i in range(3):
            data.add_packet({"flags": "0", "queries": [{"qname": u"www.nic.xn--cm-5ja."}]})
            data.add_packet({"flags": "0", "queries": [{"qname": u"www.uchile.cl."}]})
            data.add_packet(
                {
                    "flags": "0",
                    "queries": [{"qname": u"data-agkn-com-1198526359." + u"us-east-1.elb.amazonaws.com.imunimacu.cl."}],
                }
            )
            data.add_packet(
                {
                    "flags": "0",
                    "queries": [
                        {"qname": u"data-agkn-com-1198526359.us-east-1" + u".elb.amazonaws.com.xn--imunimacu-t6a.cl."}
                    ],
                }
            )

        data.set_expected(unicode("xn--cm-5ja", "utf8").encode("idna"), 3)
        data.set_expected(unicode("cl", "utf8").encode("idna"), 3)

        data.put_information("IdnVSTld", [unicode("cóm", "utf8").encode("idna"), unicode("cl", "utf8").encode("idna")])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:28,代码来源:test_idn_tld.py

示例6: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()

        for i in range(5):
            data.add_packet({"flags": "8000", "queries": [{"qname": "www.nic.cl"}]})
        data.set_expected("www.nic.cl", 5)

        for i in range(4):
            data.add_packet({"flags": "0", "queries": [{"qname": "www.niclabs.cl"}]})
        data.set_expected("www.niclabs.cl", 4)

        for i in range(3):
            data.add_packet({"flags": "0", "queries": [{"qname": "www.uchile.cl"}]})
        data.set_expected("www.uchile.cl", 3)

        for i in range(3):
            data.add_packet({"flags": "8000", "queries": [{"qname": "www.jerry.cl"}]})
        data.set_expected("www.jerry.cl", 3)

        for i in range(2):
            data.add_packet({"flags": "0", "queries": [{"qname": "www.pinky.cl"}]})
        data.set_expected("www.pinky.cl", 2)

        data.put_information(
            "QNames", {"www.nic.cl", "www.niclabs.cl", "www.uchile.cl", "www.jerry.cl", "www.pinky.cl"}
        )
        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:29,代码来源:test_namecounter.py

示例7: dataExample

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def dataExample(self):
        data = PacketsExample()
        data.add_packet({'flags': '0', 'queries': []})

        data.set_expected('', 1)

        data.put_information('QNames', {''})
        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:10,代码来源:test_issue27.py

示例8: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()

        for i in range(5):
            data.add_packet({'flags': '0', 'queries': [
                {'qname': 'www.nic.cl'}]})

        data.set_expected('512-1023', 5)

        data.put_information("EdnsBufsiz", ['512-1023'])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:14,代码来源:test_ednsbufsiz.py

示例9: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()

        for i in range(5):
            data.add_packet({'flags': '8000', 'queries': [
                {'qname': 'www.nic.cl'}]})

        data.set_expected(0, 5)

        data.put_information("Rcode", [0])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:14,代码来源:test_rcode.py

示例10: data_without_alonePackets

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_without_alonePackets(self):
        data = PacketsExample({'queries': 2, 'answers': 2})

        data.add_packet({'flags': '8000', 'id': '1111'})
        data.add_packet({'flags': '0', 'id': '12cb'})
        data.add_packet({'flags': '8000', 'id': '12cb'})
        data.add_packet({'flags': '0', 'id': '1111'})

        data.set_expected('AloneAnswers', [])
        data.set_expected('AloneQueries', [])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:14,代码来源:test_ap.py

示例11: data_without_answers

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_without_answers(self):
        queries = [{'flags': '0', 'id': 'a6c7'}, {'flags': '0', 'id': '5433'},
                   {'flags': '0', 'id': 'a276'}, {'flags': '0', 'id': '4321'}]
        data = PacketsExample({'queries': len(queries), 'answers': 0})

        for query in queries:
            data.add_packet(query)

        data.set_expected('AloneAnswers', [])
        data.set_expected('AloneQueries', queries)

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:14,代码来源:test_ap.py

示例12: data_without_queries

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_without_queries(self):
        answers = [{'flags': '8000', 'id': 'a6c7'}, {
            'flags': '8000', 'id': '5433'}, {'flags': '8000', 'id': 'a276'}]
        data = PacketsExample({'queries': 0, 'answers': len(answers)})

        for answer in answers:
            data.add_packet(answer)

        data.set_expected('AloneAnswers', answers)
        data.set_expected('AloneQueries', [])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:14,代码来源:test_ap.py

示例13: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample()
        for i in range(30):
            data.add_packet({"flags": "8000", "source": "12345678", "queries": [{"qname": "www.nic.cl."}]})

        for i in range(25):
            data.add_packet({"flags": "8000", "source": "1234567890", "queries": [{"qname": "www.uchile.cl."}]})

        data.set_expected("udp", {"IPv4": 30, "IPv6": 25})

        data.put_information("TrafficVolumeResponses", ["udp"])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:15,代码来源:test_traffic_volume_responses.py

示例14: data_example

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_example(self):
        data = PacketsExample({'queries': 2, 'answers': 2})
        answer_without_query = {'flags': '8000', 'id': '1111'}
        query_without_answer = {'flags': '0', 'id': '3333'}

        data.add_packet(answer_without_query)  # Answer without query
        data.add_packet({'flags': '0', 'id': '12cb'})
        data.add_packet({'flags': '8000', 'id': '12cb'})
        data.add_packet(query_without_answer)  # Query without answer

        data.set_expected('AloneAnswers', [answer_without_query])
        data.set_expected('AloneQueries', [query_without_answer])

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:16,代码来源:test_ap.py

示例15: data_different_case

# 需要导入模块: from packetsexample import PacketsExample [as 别名]
# 或者: from packetsexample.PacketsExample import set_expected [as 别名]
    def data_different_case(self):
        data = PacketsExample()
        data.put_information("problematicQName", "www.ni_c.cl")

        expected_list = []

        data.add_packet(
            {
                "dest": "encrypted(dnsip1)",
                "source": "encrypted(ip1)",
                "flags": "0",
                "queries": [{"qname": "www.ni_c.cl", "qtype": "1"}],
            }
        )
        expected_list.append(
            {"server": "encrypted(dnsip1)", "sender": "encrypted(ip1)", "query": {"qname": "www.ni_c.cl", "qtype": "1"}}
        )

        data.add_packet(
            {
                "dest": "encrypted(dnsip1)",
                "source": "encrypted(ip1)",
                "flags": "0",
                "queries": [{"qname": "WWW.NI_C.CL", "qtype": "1"}],
            }
        )
        expected_list.append(
            {"server": "encrypted(dnsip1)", "sender": "encrypted(ip1)", "query": {"qname": "WWW.NI_C.CL", "qtype": "1"}}
        )

        data.set_expected("www.ni_c.cl", expected_list)

        data.add_packet(
            {
                "dest": "encrypted(dnsip1)",
                "source": "encrypted(ip1)",
                "flags": "0",
                "queries": [{"qname": "wwww.ni_c.cl", "qtype": "1"}],
            }
        )
        data.add_packet(
            {
                "dest": "encrypted(dnsip1)",
                "source": "encrypted(ip1)",
                "flags": "0",
                "queries": [{"qname": "WWW:NI_C.CL", "qtype": "1"}],
            }
        )

        return data
开发者ID:niclabs,项目名称:ratadns-filters,代码行数:52,代码来源:test_qwhn.py


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