From 629ebe8c6e75d9ab5b29cfd3e1ec5db5834d2f15 Mon Sep 17 00:00:00 2001 From: Gamotiv <49294700+Gamotiv@users.noreply.github.com> Date: Tue, 28 Dec 2021 07:37:43 +0200 Subject: [PATCH] Add files via upload the client that ggsya made which makes it the most pog client there is --- basic client CLI.py | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 basic client CLI.py diff --git a/basic client CLI.py b/basic client CLI.py new file mode 100644 index 0000000..5d4d741 --- /dev/null +++ b/basic client CLI.py @@ -0,0 +1,78 @@ +import socket +import threading +from Crypto.Cipher import AES +clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + +def check_name(name): + for i in name: + try: + int(i) + print('there is a number in de name?!?!') + break + except: + pass + +#ip='www.ggsya.ga' +#ip = '41.40.24.151' +#ip = socket.getaddrinfo('ggsya.ga',9000)[0][-1] +def default(): + ip='192.168.1.6' + name= 'gg' + print('trying to connect') + clientsocket.connect((ip, 9000)) + print('connected') + clientsocket.send(name.encode()) + check_name(name) + +def custom(): + ip = input('ip: ') + print('trying to connect') + name = input('name: ') + check_name(name) + clientsocket.connect((ip, 9000)) + print('connected') + +default() +#custom() + + +def do_encrypt(message): + obj = AES.new('ggsyaisverypoggersholyheckhowish', AES.MODE_CBC, 'poggers') + ciphertext = obj.encrypt(message) + return ciphertext + +def do_decrypt(ciphertext): + obj2 = AES.new('ggsyaisverypoggersholyheckhowish', AES.MODE_CBC, 'poggers') + message = obj2.decrypt(ciphertext) + return message + + +def recievemessage(): + while True: + try: + incoming_message =clientsocket.recv(1024) # try to receive 1024 bytes + except socket.timeout: + pass + else: + print(do_decrypt(incoming_message.decode())) + + + + +def sendmessage(): + while 1: + message = input() + clientsocket.send(do_encrypt(message).encode()) + + +clientsocket.settimeout(0.1) + +thread = threading.Thread(target=recievemessage) +thread.start() + +sendmessage() + + + +