• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tflow.tserver_conn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mitmproxy.test.tflow.tserver_conn函数的典型用法代码示例。如果您正苦于以下问题:Python tserver_conn函数的具体用法?Python tserver_conn怎么用?Python tserver_conn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_roundtrip_server_via

 def test_roundtrip_server_via(self):
     s = tflow.tserver_conn()
     s.via = tflow.tserver_conn()
     del s.reply
     s.wfile = None
     s.rfile = None
     ps = protobuf._dump_http_server_conn(s)
     ls = protobuf._load_http_server_conn(ps)
     assert s.__dict__ == ls.__dict__
     del s.via.reply
     s.via.wfile = None
     s.via.rfile = None
     assert s.via.__dict__ == ls.via.__dict__
开发者ID:mitmproxy,项目名称:mitmproxy,代码行数:13,代码来源:test_protobuf.py


示例2: test_or

 def test_or(self):
     f = self.flow()
     f.server_conn = tflow.tserver_conn()
     assert self.q("~b hello | ~b me", f)
     assert self.q("~src :22 | ~b me", f)
     assert not self.q("~src :99 | ~dst :99", f)
     assert self.q("(~src :22 | ~dst :22) | ~b me", f)
开发者ID:s4chin,项目名称:mitmproxy,代码行数:7,代码来源:test_flowfilter.py


示例3: test_storage_flush_with_specials

    async def test_storage_flush_with_specials(self):
        s = self.start_session(fp=0.5)
        f = self.tft()
        s.request(f)
        await asyncio.sleep(1)
        assert len(s._hot_store) == 0
        f.response = http.HTTPResponse.wrap(tutils.tresp())
        s.response(f)
        assert len(s._hot_store) == 1
        assert s.load_storage() == [f]
        await asyncio.sleep(1)
        assert all([lflow.__dict__ == flow.__dict__ for lflow, flow in list(zip(s.load_storage(), [f]))])

        f.server_conn.via = tflow.tserver_conn()
        s.request(f)
        await asyncio.sleep(0.6)
        assert len(s._hot_store) == 0
        assert all([lflow.__dict__ == flow.__dict__ for lflow, flow in list(zip(s.load_storage(), [f]))])

        flows = [self.tft() for _ in range(500)]
        s.update(flows)
        await asyncio.sleep(0.6)
        assert s._flush_period == s._FP_DEFAULT * s._FP_DECREMENT
        await asyncio.sleep(3)
        assert s._flush_period == s._FP_DEFAULT
开发者ID:mitmproxy,项目名称:mitmproxy,代码行数:25,代码来源:test_session.py


示例4: test_eq

 def test_eq(self):
     c = tflow.tserver_conn()
     c2 = c.copy()
     assert c == c
     assert c != c2
     assert c != 42
     assert hash(c) != hash(c2)
开发者ID:mhils,项目名称:mitmproxy,代码行数:7,代码来源:test_connections.py


示例5: test_and

 def test_and(self):
     f = self.flow()
     f.server_conn = tflow.tserver_conn()
     assert self.q("~b hello & ~b me", f)
     assert not self.q("~src wrongaddress & ~b hello", f)
     assert self.q("(~src :22 & ~dst :22) & ~b hello", f)
     assert not self.q("(~src address:22 & ~dst :22) & ~b nonexistent", f)
     assert not self.q("(~src address:22 & ~dst :99) & ~b hello", f)
开发者ID:s4chin,项目名称:mitmproxy,代码行数:8,代码来源:test_flowfilter.py


示例6: test_dst

 def test_dst(self):
     f = self.flow()
     f.server_conn = tflow.tserver_conn()
     assert self.q("~dst address", f)
     assert not self.q("~dst foobar", f)
     assert self.q("~dst :22", f)
     assert not self.q("~dst :99", f)
     assert self.q("~dst address:22", f)
开发者ID:s4chin,项目名称:mitmproxy,代码行数:8,代码来源:test_flowfilter.py


示例7: test_tls_established_property

 def test_tls_established_property(self):
     c = tflow.tserver_conn()
     c.tls_established = True
     assert c.tls_established
     assert c.tls_established
     c.tls_established = False
     assert not c.tls_established
     assert not c.tls_established
开发者ID:mhils,项目名称:mitmproxy,代码行数:8,代码来源:test_connections.py


