|
1 | 1 |
|
2 | 2 | # Python ChatRoom Client |
3 | | -# v4.0, August 2019 |
| 3 | +# v4.1.0, August 2019 |
4 | 4 | # Made by Bill. |
5 | 5 | # Updates: |
6 | | -# Very large clean-up of code. |
| 6 | +# Now you can log in from other people's computers. |
7 | 7 |
|
8 | 8 | # Imports first, always. |
9 | 9 | import socket |
@@ -36,7 +36,7 @@ def write(self, message): |
36 | 36 | ''' |
37 | 37 | pass |
38 | 38 |
|
39 | | -sys.stderr = DevNull() |
| 39 | +# sys.stderr = DevNull() |
40 | 40 |
|
41 | 41 | # Let's make a class for handling sockets! |
42 | 42 | class Client(tk.Tk): |
@@ -64,9 +64,6 @@ def __init__(self, port): |
64 | 64 | self.data = json.load(f) |
65 | 65 | f.close() |
66 | 66 |
|
67 | | - if not 'salt' in self.data: |
68 | | - self.data['salt'] = secrets.token_urlsafe(64) |
69 | | - |
70 | 67 | if not ('publicKey' in self.data and 'privateKey' in self.data): |
71 | 68 | print('No keys detected...generating keys. (This may take a while.) ') |
72 | 69 | keys = rsa.newkeys(1024) |
@@ -240,7 +237,7 @@ def make_account(self, event = None): |
240 | 237 | self.ui.configure_cursor('') |
241 | 238 | credentials = str(self.publicKey.n) + '\n' + str(self.publicKey.e) + '\n' |
242 | 239 | credentials += username + '\n' |
243 | | - credentials += hashlib.sha512((password + self.data['salt']).encode()).hexdigest() + '\nnewacc' |
| 240 | + credentials += hashlib.sha512((password + username).encode()).hexdigest() + '\nnewacc' |
244 | 241 | self.server.send(credentials.encode()) |
245 | 242 |
|
246 | 243 | message = self.server.recv(2048) |
@@ -290,7 +287,7 @@ def login(self, event = None): |
290 | 287 | pk1 = self.publicKey.n |
291 | 288 | pk2 = self.publicKey.e |
292 | 289 | username = self.ui.entries[1].get() |
293 | | - password = hashlib.sha512((self.ui.entries[2].get() + self.data['salt']).encode()).hexdigest() |
| 290 | + password = hashlib.sha512((self.ui.entries[2].get() + username).encode()).hexdigest() |
294 | 291 |
|
295 | 292 | credentials = str(pk1) + '\n' + str(pk2) + '\n' + username + '\n' + password |
296 | 293 | self.server.send(credentials.encode()) |
|
0 commit comments