aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/src/content/howto-transparent.md4
-rw-r--r--docs/src/content/howto-wireshark-tls.md2
-rw-r--r--mitmproxy/net/http/cookies.py2
-rw-r--r--mitmproxy/net/http/response.py2
-rw-r--r--mitmproxy/net/websockets/masker.py16
-rw-r--r--setup.py2
-rw-r--r--test/mitmproxy/net/http/test_response.py2
-rw-r--r--tox.ini2
8 files changed, 18 insertions, 14 deletions
diff --git a/docs/src/content/howto-transparent.md b/docs/src/content/howto-transparent.md
index 9be1e2f8..3915e4b7 100644
--- a/docs/src/content/howto-transparent.md
+++ b/docs/src/content/howto-transparent.md
@@ -229,7 +229,7 @@ for more.
### Work-around to redirect traffic originating from the machine itself
-Follow the steps **1, 2** as above. In step **3** change the contents of the file **pf.conf** to
+Follow steps **1, 2** as above, but in step **2** change the contents of the file **pf.conf** to
{{< highlight none >}}
#The ports to redirect to proxy
@@ -257,7 +257,7 @@ rdr pass proto tcp from any to any port $redir_ports -> $tproxy
pass out route-to (lo0 127.0.0.1) proto tcp from any to any port $redir_ports user $redir_users
{{< / highlight >}}
-Follow steps **4-6** above. This will redirect the packets from all users other than `nobody` on the machine to mitmproxy. To avoid circularity, run mitmproxy as the user `nobody`. Hence step **7** should look like:
+Follow steps **3-5** above. This will redirect the packets from all users other than `nobody` on the machine to mitmproxy. To avoid circularity, run mitmproxy as the user `nobody`. Hence step **6** should look like:
{{< highlight bash >}}
sudo -u nobody mitmproxy --mode transparent --showhost
diff --git a/docs/src/content/howto-wireshark-tls.md b/docs/src/content/howto-wireshark-tls.md
index 588223ac..a55d177b 100644
--- a/docs/src/content/howto-wireshark-tls.md
+++ b/docs/src/content/howto-wireshark-tls.md
@@ -7,7 +7,7 @@ menu:
# Wireshark and SSL/TLS Master Secrets
-The SSL/SSL master keys can be logged by mitmproxy so that external programs can
+The SSL/TLS master keys can be logged by mitmproxy so that external programs can
decrypt SSL/TLS connections both from and to the proxy. Recent versions of
Wireshark can use these log files to decrypt packets. See the [Wireshark wiki](https://wiki.wireshark.org/SSL#Using_the_.28Pre.29-Master-Secret) for more information.
diff --git a/mitmproxy/net/http/cookies.py b/mitmproxy/net/http/cookies.py
index 1472ab55..2745701f 100644
--- a/mitmproxy/net/http/cookies.py
+++ b/mitmproxy/net/http/cookies.py
@@ -304,7 +304,7 @@ def refresh_set_cookie_header(c: str, delta: int) -> str:
e = email.utils.parsedate_tz(attrs["expires"])
if e:
f = email.utils.mktime_tz(e) + delta
- attrs.set_all("expires", [email.utils.formatdate(f)])
+ attrs.set_all("expires", [email.utils.formatdate(f, usegmt=True)])
else:
# This can happen when the expires tag is invalid.
# reddit.com sends a an expires tag like this: "Thu, 31 Dec
diff --git a/mitmproxy/net/http/response.py b/mitmproxy/net/http/response.py
index 48527d63..9491fc03 100644
--- a/mitmproxy/net/http/response.py
+++ b/mitmproxy/net/http/response.py
@@ -186,7 +186,7 @@ class Response(message.Message):
d = parsedate_tz(self.headers[i])
if d:
new = mktime_tz(d) + delta
- self.headers[i] = formatdate(new)
+ self.headers[i] = formatdate(new, usegmt=True)
c = []
for set_cookie_header in self.headers.get_all("set-cookie"):
try:
diff --git a/mitmproxy/net/websockets/masker.py b/mitmproxy/net/websockets/masker.py
index 47b1a688..6134e09e 100644
--- a/mitmproxy/net/websockets/masker.py
+++ b/mitmproxy/net/websockets/masker.py
@@ -1,3 +1,6 @@
+import sys
+
+
class Masker:
"""
Data sent from the server must be masked to prevent malicious clients
@@ -12,12 +15,13 @@ class Masker:
self.offset = 0
def mask(self, offset, data):
- result = bytearray(data)
- for i in range(len(data)):
- result[i] ^= self.key[offset % 4]
- offset += 1
- result = bytes(result)
- return result
+ datalen = len(data)
+ offset_mod = offset % 4
+ data = int.from_bytes(data, sys.byteorder)
+ num_keys = (datalen + offset_mod + 3) // 4
+ mask = int.from_bytes((self.key * num_keys)[offset_mod:datalen +
+ offset_mod], sys.byteorder)
+ return (data ^ mask).to_bytes(datalen, sys.byteorder)
def __call__(self, data):
ret = self.mask(self.offset, data)
diff --git a/setup.py b/setup.py
index 4c17bdc6..7f83de63 100644
--- a/setup.py
+++ b/setup.py
@@ -62,7 +62,7 @@ setup(
# It is not considered best practice to use install_requires to pin dependencies to specific versions.
install_requires=[
"blinker>=1.4, <1.5",
- "brotlipy>=0.7.0,<0.8",
+ "Brotli>=1.0,<1.1",
"certifi>=2015.11.20.1", # no semver here - this should always be on the last release!
"click>=6.2, <7",
"cryptography>=2.1.4,<2.5",
diff --git a/test/mitmproxy/net/http/test_response.py b/test/mitmproxy/net/http/test_response.py
index f3470384..27c16be6 100644
--- a/test/mitmproxy/net/http/test_response.py
+++ b/test/mitmproxy/net/http/test_response.py
@@ -148,7 +148,7 @@ class TestResponseUtils:
def test_refresh(self):
r = tresp()
n = time.time()
- r.headers["date"] = email.utils.formatdate(n)
+ r.headers["date"] = email.utils.formatdate(n, usegmt=True)
pre = r.headers["date"]
r.refresh(946681202)
assert pre == r.headers["date"]
diff --git a/tox.ini b/tox.ini
index 85cf40aa..3691eadf 100644
--- a/tox.ini
+++ b/tox.ini
@@ -44,7 +44,7 @@ commands =
passenv = TRAVIS_* APPVEYOR_* AWS_* TWINE_* DOCKER_* RTOOL_KEY WHEEL DOCKER PYINSTALLER WININSTALLER
deps =
-rrequirements.txt
- pyinstaller==3.4
+ pyinstaller==3.5
twine==1.12.1
awscli
commands =