Skip to content

Commit 089afc0

Browse files
committed
bugfixes with SSL and bytes decoding
1 parent 3bad5c0 commit 089afc0

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

proxymodules/textdump.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
import os.path as path
3+
from codecs import decode
34

45

56
class Module:
@@ -19,10 +20,10 @@ def __init__(self, incoming=False, verbose=False, options=None):
1920

2021
def execute(self, data):
2122
if self.find is None:
22-
print(data)
23+
print(repr(decode(data, 'raw_unicode_escape')))
2324
else:
2425
pdata = data.replace(self.find, self.color + self.find + b'\033[0m')
25-
print(pdata.decode('ascii'))
26+
print(repr(decode(pdata, 'raw_unicode_escape')))
2627
return data
2728

2829
def help(self):

tcpproxy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ def handle_data(data, modules, dont_chain, incoming, verbose):
184184
def is_client_hello(sock):
185185
firstbytes = sock.recv(128, socket.MSG_PEEK)
186186
return (len(firstbytes) >= 3 and
187-
firstbytes[0] == "\x16" and
188-
firstbytes[1:3] in ["\x03\x00",
189-
"\x03\x01",
190-
"\x03\x02",
191-
"\x03\x03",
192-
"\x02\x00"]
187+
firstbytes[0] == 0x16 and
188+
firstbytes[1:3] in [b"\x03\x00",
189+
b"\x03\x01",
190+
b"\x03\x02",
191+
b"\x03\x03",
192+
b"\x02\x00"]
193193
)
194194

195195

0 commit comments

Comments
 (0)