From e815915b22ef266ac4122027a10c59d9e036d0b4 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 25 Jul 2015 13:31:55 +0200 Subject: add auto layer, multiple other fixes --- libmproxy/protocol2/auto.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 libmproxy/protocol2/auto.py (limited to 'libmproxy/protocol2/auto.py') diff --git a/libmproxy/protocol2/auto.py b/libmproxy/protocol2/auto.py new file mode 100644 index 00000000..1c4293ac --- /dev/null +++ b/libmproxy/protocol2/auto.py @@ -0,0 +1,16 @@ +from __future__ import (absolute_import, print_function, division, unicode_literals) +from .layer import Layer + + +class AutoLayer(Layer): + def __call__(self): + d = self.client_conn.rfile.peek(1) + if d[0] == "\x16": + layer = SslLayer(self, True, True) + else: + layer = TcpLayer(self) + for m in layer(): + yield m + +from .rawtcp import TcpLayer +from .ssl import SslLayer -- cgit v1.2.3