From e8067a247418db62f1d2453bcf3c9a4a266f4588 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 16 Nov 2016 22:06:06 +0100 Subject: [PATCH 1/2] update dependencies --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a9ab342ba..9e4fa9e8d 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ setup( "pyOpenSSL>=16.0, <17.0", "pyparsing>=2.1.3, <2.2", "pyperclip>=1.5.22, <1.6", - "requests>=2.9.1, <2.12", + "requests>=2.9.1, <3", "tornado>=4.3, <4.5", "urwid>=1.3.1, <1.4", "watchdog>=0.8.3, <0.9", @@ -92,7 +92,7 @@ setup( ':sys_platform != "win32"': [ ], 'dev': [ - "flake8>=2.6.2, <3.1", + "flake8>=2.6.2, <3.3", "mypy-lang>=0.4.5, <0.5", "rstcheck>=2.2, <3.0", "tox>=2.3, <3", From 5ce370e2a9eef7d81d5bafb5d1fa0e2cb1397c83 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 16 Nov 2016 22:39:15 +0100 Subject: [PATCH 2/2] lint! --- mitmproxy/flowfilter.py | 4 ++-- mitmproxy/http.py | 1 + mitmproxy/net/http/cookies.py | 1 + mitmproxy/net/socks.py | 1 + mitmproxy/net/tcp.py | 1 + mitmproxy/tools/console/common.py | 1 + mitmproxy/tools/console/flowlist.py | 2 ++ mitmproxy/tools/console/flowview.py | 3 +++ mitmproxy/tools/console/options.py | 2 ++ mitmproxy/tools/console/palettepicker.py | 2 ++ mitmproxy/tools/console/signals.py | 1 + test/mitmproxy/tools/benchtool.py | 1 + test/mitmproxy/tools/passive_close.py | 1 + 13 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mitmproxy/flowfilter.py b/mitmproxy/flowfilter.py index ee5224c6a..3a44efd13 100644 --- a/mitmproxy/flowfilter.py +++ b/mitmproxy/flowfilter.py @@ -482,9 +482,9 @@ def _make(): ]) expr = pp.OneOrMore(expr) return expr.setParseAction(lambda x: FAnd(x) if len(x) != 1 else x) + + bnf = _make() - - TFilter = Callable[[flow.Flow], bool] diff --git a/mitmproxy/http.py b/mitmproxy/http.py index dafd47820..9c59984ab 100644 --- a/mitmproxy/http.py +++ b/mitmproxy/http.py @@ -251,6 +251,7 @@ def make_connect_response(http_version): b"", ) + expect_continue_response = HTTPResponse( b"HTTP/1.1", 100, b"Continue", http.Headers(), b"" ) diff --git a/mitmproxy/net/http/cookies.py b/mitmproxy/net/http/cookies.py index 2f99568b5..01d42d465 100644 --- a/mitmproxy/net/http/cookies.py +++ b/mitmproxy/net/http/cookies.py @@ -42,6 +42,7 @@ class CookieAttrs(multidict.MultiDict): # if we take the last part. return values[-1] + SetCookie = collections.namedtuple("SetCookie", ["value", "attrs"]) diff --git a/mitmproxy/net/socks.py b/mitmproxy/net/socks.py index 115949f5d..a972283e0 100644 --- a/mitmproxy/net/socks.py +++ b/mitmproxy/net/socks.py @@ -12,6 +12,7 @@ class SocksError(Exception): super().__init__(message) self.code = code + VERSION = bidi.BiDi( SOCKS4=0x04, SOCKS5=0x05 diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py index ac368a9c3..3437452fd 100644 --- a/mitmproxy/net/tcp.py +++ b/mitmproxy/net/tcp.py @@ -106,6 +106,7 @@ class SSLKeyLogger: return SSLKeyLogger(filename) return False + log_ssl_key = SSLKeyLogger.create_logfun( os.getenv("MITMPROXY_SSLKEYLOGFILE") or os.getenv("SSLKEYLOGFILE")) diff --git a/mitmproxy/tools/console/common.py b/mitmproxy/tools/console/common.py index cfc69bfcc..a8e7f59fd 100644 --- a/mitmproxy/tools/console/common.py +++ b/mitmproxy/tools/console/common.py @@ -119,6 +119,7 @@ def fcol(s, attr): ) ) + if urwid.util.detected_encoding: SYMBOL_REPLAY = u"\u21ba" SYMBOL_RETURN = u"\u2190" diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py index c70ebba41..395a9d52b 100644 --- a/mitmproxy/tools/console/flowlist.py +++ b/mitmproxy/tools/console/flowlist.py @@ -41,6 +41,8 @@ def _mkhelp(): ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text + + help_context = _mkhelp() footer = [ diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py index a66a0cea3..e2b24fab9 100644 --- a/mitmproxy/tools/console/flowview.py +++ b/mitmproxy/tools/console/flowview.py @@ -90,6 +90,8 @@ def _mkhelp(): ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text + + help_context = _mkhelp() footer = [ @@ -120,6 +122,7 @@ class FlowViewHeader(urwid.WidgetWrap): hostheader=self.master.options.showhost ) + TAB_REQ = 0 TAB_RESP = 1 diff --git a/mitmproxy/tools/console/options.py b/mitmproxy/tools/console/options.py index a1b6bd3cf..824041dc0 100644 --- a/mitmproxy/tools/console/options.py +++ b/mitmproxy/tools/console/options.py @@ -21,6 +21,8 @@ def _mkhelp(): ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text + + help_context = _mkhelp() diff --git a/mitmproxy/tools/console/palettepicker.py b/mitmproxy/tools/console/palettepicker.py index 4554a1b64..a3eb9b90d 100644 --- a/mitmproxy/tools/console/palettepicker.py +++ b/mitmproxy/tools/console/palettepicker.py @@ -17,6 +17,8 @@ def _mkhelp(): ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text + + help_context = _mkhelp() diff --git a/mitmproxy/tools/console/signals.py b/mitmproxy/tools/console/signals.py index 3cd8bc4b0..cb71c5c12 100644 --- a/mitmproxy/tools/console/signals.py +++ b/mitmproxy/tools/console/signals.py @@ -11,6 +11,7 @@ def add_log(e, level): level=level ) + # Show a status message in the action bar status_message = blinker.Signal() diff --git a/test/mitmproxy/tools/benchtool.py b/test/mitmproxy/tools/benchtool.py index 9e2ab8eea..b9078d0e4 100644 --- a/test/mitmproxy/tools/benchtool.py +++ b/test/mitmproxy/tools/benchtool.py @@ -51,5 +51,6 @@ def main(profiler, clock_type, concurrency): stats.save(outfile, type='callgrind') print("Done.") + if __name__ == '__main__': main() diff --git a/test/mitmproxy/tools/passive_close.py b/test/mitmproxy/tools/passive_close.py index 71b1022f4..6f97ea4fb 100644 --- a/test/mitmproxy/tools/passive_close.py +++ b/test/mitmproxy/tools/passive_close.py @@ -19,5 +19,6 @@ class service(socketserver.BaseRequestHandler): class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): pass + server = ThreadedTCPServer(('', 1520), service) server.serve_forever()