parent
d6e507ad7f
commit
ae23a08881
1 changed files with 7 additions and 8 deletions
15
server.py
15
server.py
|
@ -754,7 +754,7 @@ def tcp_session(sock):
|
||||||
print("Waiting for connection...")
|
print("Waiting for connection...")
|
||||||
connection, client = sock.accept()
|
connection, client = sock.accept()
|
||||||
ip_to = restrict_ip
|
ip_to = restrict_ip
|
||||||
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to]).start()
|
threading.Thread(target=session, daemon=True, args=[context.wrap_socket(connection, client, ip_to]).start()
|
||||||
except:
|
except:
|
||||||
print("Something went wrong...")
|
print("Something went wrong...")
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
@ -762,13 +762,12 @@ def ssl_session(sock2):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
while opened:
|
while opened:
|
||||||
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
||||||
context.load_cert_chain(ssl_cert, keyfile=ssl_pkey)
|
context.load_cert_chain(ssl_cert, keyfile=ssl_pkey)
|
||||||
with context.wrap_socket(sock2, server_side=True) as sock:
|
print("Waiting for connection...")
|
||||||
print("Waiting for connection...")
|
connection, client = sock.accept()
|
||||||
connection, client = sock.accept()
|
ip_to = restrict_ip
|
||||||
ip_to = restrict_ip
|
threading.Thread(target=session, daemon=True, args=[context.wrap_socket(connection, server_side=True), client, ip_to, True]).start()
|
||||||
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to, True]).start()
|
|
||||||
except:
|
except:
|
||||||
print("Something went wrong...")
|
print("Something went wrong...")
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
|
Loading…
Add table
Reference in a new issue