parent
874b1ab10c
commit
b64054c9b7
1 changed files with 12 additions and 13 deletions
25
server.py
25
server.py
|
@ -915,25 +915,24 @@ def session(connection, client, ip, isssl=False):
|
|||
except:
|
||||
print(traceback.format_exc())
|
||||
def tcp_session(sock, ip_to):
|
||||
while True:
|
||||
while opened:
|
||||
try:
|
||||
while opened:
|
||||
print("Waiting for connection...")
|
||||
connection, client = sock.accept()
|
||||
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to]).start()
|
||||
print("Waiting for connection...")
|
||||
connection, client = sock.accept()
|
||||
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to]).start()
|
||||
except:
|
||||
print("Something went wrong...")
|
||||
print(traceback.format_exc())
|
||||
def ssl_session(sock, ip_to):
|
||||
while True:
|
||||
while opened:
|
||||
try:
|
||||
while opened:
|
||||
connection, client = sock.accept()
|
||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||
ctx.load_cert_chain(ssl_cert, keyfile=ssl_pkey)
|
||||
conn = ctx.wrap_socket(connection, server_side=True)
|
||||
conn.do_handshake()
|
||||
threading.Thread(target=session, daemon=True, args=[conn, client, ip_to, True]).start()
|
||||
print("Waiting for SSL connection...")
|
||||
connection, client = sock.accept()
|
||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||
ctx.load_cert_chain(ssl_cert, keyfile=ssl_pkey)
|
||||
conn = ctx.wrap_socket(connection, server_side=True)
|
||||
conn.do_handshake()
|
||||
threading.Thread(target=session, daemon=True, args=[conn, client, ip_to, True]).start()
|
||||
except:
|
||||
print("Something went wrong...")
|
||||
print(traceback.format_exc())
|
||||
|
|
Loading…
Add table
Reference in a new issue