aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.landscape.yml10
-rw-r--r--libmproxy/console/__init__.py2
-rw-r--r--libmproxy/models/http.py1
-rw-r--r--libmproxy/protocol/http.py1
-rw-r--r--libmproxy/protocol/http1.py3
-rw-r--r--libmproxy/protocol/http2.py9
-rw-r--r--libmproxy/protocol/tls.py2
-rw-r--r--libmproxy/stateobject.py1
-rw-r--r--libmproxy/web/app.py1
-rw-r--r--test/test_console_help.py16
-rw-r--r--test/test_filt.py2
-rw-r--r--test/test_flow.py3
-rw-r--r--test/test_protocol_http1.py3
-rw-r--r--test/test_protocol_http2.py4
14 files changed, 19 insertions, 39 deletions
diff --git a/.landscape.yml b/.landscape.yml
index 9a3b615f..9dfa62b0 100644
--- a/.landscape.yml
+++ b/.landscape.yml
@@ -1,8 +1,12 @@
-max-line-length: 120
+ignore-paths:
+ - docs
+ - examples
+ - libmproxy/contrib
+ - web
+max-line-length: 140
pylint:
options:
dummy-variables-rgx: _$|.+_$|dummy_.+
-
disable:
- missing-docstring
- protected-access
@@ -13,4 +17,4 @@ pylint:
- too-many-public-methods
- too-many-return-statements
- too-many-statements
- - unpacking-non-sequence \ No newline at end of file
+ - unpacking-non-sequence
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py
index ad3f4306..e739ec61 100644
--- a/libmproxy/console/__init__.py
+++ b/libmproxy/console/__init__.py
@@ -707,7 +707,7 @@ class ConsoleMaster(flow.FlowMaster):
self.state.intercept) and not f.request.is_replay:
f.intercept(self)
else:
- #check if flow was intercepted within an inline script by flow.intercept()
+ # check if flow was intercepted within an inline script by flow.intercept()
if f.intercepted:
f.intercept(self)
else:
diff --git a/libmproxy/models/http.py b/libmproxy/models/http.py
index a2a345d7..3c22e4c9 100644
--- a/libmproxy/models/http.py
+++ b/libmproxy/models/http.py
@@ -13,7 +13,6 @@ from .. import version
from .flow import Flow
-
class MessageMixin(object):
def get_decoded_content(self):
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index 4a86f9da..13d7903b 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -242,7 +242,6 @@ class HttpLayer(Layer):
self.send_response(response)
except (NetlibException, H2Error):
self.log(traceback.format_exc(), "debug")
- pass
def change_upstream_proxy_server(self, address):
# Make set_upstream_proxy_server always available,
diff --git a/libmproxy/protocol/http1.py b/libmproxy/protocol/http1.py
index fc2cf07a..a4cd8801 100644
--- a/libmproxy/protocol/http1.py
+++ b/libmproxy/protocol/http1.py
@@ -1,12 +1,9 @@
from __future__ import (absolute_import, print_function, division)
-import six
-from netlib import tcp
from netlib.http import http1
from .http import _HttpTransmissionLayer, HttpLayer
-from .. import utils
from ..models import HTTPRequest, HTTPResponse
diff --git a/libmproxy/protocol/http2.py b/libmproxy/protocol/http2.py
index 04ff8bf6..c121637c 100644
--- a/libmproxy/protocol/http2.py
+++ b/libmproxy/protocol/http2.py
@@ -18,8 +18,6 @@ from .base import Layer
from .http import _HttpTransmissionLayer, HttpLayer
from .. import utils
from ..models import HTTPRequest, HTTPResponse
-from ..exceptions import HttpProtocolException
-from ..exceptions import ProtocolException
class SafeH2Connection(H2Connection):
@@ -131,6 +129,12 @@ class Http2Layer(Layer):
raise NotImplementedError()
def _handle_event(self, event, source_conn, other_conn, is_server):
+ self.log(
+ "HTTP2 Event from {}".format("server" if is_server else "client"),
+ "debug",
+ [repr(event)]
+ )
+
if hasattr(event, 'stream_id'):
if is_server and event.stream_id % 2 == 1:
eid = self.server_to_client_stream_ids[event.stream_id]
@@ -228,7 +232,6 @@ class Http2Layer(Layer):
stream.zombie = time.time()
return
-
frame, _ = hyperframe.frame.Frame.parse_frame_header(raw_frame[:9])
if is_server:
diff --git a/libmproxy/protocol/tls.py b/libmproxy/protocol/tls.py
index 986eb964..378dd7d4 100644
--- a/libmproxy/protocol/tls.py
+++ b/libmproxy/protocol/tls.py
@@ -419,7 +419,7 @@ class TlsLayer(Layer):
try:
self.ctx.connect()
self._establish_tls_with_server()
- except Exception as e:
+ except Exception:
try:
self._establish_tls_with_client()
except:
diff --git a/libmproxy/stateobject.py b/libmproxy/stateobject.py
index 9600ab09..a4a1ffda 100644
--- a/libmproxy/stateobject.py
+++ b/libmproxy/stateobject.py
@@ -3,6 +3,7 @@ from netlib.utils import Serializable
class StateObject(Serializable):
+
"""
An object with serializable state.
diff --git a/libmproxy/web/app.py b/libmproxy/web/app.py
index 5c479181..63b7bf1a 100644
--- a/libmproxy/web/app.py
+++ b/libmproxy/web/app.py
@@ -44,6 +44,7 @@ class APIError(tornado.web.HTTPError):
class BasicAuth(object):
+
def set_auth_headers(self):
self.set_status(401)
self.set_header('WWW-Authenticate', 'Basic realm=MITMWeb')
diff --git a/test/test_console_help.py b/test/test_console_help.py
index 32d94247..f1a71faf 100644
--- a/test/test_console_help.py
+++ b/test/test_console_help.py
@@ -6,21 +6,6 @@ if os.name == "nt":
import libmproxy.console.help as help
-class DummyLoop:
-
- def __init__(self):
- self.widget = None
-
-
-class DummyMaster:
-
- def __init__(self):
- self.loop = DummyLoop()
-
- def make_view(self):
- pass
-
-
class TestHelp:
def test_helptext(self):
@@ -28,7 +13,6 @@ class TestHelp:
assert h.helptext()
def test_keypress(self):
- master = DummyMaster()
h = help.HelpView([1, 2, 3])
assert not h.keypress((0, 0), "q")
assert not h.keypress((0, 0), "?")
diff --git a/test/test_filt.py b/test/test_filt.py
index b1f3a21f..e6873c7d 100644
--- a/test/test_filt.py
+++ b/test/test_filt.py
@@ -209,7 +209,6 @@ class TestMatching:
def test_method(self):
q = self.req()
- s = self.resp()
assert self.q("~m get", q)
assert not self.q("~m post", q)
@@ -218,7 +217,6 @@ class TestMatching:
def test_domain(self):
q = self.req()
- s = self.resp()
assert self.q("~d host", q)
assert not self.q("~d none", q)
diff --git a/test/test_flow.py b/test/test_flow.py
index 51b88fff..b122489f 100644
--- a/test/test_flow.py
+++ b/test/test_flow.py
@@ -350,7 +350,7 @@ class TestFlow(object):
def test_copy(self):
f = tutils.tflow(resp=True)
- a0 = f.get_state()
+ f.get_state()
f2 = f.copy()
a = f.get_state()
b = f2.get_state()
@@ -532,7 +532,6 @@ class TestState:
assert c.flow_count() == 2
assert c.active_flow_count() == 1
- _ = HTTPResponse.wrap(netlib.tutils.tresp())
assert not c.update_flow(None)
assert c.active_flow_count() == 1
diff --git a/test/test_protocol_http1.py b/test/test_protocol_http1.py
index a1485f1b..13e0eabe 100644
--- a/test/test_protocol_http1.py
+++ b/test/test_protocol_http1.py
@@ -1,7 +1,6 @@
-from netlib.exceptions import HttpSyntaxException
from netlib.http import http1
from netlib.tcp import TCPClient
-from netlib.tutils import treq, raises
+from netlib.tutils import treq
from . import tutils, tservers
diff --git a/test/test_protocol_http2.py b/test/test_protocol_http2.py
index 38cfdfc3..c2c736af 100644
--- a/test/test_protocol_http2.py
+++ b/test/test_protocol_http2.py
@@ -5,10 +5,8 @@ import pytest
import traceback
import os
import tempfile
-import sys
from libmproxy.proxy.config import ProxyConfig
-from libmproxy.proxy.server import ProxyServer
from libmproxy.cmdline import APP_HOST, APP_PORT
import logging
@@ -24,9 +22,7 @@ from netlib import tservers as netlib_tservers
from netlib.utils import http2_read_raw_frame
import h2
-from hyperframe.frame import Frame
-from libmproxy import utils
from . import tservers
requires_alpn = pytest.mark.skipif(