diff options
69 files changed, 175 insertions, 177 deletions
diff --git a/.gitattributes b/.gitattributes index 53ec8dff..c0efd4e4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ -mitmproxy/libmproxy/web/static/**/* -diff -mitmproxy/web/src/js/filt/filt.js -diff
\ No newline at end of file +mitmproxy/mitmproxy/web/static/**/* -diff +mitmproxy/web/src/js/filt/filt.js -diff diff --git a/mitmproxy/MANIFEST.in b/mitmproxy/MANIFEST.in index 441fbde8..54b57382 100644 --- a/mitmproxy/MANIFEST.in +++ b/mitmproxy/MANIFEST.in @@ -1,2 +1,2 @@ -graft libmproxy +graft mitmproxy recursive-exclude * *.pyc *.pyo *.swo *.swp *.map
\ No newline at end of file diff --git a/mitmproxy/bin/mitmdump b/mitmproxy/bin/mitmdump index 16087f61..2483be4f 100644 --- a/mitmproxy/bin/mitmdump +++ b/mitmproxy/bin/mitmdump @@ -1,3 +1,3 @@ #!/usr/bin/env python -from libmproxy.main import mitmdump +from mitmproxy.main import mitmdump mitmdump() diff --git a/mitmproxy/bin/mitmproxy b/mitmproxy/bin/mitmproxy index b7c5c94e..a3d7615d 100755 --- a/mitmproxy/bin/mitmproxy +++ b/mitmproxy/bin/mitmproxy @@ -1,3 +1,3 @@ #!/usr/bin/env python -from libmproxy.main import mitmproxy +from mitmproxy.main import mitmproxy mitmproxy() diff --git a/mitmproxy/bin/mitmweb b/mitmproxy/bin/mitmweb index d709811b..14188a33 100755 --- a/mitmproxy/bin/mitmweb +++ b/mitmproxy/bin/mitmweb @@ -1,4 +1,4 @@ #!/usr/bin/env python -from libmproxy.main import mitmweb +from mitmproxy.main import mitmweb mitmweb() diff --git a/mitmproxy/docs/Makefile b/mitmproxy/docs/Makefile index 99264d90..74bcda53 100644 --- a/mitmproxy/docs/Makefile +++ b/mitmproxy/docs/Makefile @@ -192,4 +192,4 @@ pseudoxml: @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." livehtml: - sphinx-autobuild -b html -z '../libmproxy' -z '../../netlib/netlib' -r '___jb_(old|bak)___$$' $(ALLSPHINXOPTS) $(BUILDDIR)/html
\ No newline at end of file + sphinx-autobuild -b html -z '../mitmproxy' -z '../../netlib/netlib' -r '___jb_(old|bak)___$$' $(ALLSPHINXOPTS) $(BUILDDIR)/html
\ No newline at end of file diff --git a/mitmproxy/docs/conf.py b/mitmproxy/docs/conf.py index 3ea38e48..01bcce1b 100644 --- a/mitmproxy/docs/conf.py +++ b/mitmproxy/docs/conf.py @@ -21,7 +21,7 @@ import shlex # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) -import libmproxy.version +import mitmproxy.version # -- General configuration ------------------------------------------------ @@ -69,9 +69,9 @@ author = u'The mitmproxy project' # built documents. # # The short X.Y version. -version = libmproxy.version.VERSION +version = mitmproxy.version.VERSION # The full version, including alpha/beta/rc tags. -release = libmproxy.version.VERSION +release = mitmproxy.version.VERSION # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -109,7 +109,7 @@ exclude_patterns = ['_build'] pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -modindex_common_prefix = ['libmproxy.'] +modindex_common_prefix = ['mitmproxy.'] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False diff --git a/mitmproxy/docs/dev/exceptions.rst b/mitmproxy/docs/dev/exceptions.rst index dab10e74..e890476b 100644 --- a/mitmproxy/docs/dev/exceptions.rst +++ b/mitmproxy/docs/dev/exceptions.rst @@ -3,7 +3,7 @@ Exceptions ========== -.. automodule:: libmproxy.exceptions +.. automodule:: mitmproxy.exceptions :show-inheritance: :members: :undoc-members: diff --git a/mitmproxy/docs/dev/models.rst b/mitmproxy/docs/dev/models.rst index b09c8bae..7a949941 100644 --- a/mitmproxy/docs/dev/models.rst +++ b/mitmproxy/docs/dev/models.rst @@ -54,6 +54,6 @@ Models .. autoclass:: decoded -.. automodule:: libmproxy.models +.. automodule:: mitmproxy.models :show-inheritance: :members: HTTPFlow, Error, ClientConnection, ServerConnection
\ No newline at end of file diff --git a/mitmproxy/docs/dev/protocols.rst b/mitmproxy/docs/dev/protocols.rst index 1f8cca9a..ceb5c2fd 100644 --- a/mitmproxy/docs/dev/protocols.rst +++ b/mitmproxy/docs/dev/protocols.rst @@ -3,7 +3,7 @@ Protocols ========= -.. automodule:: libmproxy.protocol +.. automodule:: mitmproxy.protocol .. autoclass:: Layer :members: diff --git a/mitmproxy/docs/dev/proxy.rst b/mitmproxy/docs/dev/proxy.rst index dbd6fe67..888fb946 100644 --- a/mitmproxy/docs/dev/proxy.rst +++ b/mitmproxy/docs/dev/proxy.rst @@ -3,7 +3,7 @@ Proxy Server ============ -.. automodule:: libmproxy.proxy +.. automodule:: mitmproxy.proxy .. autoclass:: ProxyServer .. autoclass:: DummyServer diff --git a/mitmproxy/docs/dev/testing.rst b/mitmproxy/docs/dev/testing.rst index d7554954..e3b86bf3 100644 --- a/mitmproxy/docs/dev/testing.rst +++ b/mitmproxy/docs/dev/testing.rst @@ -10,7 +10,7 @@ suitable extension to the test suite. Our tests are written for the `py.test`_ or nose_ test frameworks. At the point where you send your pull request, a command like this: ->>> py.test -n 4 --cov libmproxy +>>> py.test -n 4 --cov mitmproxy Should give output something like this: @@ -19,18 +19,18 @@ Should give output something like this: > ---------- coverage: platform darwin, python 2.7.2-final-0 -- > Name Stmts Miss Cover Missing > ---------------------------------------------------- - > libmproxy/__init__ 0 0 100% - > libmproxy/app 4 0 100% - > libmproxy/cmdline 100 0 100% - > libmproxy/controller 69 0 100% - > libmproxy/dump 150 0 100% - > libmproxy/encoding 39 0 100% - > libmproxy/filt 201 0 100% - > libmproxy/flow 891 0 100% - > libmproxy/proxy 427 0 100% - > libmproxy/script 27 0 100% - > libmproxy/utils 133 0 100% - > libmproxy/version 4 0 100% + > mitmproxy/__init__ 0 0 100% + > mitmproxy/app 4 0 100% + > mitmproxy/cmdline 100 0 100% + > mitmproxy/controller 69 0 100% + > mitmproxy/dump 150 0 100% + > mitmproxy/encoding 39 0 100% + > mitmproxy/filt 201 0 100% + > mitmproxy/flow 891 0 100% + > mitmproxy/proxy 427 0 100% + > mitmproxy/script 27 0 100% + > mitmproxy/utils 133 0 100% + > mitmproxy/version 4 0 100% > ---------------------------------------------------- > TOTAL 2045 0 100% > ---------------------------------------------------- diff --git a/mitmproxy/docs/features/filters.rst b/mitmproxy/docs/features/filters.rst index 2adcfb70..509b5d6b 100644 --- a/mitmproxy/docs/features/filters.rst +++ b/mitmproxy/docs/features/filters.rst @@ -8,7 +8,7 @@ Filter expressions consist of the following operators: .. documentedlist:: :header: "Expression" "Description" - :listobject: libmproxy.filt.help + :listobject: mitmproxy.filt.help - Regexes are Python-style - Regexes can be specified as quoted strings diff --git a/mitmproxy/docs/howmitmproxy.rst b/mitmproxy/docs/howmitmproxy.rst index 7dcb4c30..b0b187d3 100644 --- a/mitmproxy/docs/howmitmproxy.rst +++ b/mitmproxy/docs/howmitmproxy.rst @@ -236,4 +236,4 @@ explicit HTTPS connections to establish the CN and SANs, and cope with SNI. .. _Subject Alternative Name: https://en.wikipedia.org/wiki/SubjectAltName .. _iptables: http://www.netfilter.org/ .. _pf: https://en.wikipedia.org/wiki/PF_\(firewall\) -.. _modules: https://github.com/mitmproxy/mitmproxy/tree/master/libmproxy/platform +.. _modules: https://github.com/mitmproxy/mitmproxy/tree/master/mitmproxy/platform diff --git a/mitmproxy/docs/index.rst b/mitmproxy/docs/index.rst index 30fb4027..4bca07d1 100644 --- a/mitmproxy/docs/index.rst +++ b/mitmproxy/docs/index.rst @@ -52,7 +52,7 @@ :caption: Scripting scripting/inlinescripts - scripting/libmproxy + scripting/mitmproxy .. toctree:: diff --git a/mitmproxy/docs/introduction.rst b/mitmproxy/docs/introduction.rst index c8593daf..058f39f9 100644 --- a/mitmproxy/docs/introduction.rst +++ b/mitmproxy/docs/introduction.rst @@ -6,8 +6,6 @@ with a console interface. **mitmdump** is the command-line version of mitmproxy. Think tcpdump for HTTP. -**libmproxy** is the library that mitmproxy and mitmdump are built on. - Documentation, tutorials and distribution packages can be found on the mitmproxy website: `mitmproxy.org <https://mitmproxy.org/>`_ diff --git a/mitmproxy/docs/scripting/inlinescripts.rst b/mitmproxy/docs/scripting/inlinescripts.rst index 27e4abef..89bff2c1 100644 --- a/mitmproxy/docs/scripting/inlinescripts.rst +++ b/mitmproxy/docs/scripting/inlinescripts.rst @@ -16,8 +16,8 @@ client: :language: python The first argument to each event method is an instance of -:py:class:`~libmproxy.script.ScriptContext` that lets the script interact with the global mitmproxy -state. The **response** event also gets an instance of :py:class:`~libmproxy.script.ScriptContext`, +:py:class:`~mitmproxy.script.ScriptContext` that lets the script interact with the global mitmproxy +state. The **response** event also gets an instance of :py:class:`~mitmproxy.script.ScriptContext`, which we can use to manipulate the response itself. We can now run this script using mitmdump or mitmproxy as follows: @@ -37,7 +37,7 @@ Events ------ The ``context`` argument passed to each event method is always a -:py:class:`~libmproxy.script.ScriptContext` instance. It is guaranteed to be the same object +:py:class:`~mitmproxy.script.ScriptContext` instance. It is guaranteed to be the same object for the scripts lifetime and is not shared between multiple inline scripts. You can safely use it to store any form of state you require. @@ -67,7 +67,7 @@ Connection Events :param Layer root_layer: The root layer (see :ref:`protocols` for an explanation what the root layer is), which provides transparent access to all attributes of the - :py:class:`~libmproxy.proxy.RootContext`. For example, ``root_layer.client_conn.address`` + :py:class:`~mitmproxy.proxy.RootContext`. For example, ``root_layer.client_conn.address`` gives the remote address of the connecting client. .. py:function:: clientdisconnect(context, root_layer) @@ -155,32 +155,32 @@ The canonical API documentation is the code, which you can browse here, locally The main classes you will deal with in writing mitmproxy scripts are: -:py:class:`~libmproxy.script.ScriptContext` +:py:class:`~mitmproxy.script.ScriptContext` - A handle for interacting with mitmproxy's Flow Master from within scripts. -:py:class:`~libmproxy.models.ClientConnection` +:py:class:`~mitmproxy.models.ClientConnection` - Describes a client connection. -:py:class:`~libmproxy.models.ServerConnection` +:py:class:`~mitmproxy.models.ServerConnection` - Describes a server connection. -:py:class:`~libmproxy.models.HTTPFlow` +:py:class:`~mitmproxy.models.HTTPFlow` - A collection of objects representing a single HTTP transaction. -:py:class:`~libmproxy.models.HTTPRequest` +:py:class:`~mitmproxy.models.HTTPRequest` - An HTTP request. -:py:class:`~libmproxy.models.HTTPResponse` +:py:class:`~mitmproxy.models.HTTPResponse` - An HTTP response. -:py:class:`~libmproxy.models.Error` +:py:class:`~mitmproxy.models.Error` - A communications error. :py:class:`netlib.http.Headers` - A dictionary-like object for managing HTTP headers. :py:class:`netlib.certutils.SSLCert` - Exposes information SSL certificates. -:py:class:`libmproxy.flow.FlowMaster` - - The "heart" of libmproxy, usually subclassed as :py:class:`libmproxy.dump.DumpMaster` or - :py:class:`libmproxy.console.ConsoleMaster`. +:py:class:`mitmproxy.flow.FlowMaster` + - The "heart" of mitmproxy, usually subclassed as :py:class:`mitmproxy.dump.DumpMaster` or + :py:class:`mitmproxy.console.ConsoleMaster`. Script Context -------------- -.. autoclass:: libmproxy.script.ScriptContext +.. autoclass:: mitmproxy.script.ScriptContext :members: :undoc-members: @@ -189,7 +189,7 @@ Running scripts in parallel We have a single flow primitive, so when a script is blocking, other requests are not processed. While that's usually a very desirable behaviour, blocking scripts can be run threaded by using the -:py:obj:`libmproxy.script.concurrent` decorator. +:py:obj:`mitmproxy.script.concurrent` decorator. **If your script does not block, you should avoid the overhead of the decorator.** .. literalinclude:: ../../examples/nonblocking.py @@ -210,7 +210,7 @@ The arguments are then exposed in the start event: Running scripts on saved flows ------------------------------ -Sometimes, we want to run a script on :py:class:`~libmproxy.models.Flow` objects that are already +Sometimes, we want to run a script on :py:class:`~mitmproxy.models.Flow` objects that are already complete. This happens when you start a script, and then load a saved set of flows from a file (see the "scripted data transformation" example `here <https://mitmproxy.org/doc/mitmdump.html>`_). It also happens when you run a one-shot script on a single flow through the ``|`` (pipe) shortcut diff --git a/mitmproxy/docs/scripting/libmproxy.rst b/mitmproxy/docs/scripting/mitmproxy.rst index 92fa5277..1626eb5a 100644 --- a/mitmproxy/docs/scripting/libmproxy.rst +++ b/mitmproxy/docs/scripting/mitmproxy.rst @@ -1,18 +1,18 @@ -.. _libmproxy: +.. _mitmproxy: -libmproxy +mitmproxy ========= .. note:: - We strongly encourage you to use :ref:`inlinescripts` rather than libmproxy. + We strongly encourage you to use :ref:`inlinescripts` rather than mitmproxy. - Inline Scripts are equally powerful and provide an easier syntax. - Most examples are written as inline scripts. - Multiple inline scripts can be used together. - Inline Scripts can either be executed headless with mitmdump or within the mitmproxy UI. -All of mitmproxy's basic functionality is exposed through the **libmproxy** +All of mitmproxy's basic functionality is exposed through the **mitmproxy** library. The example below shows a simple implementation of the "sticky cookie" functionality included in the interactive mitmproxy program. Traffic is monitored for ``Cookie`` and ``Set-Cookie`` headers, and requests are rewritten diff --git a/mitmproxy/examples/README b/mitmproxy/examples/README index b4dec8e5..cf5c4d7d 100644 --- a/mitmproxy/examples/README +++ b/mitmproxy/examples/README @@ -20,9 +20,9 @@ stub.py Script stub with a method definition for every event. upsidedownternet.py Rewrites traffic to turn images upside down. -# libmproxy examples +# mitmproxy examples flowbasic Basic use of mitmproxy as a library. -stickycookies An example of writing a custom proxy with libmproxy. +stickycookies An example of writing a custom proxy with mitmproxy. # misc diff --git a/mitmproxy/examples/custom_contentviews.py b/mitmproxy/examples/custom_contentviews.py index 17920e51..776ba99d 100644 --- a/mitmproxy/examples/custom_contentviews.py +++ b/mitmproxy/examples/custom_contentviews.py @@ -1,7 +1,7 @@ import string import lxml.html import lxml.etree -from libmproxy import utils, contentviews +from mitmproxy import utils, contentviews class ViewPigLatin(contentviews.View): diff --git a/mitmproxy/examples/filt.py b/mitmproxy/examples/filt.py index d2daf9a2..f99b675c 100644 --- a/mitmproxy/examples/filt.py +++ b/mitmproxy/examples/filt.py @@ -1,7 +1,7 @@ # This scripts demonstrates how to use mitmproxy's filter pattern in inline scripts. # Usage: mitmdump -s "filt.py FILTER" -from libmproxy import filt +from mitmproxy import filt def start(context, argv): diff --git a/mitmproxy/examples/flowbasic b/mitmproxy/examples/flowbasic index 78b9eff7..4a87b86a 100644 --- a/mitmproxy/examples/flowbasic +++ b/mitmproxy/examples/flowbasic @@ -8,8 +8,8 @@ Note that request and response messages are not automatically replied to, so we need to implement handlers to do this. """ -from libmproxy import flow -from libmproxy.proxy import ProxyServer, ProxyConfig +from mitmproxy import flow +from mitmproxy.proxy import ProxyServer, ProxyConfig class MyMaster(flow.FlowMaster): diff --git a/mitmproxy/examples/flowwriter.py b/mitmproxy/examples/flowwriter.py index be2f285e..8fb8cc60 100644 --- a/mitmproxy/examples/flowwriter.py +++ b/mitmproxy/examples/flowwriter.py @@ -1,7 +1,7 @@ import random import sys -from libmproxy.flow import FlowWriter +from mitmproxy.flow import FlowWriter def start(context, argv): diff --git a/mitmproxy/examples/iframe_injector.py b/mitmproxy/examples/iframe_injector.py index 29de9b63..fc38b136 100644 --- a/mitmproxy/examples/iframe_injector.py +++ b/mitmproxy/examples/iframe_injector.py @@ -1,7 +1,7 @@ # Usage: mitmdump -s "iframe_injector.py url" # (this script works best with --anticache) from bs4 import BeautifulSoup -from libmproxy.models import decoded +from mitmproxy.models import decoded def start(context, argv): diff --git a/mitmproxy/examples/modify_response_body.py b/mitmproxy/examples/modify_response_body.py index a35e1525..88f69e15 100644 --- a/mitmproxy/examples/modify_response_body.py +++ b/mitmproxy/examples/modify_response_body.py @@ -1,6 +1,6 @@ # Usage: mitmdump -s "modify_response_body.py mitmproxy bananas" # (this script works best with --anticache) -from libmproxy.models import decoded +from mitmproxy.models import decoded def start(context, argv): diff --git a/mitmproxy/examples/nonblocking.py b/mitmproxy/examples/nonblocking.py index 7bc9c07b..41674b2a 100644 --- a/mitmproxy/examples/nonblocking.py +++ b/mitmproxy/examples/nonblocking.py @@ -1,5 +1,5 @@ import time -from libmproxy.script import concurrent +from mitmproxy.script import concurrent @concurrent # Remove this and see what happens diff --git a/mitmproxy/examples/read_dumpfile b/mitmproxy/examples/read_dumpfile index b329c0e1..56746bb8 100644 --- a/mitmproxy/examples/read_dumpfile +++ b/mitmproxy/examples/read_dumpfile @@ -3,7 +3,7 @@ # Simple script showing how to read a mitmproxy dump file # -from libmproxy import flow +from mitmproxy import flow import pprint import sys diff --git a/mitmproxy/examples/redirect_requests.py b/mitmproxy/examples/redirect_requests.py index a3145083..c0a0ccba 100644 --- a/mitmproxy/examples/redirect_requests.py +++ b/mitmproxy/examples/redirect_requests.py @@ -1,7 +1,7 @@ """ This example shows two ways to redirect flows to other destinations. """ -from libmproxy.models import HTTPResponse +from mitmproxy.models import HTTPResponse from netlib.http import Headers def request(context, flow): diff --git a/mitmproxy/examples/stickycookies b/mitmproxy/examples/stickycookies index 7e84f71c..8f11de8d 100644 --- a/mitmproxy/examples/stickycookies +++ b/mitmproxy/examples/stickycookies @@ -6,8 +6,8 @@ implement functionality similar to the "sticky cookies" option. Heads Up: In the majority of cases, you want to use inline scripts. """ import os -from libmproxy import controller, proxy -from libmproxy.proxy.server import ProxyServer +from mitmproxy import controller, proxy +from mitmproxy.proxy.server import ProxyServer class StickyMaster(controller.Master): diff --git a/mitmproxy/examples/tls_passthrough.py b/mitmproxy/examples/tls_passthrough.py index 0d41b725..8c8fa4eb 100644 --- a/mitmproxy/examples/tls_passthrough.py +++ b/mitmproxy/examples/tls_passthrough.py @@ -26,8 +26,8 @@ import random from enum import Enum -from libmproxy.exceptions import TlsProtocolException -from libmproxy.protocol import TlsLayer, RawTCPLayer +from mitmproxy.exceptions import TlsProtocolException +from mitmproxy.protocol import TlsLayer, RawTCPLayer class InterceptionResult(Enum): diff --git a/mitmproxy/examples/upsidedownternet.py b/mitmproxy/examples/upsidedownternet.py index f2e73047..b7489cb6 100644 --- a/mitmproxy/examples/upsidedownternet.py +++ b/mitmproxy/examples/upsidedownternet.py @@ -1,6 +1,6 @@ import cStringIO from PIL import Image -from libmproxy.models import decoded +from mitmproxy.models import decoded def response(context, flow): diff --git a/mitmproxy/mitmproxy/cmdline.py b/mitmproxy/mitmproxy/cmdline.py index b1cbfa3a..fedd4f13 100644 --- a/mitmproxy/mitmproxy/cmdline.py +++ b/mitmproxy/mitmproxy/cmdline.py @@ -364,7 +364,7 @@ def proxy_options(parser): ) http2 = group.add_mutually_exclusive_group() # !!! - # Watch out: We raise a RuntimeError in libmproxy.proxy.config if http2 is enabled, + # Watch out: We raise a RuntimeError in mitmproxy.proxy.config if http2 is enabled, # but the OpenSSL version does not have ALPN support (which is the default on Ubuntu 14.04). # Do not simply set --http2 as enabled by default. # !!! @@ -642,7 +642,7 @@ def common_options(parser): def mitmproxy(): - # Don't import libmproxy.console for mitmdump, urwid is not available on all + # Don't import mitmproxy.console for mitmdump, urwid is not available on all # platforms. from .console import palettes diff --git a/mitmproxy/mitmproxy/exceptions.py b/mitmproxy/mitmproxy/exceptions.py index a5d35263..f0ff81a2 100644 --- a/mitmproxy/mitmproxy/exceptions.py +++ b/mitmproxy/mitmproxy/exceptions.py @@ -11,7 +11,7 @@ from __future__ import (absolute_import, print_function, division) class ProxyException(Exception): """ - Base class for all exceptions thrown by libmproxy. + Base class for all exceptions thrown by mitmproxy. """ def __init__(self, message=None): diff --git a/mitmproxy/mitmproxy/models/http.py b/mitmproxy/mitmproxy/models/http.py index da9c430e..394fe51a 100644 --- a/mitmproxy/mitmproxy/models/http.py +++ b/mitmproxy/mitmproxy/models/http.py @@ -5,10 +5,10 @@ import warnings from email.utils import parsedate_tz, formatdate, mktime_tz import time -from libmproxy import utils from netlib import encoding from netlib.http import status_codes, Headers, Request, Response, decoded from netlib.tcp import Address +from .. import utils from .. import version from .flow import Flow diff --git a/mitmproxy/mitmproxy/protocol/__init__.py b/mitmproxy/mitmproxy/protocol/__init__.py index ea958d06..d44e25e9 100644 --- a/mitmproxy/mitmproxy/protocol/__init__.py +++ b/mitmproxy/mitmproxy/protocol/__init__.py @@ -18,7 +18,7 @@ Upgrade request. An actual mitmproxy connection may look as follows (outermost l Every layer acts as a read-only context for its inner layers (see :py:class:`Layer`). To communicate with an outer layer, a layer can use functions provided in the context. The next layer is always -determined by a call to :py:meth:`.next_layer() <libmproxy.proxy.RootContext.next_layer>`, +determined by a call to :py:meth:`.next_layer() <mitmproxy.proxy.RootContext.next_layer>`, which is provided by the root context. Another subtle design goal of this architecture is that upstream connections should be established diff --git a/mitmproxy/mitmproxy/protocol/base.py b/mitmproxy/mitmproxy/protocol/base.py index 40fcaf65..a14066cd 100644 --- a/mitmproxy/mitmproxy/protocol/base.py +++ b/mitmproxy/mitmproxy/protocol/base.py @@ -19,15 +19,15 @@ class _LayerCodeCompletion(object): if True: return self.config = None - """@type: libmproxy.proxy.ProxyConfig""" + """@type: mitmproxy.proxy.ProxyConfig""" self.client_conn = None - """@type: libmproxy.models.ClientConnection""" + """@type: mitmproxy.models.ClientConnection""" self.server_conn = None - """@type: libmproxy.models.ServerConnection""" + """@type: mitmproxy.models.ServerConnection""" self.channel = None - """@type: libmproxy.controller.Channel""" + """@type: mitmproxy.controller.Channel""" self.ctx = None - """@type: libmproxy.protocol.Layer""" + """@type: mitmproxy.protocol.Layer""" class Layer(_LayerCodeCompletion): @@ -48,9 +48,9 @@ class Layer(_LayerCodeCompletion): sub_layer = Layer(root_layer) print(sub_layer.client_conn) # 42 - The root layer is passed a :py:class:`libmproxy.proxy.RootContext` object, - which provides access to :py:attr:`.client_conn <libmproxy.proxy.RootContext.client_conn>`, - :py:attr:`.next_layer <libmproxy.proxy.RootContext.next_layer>` and other basic attributes. + The root layer is passed a :py:class:`mitmproxy.proxy.RootContext` object, + which provides access to :py:attr:`.client_conn <mitmproxy.proxy.RootContext.client_conn>`, + :py:attr:`.next_layer <mitmproxy.proxy.RootContext.next_layer>` and other basic attributes. Args: ctx: The (read-only) parent layer / context. @@ -70,7 +70,7 @@ class Layer(_LayerCodeCompletion): Once the protocol has finished without exceptions. Raises: - ~libmproxy.exceptions.ProtocolException: if an exception occurs. No other exceptions must be raised. + ~mitmproxy.exceptions.ProtocolException: if an exception occurs. No other exceptions must be raised. """ raise NotImplementedError() @@ -138,7 +138,7 @@ class ServerConnectionMixin(object): Sets a new server address. If there is an existing connection, it will be closed. Raises: - ~libmproxy.exceptions.ProtocolException: + ~mitmproxy.exceptions.ProtocolException: if ``server_tls`` is ``True``, but there was no TLS layer on the protocol stack which could have processed this. """ @@ -171,7 +171,7 @@ class ServerConnectionMixin(object): Must not be called if there is an existing connection. Raises: - ~libmproxy.exceptions.ProtocolException: if the connection could not be established. + ~mitmproxy.exceptions.ProtocolException: if the connection could not be established. """ if not self.server_conn.address: raise ProtocolException("Cannot connect to server, no server address given.") diff --git a/mitmproxy/mitmproxy/protocol/http_replay.py b/mitmproxy/mitmproxy/protocol/http_replay.py index 63870dfb..6316f26c 100644 --- a/mitmproxy/mitmproxy/protocol/http_replay.py +++ b/mitmproxy/mitmproxy/protocol/http_replay.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, print_function, division) import threading import traceback -from libmproxy.exceptions import ReplayException +from mitmproxy.exceptions import ReplayException from netlib.exceptions import HttpException, TcpException from netlib.http import http1 @@ -10,7 +10,7 @@ from ..models import Error, HTTPResponse, ServerConnection, make_connect_request from .base import Kill -# TODO: Doesn't really belong into libmproxy.protocol... +# TODO: Doesn't really belong into mitmproxy.protocol... class RequestReplayThread(threading.Thread): diff --git a/mitmproxy/mitmproxy/protocol/tls.py b/mitmproxy/mitmproxy/protocol/tls.py index 378dd7d4..6913396d 100644 --- a/mitmproxy/mitmproxy/protocol/tls.py +++ b/mitmproxy/mitmproxy/protocol/tls.py @@ -227,7 +227,7 @@ def get_client_hello(client_conn): Peek into the socket and read all records that contain the initial client hello message. client_conn: - The :py:class:`client connection <libmproxy.models.ClientConnection>`. + The :py:class:`client connection <mitmproxy.models.ClientConnection>`. Returns: The raw handshake packet bytes, without TLS record header(s). @@ -279,9 +279,9 @@ class TlsClientHello(object): """ Peek into the connection, read the initial client hello and parse it to obtain ALPN values. client_conn: - The :py:class:`client connection <libmproxy.models.ClientConnection>`. + The :py:class:`client connection <mitmproxy.models.ClientConnection>`. Returns: - :py:class:`client hello <libmproxy.protocol.tls.TlsClientHello>`. + :py:class:`client hello <mitmproxy.protocol.tls.TlsClientHello>`. """ try: raw_client_hello = get_client_hello(client_conn)[4:] # exclude handshake header. diff --git a/mitmproxy/mitmproxy/proxy/root_context.py b/mitmproxy/mitmproxy/proxy/root_context.py index f56aee6d..ae49523f 100644 --- a/mitmproxy/mitmproxy/proxy/root_context.py +++ b/mitmproxy/mitmproxy/proxy/root_context.py @@ -4,7 +4,7 @@ import sys import six -from libmproxy.exceptions import ProtocolException, TlsProtocolException +from mitmproxy.exceptions import ProtocolException, TlsProtocolException from netlib.exceptions import TcpException from ..protocol import ( RawTCPLayer, TlsLayer, Http1Layer, Http2Layer, is_tls_record_magic, ServerConnectionMixin, @@ -21,13 +21,13 @@ class RootContext(object): Attributes: client_conn: - The :py:class:`client connection <libmproxy.models.ClientConnection>`. + The :py:class:`client connection <mitmproxy.models.ClientConnection>`. channel: - A :py:class:`~libmproxy.controller.Channel` to communicate with the FlowMaster. - Provides :py:meth:`.ask() <libmproxy.controller.Channel.ask>` and - :py:meth:`.tell() <libmproxy.controller.Channel.tell>` methods. + A :py:class:`~mitmproxy.controller.Channel` to communicate with the FlowMaster. + Provides :py:meth:`.ask() <mitmproxy.controller.Channel.ask>` and + :py:meth:`.tell() <mitmproxy.controller.Channel.tell>` methods. config: - The :py:class:`proxy server's configuration <libmproxy.proxy.ProxyConfig>` + The :py:class:`proxy server's configuration <mitmproxy.proxy.ProxyConfig>` """ def __init__(self, client_conn, config, channel): diff --git a/mitmproxy/mitmproxy/proxy/server.py b/mitmproxy/mitmproxy/proxy/server.py index d208cff5..8b62ff93 100644 --- a/mitmproxy/mitmproxy/proxy/server.py +++ b/mitmproxy/mitmproxy/proxy/server.py @@ -68,14 +68,14 @@ class ConnectionHandler(object): def __init__(self, client_conn, client_address, config, channel): self.config = config - """@type: libmproxy.proxy.config.ProxyConfig""" + """@type: mitmproxy.proxy.config.ProxyConfig""" self.client_conn = ClientConnection( client_conn, client_address, None) - """@type: libmproxy.proxy.connection.ClientConnection""" + """@type: mitmproxy.proxy.connection.ClientConnection""" self.channel = channel - """@type: libmproxy.controller.Channel""" + """@type: mitmproxy.controller.Channel""" def _create_root_layer(self): root_context = RootContext( diff --git a/mitmproxy/setup.py b/mitmproxy/setup.py index 13006752..9d796ebb 100644 --- a/mitmproxy/setup.py +++ b/mitmproxy/setup.py @@ -9,7 +9,7 @@ import sys here = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(here, "..", "netlib")) -from libmproxy import version +from mitmproxy import version with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() @@ -45,9 +45,9 @@ setup( include_package_data=True, entry_points={ 'console_scripts': [ - 'mitmproxy = libmproxy.main:mitmproxy', - 'mitmdump = libmproxy.main:mitmdump', - 'mitmweb = libmproxy.main:mitmweb' + 'mitmproxy = mitmproxy.main:mitmproxy', + 'mitmdump = mitmproxy.main:mitmdump', + 'mitmweb = mitmproxy.main:mitmweb' ] }, # https://packaging.python.org/en/latest/requirements/#install-requires diff --git a/mitmproxy/web/conf.js b/mitmproxy/web/conf.js index 7c520973..5867ce45 100644 --- a/mitmproxy/web/conf.js +++ b/mitmproxy/web/conf.js @@ -1,8 +1,8 @@ var conf = { src: "src/", - dist: "../libmproxy/web", - static: "../libmproxy/web/static", + dist: "../mitmproxy/web", + static: "../mitmproxy/web/static", js: { // Don't package these in the vendor distribution vendor_excludes: [ diff --git a/test/mitmproxy/scripts/concurrent_decorator.py b/test/mitmproxy/scripts/concurrent_decorator.py index f6feda1d..6651c811 100644 --- a/test/mitmproxy/scripts/concurrent_decorator.py +++ b/test/mitmproxy/scripts/concurrent_decorator.py @@ -1,5 +1,5 @@ import time -from libmproxy.script import concurrent +from mitmproxy.script import concurrent @concurrent diff --git a/test/mitmproxy/scripts/concurrent_decorator_err.py b/test/mitmproxy/scripts/concurrent_decorator_err.py index 00fd8dad..071b8889 100644 --- a/test/mitmproxy/scripts/concurrent_decorator_err.py +++ b/test/mitmproxy/scripts/concurrent_decorator_err.py @@ -1,4 +1,4 @@ -from libmproxy.script import concurrent +from mitmproxy.script import concurrent @concurrent diff --git a/test/mitmproxy/test_cmdline.py b/test/mitmproxy/test_cmdline.py index 9b3317aa..5a70f3e0 100644 --- a/test/mitmproxy/test_cmdline.py +++ b/test/mitmproxy/test_cmdline.py @@ -1,5 +1,5 @@ import argparse -from libmproxy import cmdline +from mitmproxy import cmdline from . import tutils diff --git a/test/mitmproxy/test_console.py b/test/mitmproxy/test_console.py index e64ed44a..58a812a6 100644 --- a/test/mitmproxy/test_console.py +++ b/test/mitmproxy/test_console.py @@ -1,8 +1,8 @@ import gc import netlib.tutils -from libmproxy import console -from libmproxy.console import common +from mitmproxy import console +from mitmproxy.console import common from . import tutils diff --git a/test/mitmproxy/test_console_common.py b/test/mitmproxy/test_console_common.py index deba5f6c..219200e0 100644 --- a/test/mitmproxy/test_console_common.py +++ b/test/mitmproxy/test_console_common.py @@ -4,7 +4,7 @@ if os.name == "nt": raise SkipTest("Skipped on Windows.") -import libmproxy.console.common as common +import mitmproxy.console.common as common from . import tutils diff --git a/test/mitmproxy/test_console_help.py b/test/mitmproxy/test_console_help.py index f1a71faf..0589bd68 100644 --- a/test/mitmproxy/test_console_help.py +++ b/test/mitmproxy/test_console_help.py @@ -3,7 +3,7 @@ from unittest.case import SkipTest if os.name == "nt": raise SkipTest("Skipped on Windows.") -import libmproxy.console.help as help +import mitmproxy.console.help as help class TestHelp: diff --git a/test/mitmproxy/test_console_palettes.py b/test/mitmproxy/test_console_palettes.py index ac33f83d..b5d84ddd 100644 --- a/test/mitmproxy/test_console_palettes.py +++ b/test/mitmproxy/test_console_palettes.py @@ -2,7 +2,7 @@ import os from unittest.case import SkipTest if os.name == "nt": raise SkipTest("Skipped on Windows.") -import libmproxy.console.palettes as palettes +import mitmproxy.console.palettes as palettes class TestPalette: diff --git a/test/mitmproxy/test_console_pathedit.py b/test/mitmproxy/test_console_pathedit.py index 940351f5..e2c27b7c 100644 --- a/test/mitmproxy/test_console_pathedit.py +++ b/test/mitmproxy/test_console_pathedit.py @@ -1,6 +1,6 @@ import os from os.path import normpath -from libmproxy.console import pathedit +from mitmproxy.console import pathedit from . import tutils diff --git a/test/mitmproxy/test_contentview.py b/test/mitmproxy/test_contentview.py index af80d63a..7f1d735e 100644 --- a/test/mitmproxy/test_contentview.py +++ b/test/mitmproxy/test_contentview.py @@ -1,9 +1,9 @@ -from libmproxy.exceptions import ContentViewException +from mitmproxy.exceptions import ContentViewException from netlib.http import Headers import netlib.utils from netlib import encoding -import libmproxy.contentviews as cv +import mitmproxy.contentviews as cv from . import tutils try: diff --git a/test/mitmproxy/test_controller.py b/test/mitmproxy/test_controller.py index ffc7d433..eb3f7df4 100644 --- a/test/mitmproxy/test_controller.py +++ b/test/mitmproxy/test_controller.py @@ -1,5 +1,5 @@ import mock -from libmproxy import controller +from mitmproxy import controller class TestMaster: diff --git a/test/mitmproxy/test_custom_contentview.py b/test/mitmproxy/test_custom_contentview.py index adc4109b..479b0b43 100644 --- a/test/mitmproxy/test_custom_contentview.py +++ b/test/mitmproxy/test_custom_contentview.py @@ -1,4 +1,4 @@ -import libmproxy.contentviews as cv +import mitmproxy.contentviews as cv from netlib.http import Headers diff --git a/test/mitmproxy/test_dump.py b/test/mitmproxy/test_dump.py index dbd0c653..3588a73f 100644 --- a/test/mitmproxy/test_dump.py +++ b/test/mitmproxy/test_dump.py @@ -1,13 +1,13 @@ import os from cStringIO import StringIO -from libmproxy.exceptions import ContentViewException -from libmproxy.models import HTTPResponse +from mitmproxy.exceptions import ContentViewException +from mitmproxy.models import HTTPResponse import netlib.tutils from netlib.http import CONTENT_MISSING -from libmproxy import dump, flow -from libmproxy.proxy import Log +from mitmproxy import dump, flow +from mitmproxy.proxy import Log from . import tutils import mock @@ -49,7 +49,7 @@ def test_strfuncs(): m.echo_flow(flow) -@mock.patch("libmproxy.contentviews.get_content_view") +@mock.patch("mitmproxy.contentviews.get_content_view") def test_contentview(get_content_view): get_content_view.side_effect = ContentViewException(""), ("x", iter([])) diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py index bb7c596b..6920c8e9 100644 --- a/test/mitmproxy/test_examples.py +++ b/test/mitmproxy/test_examples.py @@ -1,11 +1,11 @@ import glob -from libmproxy import utils, script -from libmproxy.proxy import config +from mitmproxy import utils, script +from mitmproxy.proxy import config from . import tservers def test_load_scripts(): - example_dir = utils.Data("libmproxy").path("../examples") + example_dir = utils.Data("mitmproxy").path("../examples") scripts = glob.glob("%s/*.py" % example_dir) tmaster = tservers.TestMaster(config.ProxyConfig()) diff --git a/test/mitmproxy/test_filt.py b/test/mitmproxy/test_filt.py index e6873c7d..0ea635e7 100644 --- a/test/mitmproxy/test_filt.py +++ b/test/mitmproxy/test_filt.py @@ -1,7 +1,7 @@ import cStringIO -from libmproxy import filt -from libmproxy.models import Error -from libmproxy.models import http +from mitmproxy import filt +from mitmproxy.models import Error +from mitmproxy.models import http from netlib.http import Headers from . import tutils diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py index b122489f..a593c8c3 100644 --- a/test/mitmproxy/test_flow.py +++ b/test/mitmproxy/test_flow.py @@ -9,16 +9,16 @@ import mock import netlib.utils from netlib import odict from netlib.http import CONTENT_MISSING, Headers -from libmproxy import filt, controller, tnetstring, flow -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 import ProxyConfig -from libmproxy.proxy.server import DummyServer -from libmproxy.models.connections import ClientConnection +from mitmproxy import filt, controller, tnetstring, flow +from mitmproxy.models import Error +from mitmproxy.models import Flow +from mitmproxy.models import HTTPFlow +from mitmproxy.models import HTTPRequest +from mitmproxy.models import HTTPResponse +from mitmproxy.proxy.config import HostMatcher +from mitmproxy.proxy import ProxyConfig +from mitmproxy.proxy.server import DummyServer +from mitmproxy.models.connections import ClientConnection from . import tutils diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_flow_export.py index e5e9c0a3..2dce3fd6 100644 --- a/test/mitmproxy/test_flow_export.py +++ b/test/mitmproxy/test_flow_export.py @@ -1,7 +1,7 @@ from textwrap import dedent import netlib.tutils -from libmproxy import flow_export +from mitmproxy import flow_export from . import tutils req_get = netlib.tutils.treq( diff --git a/test/mitmproxy/test_flow_format_compat.py b/test/mitmproxy/test_flow_format_compat.py index 232f5473..7a0694e1 100644 --- a/test/mitmproxy/test_flow_format_compat.py +++ b/test/mitmproxy/test_flow_format_compat.py @@ -1,4 +1,4 @@ -from libmproxy.flow import FlowReader, FlowReadError +from mitmproxy.flow import FlowReader, FlowReadError from . import tutils diff --git a/test/mitmproxy/test_platform_pf.py b/test/mitmproxy/test_platform_pf.py index 8994ee0d..5082fafb 100644 --- a/test/mitmproxy/test_platform_pf.py +++ b/test/mitmproxy/test_platform_pf.py @@ -1,5 +1,5 @@ import sys -from libmproxy.platform import pf +from mitmproxy.platform import pf from . import tutils diff --git a/test/mitmproxy/test_protocol_http2.py b/test/mitmproxy/test_protocol_http2.py index 6d3bb43f..fc27cc3f 100644 --- a/test/mitmproxy/test_protocol_http2.py +++ b/test/mitmproxy/test_protocol_http2.py @@ -6,8 +6,8 @@ import traceback import os import tempfile -from libmproxy.proxy.config import ProxyConfig -from libmproxy.cmdline import APP_HOST, APP_PORT +from mitmproxy.proxy.config import ProxyConfig +from mitmproxy.cmdline import APP_HOST, APP_PORT import logging logging.getLogger("hyper.packages.hpack.hpack").setLevel(logging.WARNING) diff --git a/test/mitmproxy/test_proxy.py b/test/mitmproxy/test_proxy.py index 27ae70a8..9c4a6604 100644 --- a/test/mitmproxy/test_proxy.py +++ b/test/mitmproxy/test_proxy.py @@ -2,11 +2,11 @@ import os import mock from OpenSSL import SSL -from libmproxy import cmdline -from libmproxy.proxy import ProxyConfig -from libmproxy.proxy.config import process_proxy_options -from libmproxy.models.connections import ServerConnection -from libmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler +from mitmproxy import cmdline +from mitmproxy.proxy import ProxyConfig +from mitmproxy.proxy.config import process_proxy_options +from mitmproxy.models.connections import ServerConnection +from mitmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler from netlib.exceptions import TcpDisconnect from libpathod import test from netlib.http import http1 @@ -76,11 +76,11 @@ class TestProcessProxyOptions: with tutils.tmpdir() as cadir: self.assert_noerr("--cadir", cadir) - @mock.patch("libmproxy.platform.resolver", None) + @mock.patch("mitmproxy.platform.resolver", None) def test_no_transparent(self): self.assert_err("transparent mode not supported", "-T") - @mock.patch("libmproxy.platform.resolver") + @mock.patch("mitmproxy.platform.resolver") def test_modes(self, _): self.assert_noerr("-R", "http://localhost") self.assert_err("expected one argument", "-R") diff --git a/test/mitmproxy/test_script.py b/test/mitmproxy/test_script.py index f3a6499e..b827c623 100644 --- a/test/mitmproxy/test_script.py +++ b/test/mitmproxy/test_script.py @@ -1,7 +1,7 @@ import os import time import mock -from libmproxy import script, flow +from mitmproxy import script, flow from . import tutils @@ -68,7 +68,7 @@ def test_concurrent(): fm = flow.FlowMaster(None, s) fm.load_script(tutils.test_data.path("scripts/concurrent_decorator.py")) - with mock.patch("libmproxy.controller.DummyReply.__call__") as m: + with mock.patch("mitmproxy.controller.DummyReply.__call__") as m: f1, f2 = tutils.tflow(), tutils.tflow() t_start = time.time() fm.handle_request(f1) diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index 1b7e6966..3d65659f 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -12,9 +12,9 @@ from netlib.http import authentication, CONTENT_MISSING, http1 from netlib.tutils import raises from libpathod import pathoc, pathod -from libmproxy.proxy.config import HostMatcher -from libmproxy.protocol import Kill -from libmproxy.models import Error, HTTPResponse +from mitmproxy.proxy.config import HostMatcher +from mitmproxy.protocol import Kill +from mitmproxy.models import Error, HTTPResponse from . import tutils, tservers diff --git a/test/mitmproxy/test_utils.py b/test/mitmproxy/test_utils.py index 17bf3dbf..ae6369ae 100644 --- a/test/mitmproxy/test_utils.py +++ b/test/mitmproxy/test_utils.py @@ -1,5 +1,5 @@ import json -from libmproxy import utils +from mitmproxy import utils from . import tutils utils.CERT_SLEEP_TIME = 0 diff --git a/test/mitmproxy/tools/benchtool.py b/test/mitmproxy/tools/benchtool.py index a1d80697..17043676 100644 --- a/test/mitmproxy/tools/benchtool.py +++ b/test/mitmproxy/tools/benchtool.py @@ -5,7 +5,7 @@ # - Apache Bench "ab" binary # - pip install click yappi -from libmproxy.main import mitmdump +from mitmproxy.main import mitmdump from os import system from threading import Thread import time diff --git a/test/mitmproxy/tools/inspect_dumpfile.py b/test/mitmproxy/tools/inspect_dumpfile.py index d15e9e8a..b2201f40 100644 --- a/test/mitmproxy/tools/inspect_dumpfile.py +++ b/test/mitmproxy/tools/inspect_dumpfile.py @@ -2,7 +2,7 @@ from pprint import pprint import click -from libmproxy import tnetstring +from mitmproxy import tnetstring def read_tnetstring(input): diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py index dbc9f7d0..df4a2f2d 100644 --- a/test/mitmproxy/tservers.py +++ b/test/mitmproxy/tservers.py @@ -4,12 +4,12 @@ import tempfile import flask import mock -from libmproxy.proxy.config import ProxyConfig -from libmproxy.proxy.server import ProxyServer +from mitmproxy.proxy.config import ProxyConfig +from mitmproxy.proxy.server import ProxyServer import libpathod.test import libpathod.pathoc -from libmproxy import flow, controller -from libmproxy.cmdline import APP_HOST, APP_PORT +from mitmproxy import flow, controller +from mitmproxy.cmdline import APP_HOST, APP_PORT testapp = flask.Flask(__name__) @@ -192,7 +192,7 @@ class TransparentProxTest(ProxTestBase): super(TransparentProxTest, cls).setup_class() cls._resolver = mock.patch( - "libmproxy.platform.resolver", + "mitmproxy.platform.resolver", new=lambda: cls.resolver(cls.server.port) ) cls._resolver.start() diff --git a/test/mitmproxy/tutils.py b/test/mitmproxy/tutils.py index 2ce0884d..edcdf3e2 100644 --- a/test/mitmproxy/tutils.py +++ b/test/mitmproxy/tutils.py @@ -9,8 +9,8 @@ from contextlib import contextmanager from unittest.case import SkipTest import netlib.tutils -from libmproxy import utils, controller -from libmproxy.models import ( +from mitmproxy import utils, controller +from mitmproxy.models import ( ClientConnection, ServerConnection, Error, HTTPRequest, HTTPResponse, HTTPFlow ) @@ -39,12 +39,12 @@ def skip_appveyor(fn): def tflow(client_conn=True, server_conn=True, req=True, resp=None, err=None): """ - @type client_conn: bool | None | libmproxy.proxy.connection.ClientConnection - @type server_conn: bool | None | libmproxy.proxy.connection.ServerConnection - @type req: bool | None | libmproxy.protocol.http.HTTPRequest - @type resp: bool | None | libmproxy.protocol.http.HTTPResponse - @type err: bool | None | libmproxy.protocol.primitives.Error - @return: bool | None | libmproxy.protocol.http.HTTPFlow + @type client_conn: bool | None | mitmproxy.proxy.connection.ClientConnection + @type server_conn: bool | None | mitmproxy.proxy.connection.ServerConnection + @type req: bool | None | mitmproxy.protocol.http.HTTPRequest + @type resp: bool | None | mitmproxy.protocol.http.HTTPResponse + @type err: bool | None | mitmproxy.protocol.primitives.Error + @return: bool | None | mitmproxy.protocol.http.HTTPFlow """ if client_conn is True: client_conn = tclient_conn() @@ -72,7 +72,7 @@ def tflow(client_conn=True, server_conn=True, req=True, resp=None, err=None): def tclient_conn(): """ - @return: libmproxy.proxy.connection.ClientConnection + @return: mitmproxy.proxy.connection.ClientConnection """ c = ClientConnection.from_state(dict( address=dict(address=("address", 22), use_ipv6=True), @@ -88,7 +88,7 @@ def tclient_conn(): def tserver_conn(): """ - @return: libmproxy.proxy.connection.ServerConnection + @return: mitmproxy.proxy.connection.ServerConnection """ c = ServerConnection.from_state(dict( address=dict(address=("address", 22), use_ipv6=True), @@ -108,7 +108,7 @@ def tserver_conn(): def terr(content="error"): """ - @return: libmproxy.protocol.primitives.Error + @return: mitmproxy.protocol.primitives.Error """ err = Error(content) return err |