From d830e9b9a9cd531b2677bad94b4a08d7a539738b Mon Sep 17 00:00:00 2001 From: sk1nnywh1t3k1d Date: Tue, 6 Dec 2022 22:41:26 +0530 Subject: [PATCH] first commit --- README.md | 4 ++++ chat.txt | 2 ++ client.py | 26 ++++++++++++++++++++++++++ server.py | 27 +++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 README.md create mode 100644 chat.txt create mode 100644 client.py create mode 100644 server.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..ecc7671 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Chat Application + +This is a secure and private chat application that you can use to text chat with your friends without big corporations spying on you. +To use it on the public network you can use a port mapper. I recommend [UPnP PortMapper](https://github.com/kaklakariada/portmapper). diff --git a/chat.txt b/chat.txt new file mode 100644 index 0000000..e1ac09b --- /dev/null +++ b/chat.txt @@ -0,0 +1,2 @@ +Server: bit.ly/voughtencrypted +Client: Billy \ No newline at end of file diff --git a/client.py b/client.py new file mode 100644 index 0000000..35b2576 --- /dev/null +++ b/client.py @@ -0,0 +1,26 @@ +import socket + +client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + +ip = input("Enter IP Address: ") +port = int(input("Enter Port Number: ")) + +client.connect((ip, port)) + +#client.connect(("localhost", 9999)) + +done = False + +f = open('log.txt', 'w') + +while not done: + sent = input("Message: ") + f.write("Client: "+sent +"\n") + client.send(sent.encode('utf-8')) + received = client.recv(1024).decode('utf-8') + f.write("Server: " + received+"\n") + if received == 'quit': + done = True + else: + print(received) diff --git a/server.py b/server.py new file mode 100644 index 0000000..2a0ff02 --- /dev/null +++ b/server.py @@ -0,0 +1,27 @@ +import socket + +server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + +ip = input("Enter IP: ") +port = int(input("Enter Port Number: ")) + +server.bind((ip, port)) +#server.bind(("localhost", 9999)) +server.listen() + +client, addr = server.accept() + +done = False + +f = open('chat.txt', 'w') + +while not done: + received = client.recv(1024).decode('utf-8') + f.write(received + "\n") + if received == 'quit': + done = True + else: + print(received) + sent = input("Message: ") + f.write("Server: " + sent + "\n") + client.send(sent.encode('utf-8'))