From 11f0f8972707917446d3512910618cdb95889c80 Mon Sep 17 00:00:00 2001 From: cheney Date: Tue, 26 May 2026 21:46:49 +0800 Subject: [PATCH] =?UTF-8?q?ssl=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy/proxy_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxy/proxy_client.py b/proxy/proxy_client.py index 6a10b9d..3c89e74 100644 --- a/proxy/proxy_client.py +++ b/proxy/proxy_client.py @@ -5,6 +5,7 @@ import time import sys import configparser import os +import ssl # Configuration from config.ini CONFIG_FILE = os.path.join(os.path.dirname(__file__), 'config.ini') @@ -133,6 +134,11 @@ def handle_request(request_data): target_sock.connect((TARGET_HOST, TARGET_PORT)) log_info("System", "Connected to target: %s:%d" % (TARGET_HOST, TARGET_PORT)) + if TARGET_PROTOCOL == 'https': + context = ssl.create_default_context() + target_sock = context.wrap_socket(target_sock, server_hostname=TARGET_HOST) + log_info("System", "SSL connection established with target") + if isinstance(modified_data, str): modified_data = modified_data.encode('utf-8') target_sock.sendall(modified_data)