ssl 支持
This commit is contained in:
parent
021738a8bb
commit
11f0f89727
@ -5,6 +5,7 @@ import time
|
|||||||
import sys
|
import sys
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
|
import ssl
|
||||||
|
|
||||||
# Configuration from config.ini
|
# Configuration from config.ini
|
||||||
CONFIG_FILE = os.path.join(os.path.dirname(__file__), '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))
|
target_sock.connect((TARGET_HOST, TARGET_PORT))
|
||||||
log_info("System", "Connected to target: %s:%d" % (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):
|
if isinstance(modified_data, str):
|
||||||
modified_data = modified_data.encode('utf-8')
|
modified_data = modified_data.encode('utf-8')
|
||||||
target_sock.sendall(modified_data)
|
target_sock.sendall(modified_data)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user