Update chat project

This commit is contained in:
Manuel Vergara 2024-01-25 23:06:43 +01:00
parent c0b6b881e4
commit b8187724d2
4 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,7 @@
CLIENTE DE CHAT CIFRADO E2E
"""
import ssl
import socket as s
import threading as th
from tkinter import *
@ -65,6 +65,7 @@ def client_program():
port = 1234
client_socket = s.socket(s.AF_INET, s.SOCK_STREAM)
client_socket = ssl.wrap_socket(client_socket)
client_socket.connect((host, port))
username = input("\n[+] Introduce tu usuario: ")
@ -76,9 +77,6 @@ def client_program():
window = Tk()
window.title(f'Chat cifrado E2E - {username}')
# window.geometry('500x700')
# window.iconbitmap("oveja-negra.ico")
# window.iconphoto(False, PhotoImage(file="oveja-negra.png"))
text_widget = ScrolledText(window, state='disabled')
text_widget.pack(padx=5, pady=5)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

View File

@ -5,6 +5,7 @@ SERVER DE CHAT CIFRADO E2E
import socket as s
import threading as th
import ssl
def client_thread(client_socket, clients, usernames):
@ -55,6 +56,10 @@ def server_program():
server_socket = s.socket(s.AF_INET, s.SOCK_STREAM)
server_socket.setsockopt(s.SOL_SOCKET, s.SO_REUSEADDR, 1) # TIME_WAIT
server_socket.bind((host, port))
server_socket = ssl.wrap_socket(
server_socket, keyfile='server-key.key',
certfile='server-cert.pem', server_side=True
)
server_socket.listen()
print(f"\n[+] Server está en escucha...")