aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-05-31 19:35:10 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-05-31 19:35:10 -0700
commit1ca45b1e6435a45b5a6c646d9f7bba716d79da43 (patch)
tree0aa92ea14292c88134e970243f633d449fd9d7c7
parent3aa8d42b053f2b2910e0eea44c1f5fd4e79a5338 (diff)
downloadmitmproxy-1ca45b1e6435a45b5a6c646d9f7bba716d79da43.tar.gz
mitmproxy-1ca45b1e6435a45b5a6c646d9f7bba716d79da43.tar.bz2
mitmproxy-1ca45b1e6435a45b5a6c646d9f7bba716d79da43.zip
fix imports
-rw-r--r--mitmproxy/contentviews.py9
-rw-r--r--mitmproxy/platform/windows.py20
2 files changed, 13 insertions, 16 deletions
diff --git a/mitmproxy/contentviews.py b/mitmproxy/contentviews.py
index 194bb3bb..795d5c6f 100644
--- a/mitmproxy/contentviews.py
+++ b/mitmproxy/contentviews.py
@@ -36,8 +36,7 @@ from netlib import encoding
from netlib import http
from netlib import odict
from netlib.http import url
-from netlib.utils import clean_bin
-from netlib.utils import hexdump
+from netlib import utils
try:
import pyamf
@@ -157,7 +156,7 @@ class ViewHex(View):
@staticmethod
def _format(data):
- for offset, hexa, s in hexdump(data):
+ for offset, hexa, s in utils.hexdump(data):
yield [
("offset", offset + " "),
("text", hexa + " "),
@@ -582,9 +581,9 @@ def safe_to_print(lines, encoding="utf8"):
clean_line = []
for (style, text) in line:
try:
- text = clean_bin(text.decode(encoding, "strict"))
+ text = utils.clean_bin(text.decode(encoding, "strict"))
except UnicodeDecodeError:
- text = clean_bin(text).decode(encoding, "strict")
+ text = utils.clean_bin(text).decode(encoding, "strict")
clean_line.append((style, text))
yield clean_line
diff --git a/mitmproxy/platform/windows.py b/mitmproxy/platform/windows.py
index e160d050..576516e2 100644
--- a/mitmproxy/platform/windows.py
+++ b/mitmproxy/platform/windows.py
@@ -8,10 +8,8 @@ import threading
import time
import configargparse
-from pydivert.enum import Direction
-from pydivert.enum import Flag
-from pydivert.enum import Layer
-from pydivert.windivert import WinDivert
+from pydivert import enum
+from pydivert import windivert
from six.moves import cPickle as pickle
from six.moves import socketserver
@@ -199,7 +197,7 @@ class TransparentProxy(object):
self.api_thread = threading.Thread(target=self.api.serve_forever)
self.api_thread.daemon = True
- self.driver = WinDivert()
+ self.driver = windivert.WinDivert()
self.driver.register()
self.request_filter = custom_filter or " or ".join(
@@ -245,23 +243,23 @@ class TransparentProxy(object):
# real gateway if they are on the same network.
self.icmp_handle = self.driver.open_handle(
filter="icmp",
- layer=Layer.NETWORK,
- flags=Flag.DROP)
+ layer=enum.Layer.NETWORK,
+ flags=enum.Flag.DROP)
self.response_handle = self.driver.open_handle(
filter=self.response_filter,
- layer=Layer.NETWORK)
+ layer=enum.Layer.NETWORK)
self.response_thread.start()
if self.mode == "forward" or self.mode == "both":
self.request_forward_handle = self.driver.open_handle(
filter=self.request_filter,
- layer=Layer.NETWORK_FORWARD)
+ layer=enum.Layer.NETWORK_FORWARD)
self.request_forward_thread.start()
if self.mode == "local" or self.mode == "both":
self.request_local_handle = self.driver.open_handle(
filter=self.request_filter,
- layer=Layer.NETWORK)
+ layer=enum.Layer.NETWORK)
self.request_local_thread.start()
def shutdown(self):
@@ -353,7 +351,7 @@ class TransparentProxy(object):
self.client_server_map[client] = server
packet.dst_addr, packet.dst_port = self.proxy_addr, self.proxy_port
- metadata.direction = Direction.INBOUND
+ metadata.direction = enum.Direction.INBOUND
packet = self.driver.update_packet_checksums(packet)
# Use any handle thats on the NETWORK layer - request_local may be