cleanup string interpolations
This commit is contained in:
parent
abfb140dc8
commit
8533e24622
10
proxy.py
10
proxy.py
@ -98,7 +98,7 @@ class ProxyRequestHandler(BaseHTTPRequestHandler):
|
|||||||
'''
|
'''
|
||||||
# request line: CONNECT www.example.com:443 HTTP/1.1
|
# request line: CONNECT www.example.com:443 HTTP/1.1
|
||||||
self.host, self.port = self.path.split(':')
|
self.host, self.port = self.path.split(':')
|
||||||
# SSL MITM
|
# TLS MITM
|
||||||
self.wfile.write(
|
self.wfile.write(
|
||||||
('HTTP/1.1 200 Connection established\r\n'
|
('HTTP/1.1 200 Connection established\r\n'
|
||||||
+ f'Proxy-agent: {self.version_string()}\r\n'
|
+ f'Proxy-agent: {self.version_string()}\r\n'
|
||||||
@ -137,11 +137,11 @@ class ProxyRequestHandler(BaseHTTPRequestHandler):
|
|||||||
if hasattr(self, 'url'):
|
if hasattr(self, 'url'):
|
||||||
# Happens after the tunnel is established
|
# Happens after the tunnel is established
|
||||||
logger.warning(f'{self.reqNum:03d} "{e}" while operating'
|
logger.warning(f'{self.reqNum:03d} "{e}" while operating'
|
||||||
f' on established local SSL tunnel for'
|
f' on established local TSL tunnel for'
|
||||||
f' [{self.url}]')
|
f' [{self.url}]')
|
||||||
else:
|
else:
|
||||||
logger.warning(f'{self.reqNum:03d} "{e}" while trying to'
|
logger.warning(f'{self.reqNum:03d} "{e}" while trying to'
|
||||||
' establish local SSL tunnel for'
|
' establish local TLS tunnel for'
|
||||||
f'[{self.path}]')
|
f'[{self.path}]')
|
||||||
self.close_connection = 1
|
self.close_connection = 1
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ class ProxyRequestHandler(BaseHTTPRequestHandler):
|
|||||||
break
|
break
|
||||||
server_conn.setblocking(True)
|
server_conn.setblocking(True)
|
||||||
if b'200' in datas and b'established' in datas.lower():
|
if b'200' in datas and b'established' in datas.lower():
|
||||||
logger.info('{:03d} [P] SSL Pass-Thru: https://{}/'.format(
|
logger.info('{:03d} [P] TLS passthru: https://{}/'.format(
|
||||||
self.reqNum, self.path))
|
self.reqNum, self.path))
|
||||||
self.wfile.write(('HTTP/1.1 200 Connection established\r\n' +
|
self.wfile.write(('HTTP/1.1 200 Connection established\r\n' +
|
||||||
'Proxy-agent: {}\r\n\r\n'.format(
|
'Proxy-agent: {}\r\n\r\n'.format(
|
||||||
@ -233,7 +233,7 @@ class ProxyRequestHandler(BaseHTTPRequestHandler):
|
|||||||
'''
|
'''
|
||||||
Tunnel traffic to remote host:port
|
Tunnel traffic to remote host:port
|
||||||
'''
|
'''
|
||||||
logger.info('{:03d} [D] SSL Pass-Thru: https://{}/'.format(
|
logger.info('{:03d} [D] TLS passthru: https://{}/'.format(
|
||||||
self.reqNum, self.path))
|
self.reqNum, self.path))
|
||||||
server_conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
server_conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user