aboutsummaryrefslogtreecommitdiffstats
path: root/pathod
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-20 11:56:38 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-20 11:56:38 +1300
commit8430f857b504a3e7406dc36e54dc32783569d0dd (patch)
treed3116cd540faf01f272a0892fc6a9b83b4f6de8a /pathod
parent853e03a5e753354fad3a3fa5384ef3a09384ef43 (diff)
downloadmitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.tar.gz
mitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.tar.bz2
mitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.zip
The final piece: netlib -> mitproxy.net
Diffstat (limited to 'pathod')
-rw-r--r--pathod/language/http.py12
-rw-r--r--pathod/language/http2.py4
-rw-r--r--pathod/language/websockets.py18
-rw-r--r--pathod/pathoc.py8
-rw-r--r--pathod/pathoc_cmdline.py4
-rw-r--r--pathod/pathod.py4
-rw-r--r--pathod/pathod_cmdline.py2
-rw-r--r--pathod/protocols/http.py2
-rw-r--r--pathod/protocols/http2.py22
-rw-r--r--pathod/protocols/websockets.py2
10 files changed, 39 insertions, 39 deletions
diff --git a/pathod/language/http.py b/pathod/language/http.py
index 32f990bb..8fcf9edc 100644
--- a/pathod/language/http.py
+++ b/pathod/language/http.py
@@ -2,12 +2,12 @@ import abc
import pyparsing as pp
-from netlib.http import url
-import netlib.websockets
-from netlib.http import status_codes, user_agents
+from mitmproxy.net.http import url
+import mitmproxy.net.websockets
+from mitmproxy.net.http import status_codes, user_agents
from . import base, exceptions, actions, message
-# TODO: use netlib.semantics.protocol assemble method,
+# TODO: use mitmproxy.net.semantics.protocol assemble method,
# instead of duplicating the HTTP on-the-wire representation here.
# see http2 language for an example
@@ -198,7 +198,7 @@ class Response(_HTTPMessage):
1,
StatusCode(101)
)
- headers = netlib.websockets.server_handshake_headers(
+ headers = mitmproxy.net.websockets.server_handshake_headers(
settings.websocket_key
)
for i in headers.fields:
@@ -310,7 +310,7 @@ class Request(_HTTPMessage):
1,
Method("get")
)
- for i in netlib.websockets.client_handshake_headers().fields:
+ for i in mitmproxy.net.websockets.client_handshake_headers().fields:
if not get_header(i[0], self.headers):
tokens.append(
Header(
diff --git a/pathod/language/http2.py b/pathod/language/http2.py
index 35fc5ba8..08c5f6d7 100644
--- a/pathod/language/http2.py
+++ b/pathod/language/http2.py
@@ -1,7 +1,7 @@
import pyparsing as pp
-from netlib import http
-from netlib.http import user_agents, Headers
+from mitmproxy.net import http
+from mitmproxy.net.http import user_agents, Headers
from . import base, message
"""
diff --git a/pathod/language/websockets.py b/pathod/language/websockets.py
index d2291f82..a237381c 100644
--- a/pathod/language/websockets.py
+++ b/pathod/language/websockets.py
@@ -1,6 +1,6 @@
import random
import string
-import netlib.websockets
+import mitmproxy.net.websockets
from mitmproxy.utils import strutils
import pyparsing as pp
from . import base, generators, actions, message
@@ -14,12 +14,12 @@ class WF(base.CaselessLiteral):
class OpCode(base.IntField):
names = {
- "continue": netlib.websockets.OPCODE.CONTINUE,
- "text": netlib.websockets.OPCODE.TEXT,
- "binary": netlib.websockets.OPCODE.BINARY,
- "close": netlib.websockets.OPCODE.CLOSE,
- "ping": netlib.websockets.OPCODE.PING,
- "pong": netlib.websockets.OPCODE.PONG,
+ "continue": mitmproxy.net.websockets.OPCODE.CONTINUE,
+ "text": mitmproxy.net.websockets.OPCODE.TEXT,
+ "binary": mitmproxy.net.websockets.OPCODE.BINARY,
+ "close": mitmproxy.net.websockets.OPCODE.CLOSE,
+ "ping": mitmproxy.net.websockets.OPCODE.PING,
+ "pong": mitmproxy.net.websockets.OPCODE.PONG,
}
max = 15
preamble = "c"
@@ -215,11 +215,11 @@ class WebsocketFrame(message.Message):
v = getattr(self, i, None)
if v is not None:
frameparts[i] = v.value
- frame = netlib.websockets.FrameHeader(**frameparts)
+ frame = mitmproxy.net.websockets.FrameHeader(**frameparts)
vals = [bytes(frame)]
if bodygen:
if frame.masking_key and not self.rawbody:
- masker = netlib.websockets.Masker(frame.masking_key)
+ masker = mitmproxy.net.websockets.Masker(frame.masking_key)
vals.append(
generators.TransformGenerator(
bodygen,
diff --git a/pathod/pathoc.py b/pathod/pathoc.py
index 0978277a..066c330c 100644
--- a/pathod/pathoc.py
+++ b/pathod/pathoc.py
@@ -13,12 +13,12 @@ import logging
from mitmproxy.test.tutils import treq
from mitmproxy.utils import strutils
-from netlib import tcp
+from mitmproxy.net import tcp
from mitmproxy import certs
-from netlib import websockets
-from netlib import socks
+from mitmproxy.net import websockets
+from mitmproxy.net import socks
from mitmproxy import exceptions
-from netlib.http import http1
+from mitmproxy.net.http import http1
from mitmproxy.types import basethread
from pathod import log
diff --git a/pathod/pathoc_cmdline.py b/pathod/pathoc_cmdline.py
index 2b4b9f9c..3b738d47 100644
--- a/pathod/pathoc_cmdline.py
+++ b/pathod/pathoc_cmdline.py
@@ -3,9 +3,9 @@ import argparse
import os
import os.path
-from netlib import tcp
+from mitmproxy.net import tcp
from mitmproxy import version
-from netlib.http import user_agents
+from mitmproxy.net.http import user_agents
from . import pathoc, language
diff --git a/pathod/pathod.py b/pathod/pathod.py
index 746998c5..a8658361 100644
--- a/pathod/pathod.py
+++ b/pathod/pathod.py
@@ -4,9 +4,9 @@ import os
import sys
import threading
-from netlib import tcp
+from mitmproxy.net import tcp
from mitmproxy import certs as mcerts
-from netlib import websockets
+from mitmproxy.net import websockets
from mitmproxy import version
import urllib
diff --git a/pathod/pathod_cmdline.py b/pathod/pathod_cmdline.py
index 8d6ee2b6..ef1e983f 100644
--- a/pathod/pathod_cmdline.py
+++ b/pathod/pathod_cmdline.py
@@ -4,7 +4,7 @@ import os
import os.path
import re
-from netlib import tcp
+from mitmproxy.net import tcp
from mitmproxy.utils import human
from mitmproxy import version
from . import pathod
diff --git a/pathod/protocols/http.py b/pathod/protocols/http.py
index a20a58a1..4387b4fb 100644
--- a/pathod/protocols/http.py
+++ b/pathod/protocols/http.py
@@ -1,6 +1,6 @@
from mitmproxy import version
from mitmproxy import exceptions
-from netlib.http import http1
+from mitmproxy.net.http import http1
from .. import language
diff --git a/pathod/protocols/http2.py b/pathod/protocols/http2.py
index 838469d6..118163d2 100644
--- a/pathod/protocols/http2.py
+++ b/pathod/protocols/http2.py
@@ -4,10 +4,10 @@ import time
import hyperframe.frame
from hpack.hpack import Encoder, Decoder
-from netlib.http import http2
-import netlib.http.headers
-import netlib.http.response
-import netlib.http.request
+from mitmproxy.net.http import http2
+import mitmproxy.net.http.headers
+import mitmproxy.net.http.response
+import mitmproxy.net.http.request
from mitmproxy.types import bidi
from .. import language
@@ -100,7 +100,7 @@ class HTTP2StateProtocol:
first_line_format, method, scheme, host, port, path = http2.parse_headers(headers)
- request = netlib.http.request.Request(
+ request = mitmproxy.net.http.request.Request(
first_line_format,
method,
scheme,
@@ -148,7 +148,7 @@ class HTTP2StateProtocol:
else:
timestamp_end = None
- response = netlib.http.response.Response(
+ response = mitmproxy.net.http.response.Response(
b"HTTP/2.0",
int(headers.get(':status', 502)),
b'',
@@ -162,15 +162,15 @@ class HTTP2StateProtocol:
return response
def assemble(self, message):
- if isinstance(message, netlib.http.request.Request):
+ if isinstance(message, mitmproxy.net.http.request.Request):
return self.assemble_request(message)
- elif isinstance(message, netlib.http.response.Response):
+ elif isinstance(message, mitmproxy.net.http.response.Response):
return self.assemble_response(message)
else:
raise ValueError("HTTP message not supported.")
def assemble_request(self, request):
- assert isinstance(request, netlib.http.request.Request)
+ assert isinstance(request, mitmproxy.net.http.request.Request)
authority = self.tcp_handler.sni if self.tcp_handler.sni else self.tcp_handler.address.host
if self.tcp_handler.address.port != 443:
@@ -194,7 +194,7 @@ class HTTP2StateProtocol:
self._create_body(request.body, stream_id)))
def assemble_response(self, response):
- assert isinstance(response, netlib.http.response.Response)
+ assert isinstance(response, mitmproxy.net.http.response.Response)
headers = response.headers.copy()
@@ -394,7 +394,7 @@ class HTTP2StateProtocol:
else:
self._handle_unexpected_frame(frm)
- headers = netlib.http.headers.Headers(
+ headers = mitmproxy.net.http.headers.Headers(
[[k, v] for k, v in self.decoder.decode(header_blocks, raw=True)]
)
diff --git a/pathod/protocols/websockets.py b/pathod/protocols/websockets.py
index 585a48e3..00ae5aa8 100644
--- a/pathod/protocols/websockets.py
+++ b/pathod/protocols/websockets.py
@@ -1,6 +1,6 @@
import time
-from netlib import websockets
+from mitmproxy.net import websockets
from pathod import language
from mitmproxy import exceptions