示例8: test_repr

 def test_repr(self):
     sc = tflow.tserver_conn()
     assert "address:22" in repr(sc)
     assert "ssl" not in repr(sc)
     sc.ssl_established = True
     assert "ssl" in repr(sc)
     sc.sni = "foo"
     assert "foo" in repr(sc)
开发者ID:MatthewShao,项目名称:mitmproxy,代码行数:8,代码来源:test_proxy.py


示例9: test_dst

 def test_dst(self):
     q = self.req()
     q.server_conn = tflow.tserver_conn()
     assert self.q("~dst address", q)
     assert not self.q("~dst foobar", q)
     assert self.q("~dst :22", q)
     assert not self.q("~dst :99", q)
     assert self.q("~dst address:22", q)
开发者ID:MatthewShao,项目名称:mitmproxy,代码行数:8,代码来源:test_flowfilter.py


示例10: test_send

 def test_send(self):
     c = tflow.tserver_conn()
     c.send(b'foobar')
     c.send([b'foo', b'bar'])
     with pytest.raises(TypeError):
         c.send('string')
     with pytest.raises(TypeError):
         c.send(['string', 'not'])
     assert c.wfile.getvalue() == b'foobarfoobar'
开发者ID:mhils,项目名称:mitmproxy,代码行数:9,代码来源:test_connections.py


示例11: test_roundtrip_server_cert

 def test_roundtrip_server_cert(self, tdata):
     s = tflow.tserver_conn()
     del s.reply
     s.wfile = None
     s.rfile = None
     with open(tdata.path("mitmproxy/net/data/text_cert"), "rb") as f:
         d = f.read()
     s.cert = certs.Cert.from_pem(d)
     ps = protobuf._dump_http_server_conn(s)
     ls = protobuf._load_http_server_conn(ps)
     assert s.__dict__ == ls.__dict__
开发者ID:mitmproxy,项目名称:mitmproxy,代码行数:11,代码来源:test_protobuf.py


示例12: test_filters

    def test_filters(self):
        e = self.err()
        f = self.flow()
        f.server_conn = tflow.tserver_conn()

        assert not self.q("~a", f)

        assert not self.q("~b whatever", f)
        assert not self.q("~bq whatever", f)
        assert not self.q("~bs whatever", f)

        assert not self.q("~c 0", f)

        assert not self.q("~d whatever", f)

        assert self.q("~dst address", f)
        assert not self.q("~dst nonexistent", f)

        assert self.q("~e", e)
        assert not self.q("~e", f)

        assert not self.q("~http", f)
        assert not self.q("~tcp", f)
        assert not self.q("~websocket", f)

        assert not self.q("~h whatever", f)
        assert not self.q("~hq whatever", f)
        assert not self.q("~hs whatever", f)

        assert not self.q("~m whatever", f)

        assert not self.q("~s", f)

        assert self.q("~src address", f)
        assert not self.q("~src nonexistent", f)

        assert not self.q("~tcp", f)

        assert not self.q("~t whatever", f)
        assert not self.q("~tq whatever", f)
        assert not self.q("~ts whatever", f)

        assert not self.q("~u whatever", f)

        assert not self.q("~q", f)
开发者ID:s4chin,项目名称:mitmproxy,代码行数:45,代码来源:test_flowfilter.py


示例13: test_repr

    def test_repr(self):
        c = tflow.tserver_conn()

        c.sni = 'foobar'
        c.tls_established = True
        c.alpn_proto_negotiated = b'h2'
        assert 'address:22' in repr(c)
        assert 'ALPN' in repr(c)
        assert 'TLS: foobar' in repr(c)

        c.sni = None
        c.tls_established = True
        c.alpn_proto_negotiated = None
        assert 'ALPN' not in repr(c)
        assert 'TLS' in repr(c)

        c.sni = None
        c.tls_established = False
        assert 'TLS' not in repr(c)
开发者ID:s4chin,项目名称:mitmproxy,代码行数:19,代码来源:test_connections.py


示例14: test_state

 def test_state(self):
     c = tflow.tserver_conn()
     c2 = c.copy()
     assert c2.get_state() != c.get_state()
     c.id = c2.id = "foo"
     assert c2.get_state() == c.get_state()
开发者ID:mhils,项目名称:mitmproxy,代码行数:6,代码来源:test_connections.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tutils.raises函数代码示例发布时间:2022-05-27
下一篇:
Python tflow.tflow函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap