mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
cleanup imports
This commit is contained in:
parent
299c7fa34c
commit
c2bb29f669
@ -9,7 +9,6 @@ def maybe_timestamp(base, attr):
|
|||||||
return utils.format_timestamp_with_milli(getattr(base, attr))
|
return utils.format_timestamp_with_milli(getattr(base, attr))
|
||||||
else:
|
else:
|
||||||
return "active"
|
return "active"
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def flowdetails(state, flow):
|
def flowdetails(state, flow):
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urwid
|
import urwid
|
||||||
|
|
||||||
from netlib import http
|
|
||||||
import netlib.utils
|
import netlib.utils
|
||||||
|
|
||||||
from . import common, signals
|
from . import common, signals
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import urwid
|
import urwid
|
||||||
import signals
|
|
||||||
|
|
||||||
|
|
||||||
class Tab(urwid.WidgetWrap):
|
class Tab(urwid.WidgetWrap):
|
||||||
|
@ -15,7 +15,6 @@ BLACKLIST = ['jsbeautifier.unpackers.evalbased']
|
|||||||
class UnpackingError(Exception):
|
class UnpackingError(Exception):
|
||||||
"""Badly packed source or general error. Argument is a
|
"""Badly packed source or general error. Argument is a
|
||||||
meaningful description."""
|
meaningful description."""
|
||||||
pass
|
|
||||||
|
|
||||||
def getunpackers():
|
def getunpackers():
|
||||||
"""Scans the unpackers dir, finds unpackers and add them to UNPACKERS list.
|
"""Scans the unpackers dir, finds unpackers and add them to UNPACKERS list.
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
"""Unpacker for Dean Edward's p.a.c.k.e.r"""
|
"""Unpacker for Dean Edward's p.a.c.k.e.r"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import string
|
|
||||||
from . import UnpackingError
|
from . import UnpackingError
|
||||||
|
|
||||||
PRIORITY = 1
|
PRIORITY = 1
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
from __future__ import absolute_import, print_function
|
from __future__ import absolute_import, print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import click
|
import click
|
||||||
@ -10,7 +8,6 @@ from netlib.http import CONTENT_MISSING
|
|||||||
import netlib.utils
|
import netlib.utils
|
||||||
from . import flow, filt, contentviews
|
from . import flow, filt, contentviews
|
||||||
from .exceptions import ContentViewException
|
from .exceptions import ContentViewException
|
||||||
from .models import HTTPRequest
|
|
||||||
|
|
||||||
class DumpError(Exception):
|
class DumpError(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -652,7 +652,6 @@ class FlowMaster(controller.Master):
|
|||||||
"""
|
"""
|
||||||
level: debug, info, error
|
level: debug, info, error
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def unload_scripts(self):
|
def unload_scripts(self):
|
||||||
for s in self.scripts[:]:
|
for s in self.scripts[:]:
|
||||||
|
@ -21,7 +21,7 @@ class Resolver(object):
|
|||||||
peer = csock.getpeername()
|
peer = csock.getpeername()
|
||||||
try:
|
try:
|
||||||
stxt = subprocess.check_output(self.STATECMD, stderr=subprocess.STDOUT)
|
stxt = subprocess.check_output(self.STATECMD, stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError, e:
|
except subprocess.CalledProcessError as e:
|
||||||
if "sudo: a password is required" in e.output:
|
if "sudo: a password is required" in e.output:
|
||||||
insufficient_priv = True
|
insufficient_priv = True
|
||||||
else:
|
else:
|
||||||
|
@ -28,12 +28,14 @@ as late as possible; this makes server replay without any outgoing connections p
|
|||||||
from __future__ import (absolute_import, print_function, division)
|
from __future__ import (absolute_import, print_function, division)
|
||||||
from .base import Layer, ServerConnectionMixin, Kill
|
from .base import Layer, ServerConnectionMixin, Kill
|
||||||
from .http import Http1Layer, UpstreamConnectLayer, Http2Layer
|
from .http import Http1Layer, UpstreamConnectLayer, Http2Layer
|
||||||
from .tls import TlsLayer, is_tls_record_magic, TlsClientHello
|
from .tls import TlsLayer
|
||||||
|
from .tls import is_tls_record_magic
|
||||||
|
from .tls import TlsClientHello
|
||||||
from .rawtcp import RawTCPLayer
|
from .rawtcp import RawTCPLayer
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Layer", "ServerConnectionMixin", "Kill",
|
"Layer", "ServerConnectionMixin", "Kill",
|
||||||
"Http1Layer", "UpstreamConnectLayer", "Http2Layer",
|
"Http1Layer", "UpstreamConnectLayer", "Http2Layer",
|
||||||
"TlsLayer", "is_tls_record_magic", "TlsClientHello"
|
"TlsLayer", "is_tls_record_magic", "TlsClientHello",
|
||||||
"RawTCPLayer"
|
"RawTCPLayer",
|
||||||
]
|
]
|
||||||
|
@ -3,7 +3,6 @@ import sys
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from netlib import tcp
|
|
||||||
from ..models import ServerConnection
|
from ..models import ServerConnection
|
||||||
from ..exceptions import ProtocolException
|
from ..exceptions import ProtocolException
|
||||||
from netlib.exceptions import TcpException
|
from netlib.exceptions import TcpException
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import (absolute_import, print_function, division)
|
from __future__ import (absolute_import, print_function, division)
|
||||||
import socket
|
import socket
|
||||||
import select
|
|
||||||
import six
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ import sys
|
|||||||
|
|
||||||
from construct import ConstructError
|
from construct import ConstructError
|
||||||
import six
|
import six
|
||||||
from netlib.exceptions import InvalidCertificateException, TcpException, TlsException
|
from netlib.exceptions import InvalidCertificateException
|
||||||
|
from netlib.exceptions import TlsException
|
||||||
|
|
||||||
from ..contrib.tls._constructs import ClientHello
|
from ..contrib.tls._constructs import ClientHello
|
||||||
from ..exceptions import ProtocolException, TlsProtocolException, ClientHandshakeException
|
from ..exceptions import ProtocolException, TlsProtocolException, ClientHandshakeException
|
||||||
|
@ -2,7 +2,6 @@ from __future__ import absolute_import, print_function
|
|||||||
import collections
|
import collections
|
||||||
import tornado.ioloop
|
import tornado.ioloop
|
||||||
import tornado.httpserver
|
import tornado.httpserver
|
||||||
import os
|
|
||||||
from .. import controller, flow
|
from .. import controller, flow
|
||||||
from . import app
|
from . import app
|
||||||
|
|
||||||
|
10
setup.cfg
10
setup.cfg
@ -1,11 +1,11 @@
|
|||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 80
|
max-line-length = 120
|
||||||
max-complexity = 15
|
max-complexity = 20
|
||||||
|
|
||||||
[pep8]
|
[pep8]
|
||||||
max-line-length = 80
|
max-line-length = 120
|
||||||
exclude = */contrib/*
|
exclude = */contrib/*
|
||||||
ignore = E251,E309
|
ignore = E251
|
||||||
|
|
||||||
[pytest]
|
[pytest]
|
||||||
testpaths = test
|
testpaths = test
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
import mock
|
|
||||||
import socket
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
from libmproxy import dump
|
|
||||||
from netlib import certutils, tcp
|
|
||||||
from libpathod.pathoc import Pathoc
|
|
||||||
import tutils
|
import tutils
|
||||||
import tservers
|
import tservers
|
||||||
|
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
import mock
|
|
||||||
import gc
|
import gc
|
||||||
from os.path import normpath
|
|
||||||
import mock_urwid
|
|
||||||
|
|
||||||
import netlib.tutils
|
import netlib.tutils
|
||||||
from libmproxy import console
|
from libmproxy import console
|
||||||
@ -89,7 +84,7 @@ class TestConsoleState:
|
|||||||
f = self._add_request(c)
|
f = self._add_request(c)
|
||||||
c.add_flow_setting(f, "foo", "bar")
|
c.add_flow_setting(f, "foo", "bar")
|
||||||
assert c.get_flow_setting(f, "foo") == "bar"
|
assert c.get_flow_setting(f, "foo") == "bar"
|
||||||
assert c.get_flow_setting(f, "oink") == None
|
assert c.get_flow_setting(f, "oink") is None
|
||||||
assert c.get_flow_setting(f, "oink", "foo") == "foo"
|
assert c.get_flow_setting(f, "oink", "foo") == "foo"
|
||||||
assert len(c.flowsettings) == 1
|
assert len(c.flowsettings) == 1
|
||||||
c.delete_flow(f)
|
c.delete_flow(f)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from libmproxy import script, flow
|
|
||||||
import libmproxy.contentviews as cv
|
import libmproxy.contentviews as cv
|
||||||
from netlib.http import Headers
|
from netlib.http import Headers
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import cStringIO
|
import cStringIO
|
||||||
from libmproxy import filt, flow
|
from libmproxy import filt
|
||||||
from libmproxy.protocol import http
|
from libmproxy.protocol import http
|
||||||
from libmproxy.models import Error
|
from libmproxy.models import Error
|
||||||
from netlib.http import Headers
|
from netlib.http import Headers
|
||||||
|
@ -10,7 +10,11 @@ import netlib.utils
|
|||||||
from netlib import odict
|
from netlib import odict
|
||||||
from netlib.http import CONTENT_MISSING, Headers
|
from netlib.http import CONTENT_MISSING, Headers
|
||||||
from libmproxy import filt, controller, tnetstring, flow
|
from libmproxy import filt, controller, tnetstring, flow
|
||||||
from libmproxy.models import Error, Flow, HTTPRequest, HTTPResponse, HTTPFlow, decoded
|
from libmproxy.models import Error
|
||||||
|
from libmproxy.models import Flow
|
||||||
|
from libmproxy.models import HTTPFlow
|
||||||
|
from libmproxy.models import HTTPRequest
|
||||||
|
from libmproxy.models import HTTPResponse
|
||||||
from libmproxy.proxy.config import HostMatcher
|
from libmproxy.proxy.config import HostMatcher
|
||||||
from libmproxy.proxy import ProxyConfig
|
from libmproxy.proxy import ProxyConfig
|
||||||
from libmproxy.proxy.server import DummyServer
|
from libmproxy.proxy.server import DummyServer
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import socket
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from netlib.exceptions import HttpSyntaxException
|
from netlib.exceptions import HttpSyntaxException
|
||||||
from netlib.http import http1
|
from netlib.http import http1
|
||||||
|
@ -10,7 +10,6 @@ from libmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler
|
|||||||
from netlib.exceptions import TcpDisconnect
|
from netlib.exceptions import TcpDisconnect
|
||||||
import tutils
|
import tutils
|
||||||
from libpathod import test
|
from libpathod import test
|
||||||
from netlib import http, tcp
|
|
||||||
from netlib.http import http1
|
from netlib.http import http1
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import SocketServer
|
import SocketServer
|
||||||
from threading import Thread
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import os.path
|
import os.path
|
||||||
import threading
|
import threading
|
||||||
import shutil
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import flask
|
import flask
|
||||||
import mock
|
import mock
|
||||||
@ -11,7 +10,6 @@ import libpathod.test
|
|||||||
import libpathod.pathoc
|
import libpathod.pathoc
|
||||||
from libmproxy import flow, controller
|
from libmproxy import flow, controller
|
||||||
from libmproxy.cmdline import APP_HOST, APP_PORT
|
from libmproxy.cmdline import APP_HOST, APP_PORT
|
||||||
import tutils
|
|
||||||
|
|
||||||
testapp = flask.Flask(__name__)
|
testapp = flask.Flask(__name__)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user