From bf10077bdb8aca09a01a546c370641cee6db3b69 Mon Sep 17 00:00:00 2001 From: p7mj Date: Fri, 10 Apr 2026 17:55:33 -0400 Subject: [PATCH] made a lot of stuff --- CHATTER/login_client.py | 44 +++++++++++++++++-- .../requests/status/fail_1775660763462.txt | 1 - CHATTER/server.py | 31 +++++++++---- CHATTER/users/JefferyEpstein/info.txt | 4 ++ CHATTER/users/JefferyEpstein/pass.txt | 1 + CHATTER/users/helen_zhao/info.txt | 4 -- CHATTER/users/helen_zhao/pass.txt | 0 7 files changed, 67 insertions(+), 18 deletions(-) delete mode 100644 CHATTER/requests/status/fail_1775660763462.txt create mode 100644 CHATTER/users/JefferyEpstein/info.txt create mode 100644 CHATTER/users/JefferyEpstein/pass.txt delete mode 100644 CHATTER/users/helen_zhao/info.txt delete mode 100644 CHATTER/users/helen_zhao/pass.txt diff --git a/CHATTER/login_client.py b/CHATTER/login_client.py index dcc9164..c972fca 100644 --- a/CHATTER/login_client.py +++ b/CHATTER/login_client.py @@ -8,9 +8,38 @@ import time # Sets the universal current path script_dir = Path(__file__).parent +def chat_ui(): + print("CordDie") + # file finding and choosing logic + +def wait_for_status(timestamp): + status_folder = script_dir / "requests" / "status" + print("Waiting for server response...", end="", flush=True) + + # Try for about 5 seconds (50 iterations * 0.1s) + for _ in range(50): + success_file = status_folder / f"success_{timestamp}.txt" + fail_file = status_folder / f"fail_{timestamp}.txt" + + if success_file.exists(): + print("\n[SUCCESS] Action completed!") + success_file.unlink() # Cleanup the status file + return True + + if fail_file.exists(): + print("\n[FAILED] The server rejected the request.") + fail_file.unlink() # Cleanup + return False + + print(".", end="", flush=True) + time.sleep(0.1) + + print("\n[TIMEOUT] Server is taking too long.") + return False + def login_logic(): while True: - print("LOGIN CLIENT") + print("CordDie Login Client") print("[1] Login [2] Sign up") login_choice = input(" > ") @@ -45,9 +74,11 @@ def login_logic(): # 3. Rename it to .txt (After the 'with' block finishes) tmp_path.rename(final_path) print("Request sent! Please wait...") - while True: - # Waiting logic - break + if wait_for_status(timestamp_ms): + print(f"Welcome Back, {login_username}!") + chat_ui() + else: + print("Login failed!") break except Exception as e: print(f"Error in attempt {i+1}: {e}") @@ -94,6 +125,11 @@ def login_logic(): # RENAME FILE!!! tmp_path.rename(final_path) print("Account creation request sent!") + + if wait_for_status(timestamp_ms): + print("Account created! Please login.") + else: + print("Account creation failed, this username might already exist.") break except Exception as e: print(f"Error in attempt {i+1}: {e}") diff --git a/CHATTER/requests/status/fail_1775660763462.txt b/CHATTER/requests/status/fail_1775660763462.txt deleted file mode 100644 index 5209ce0..0000000 --- a/CHATTER/requests/status/fail_1775660763462.txt +++ /dev/null @@ -1 +0,0 @@ -LOGIN:JeffreyEpstein:TheIslandIsMine \ No newline at end of file diff --git a/CHATTER/server.py b/CHATTER/server.py index 99043bc..817445f 100644 --- a/CHATTER/server.py +++ b/CHATTER/server.py @@ -62,7 +62,6 @@ while True: # FAILSAFE 1: Ignore folders or non-txt files (like .DS_Store or .tmp) if not file_path.is_file() or file_path.suffix != ".txt": - print(f"Skipping non-txt file: {file_path.name}") continue try: @@ -107,19 +106,33 @@ while True: if verify_password(password, data): file_path.rename(status_path / f"success_{file_path.name}") # move and rename to success_filename.txt in status + print(f"{user} login success.") else: file_path.rename(status_path / f"fail_{file_path.name}") + print(f"{user} hash did not match.") else: file_path.rename(status_path / f"fail_{file_path.name}") + print(f"{user} does not exist.") elif command == "CREATEUSER": - # TODO - - #2. Hash password and store in hash.txt - #3. Init basic files - #4. Make success request file - #5. Fail file as try/except - pass + new_user_path = user_path / user + + if new_user_path.exists(): + file_path.rename(status_path / f"fail_{file_path.name}") + print(f"{user} already exists!") + else: + try: + new_user_path.mkdir(parents=True) + with open(new_user_path / "pass.txt", "w") as password: + password.write(hash_password(data)) + with open(new_user_path / "info.txt", "w") as info: + info.write(f"{user}\n\n\nA new user") + print(f"{user} created!") + file_path.rename(status_path / f"success_{file_path.name}") + except Exception as e: + print(f"Something went wrong while trying to create {user}: {e}") + file_path.rename(status_path / f"fail_{file_path.name}") + continue elif file_path.is_file(): file_path.unlink() @@ -130,4 +143,4 @@ while True: continue # 5. Heartbeat - time.sleep(0.1) \ No newline at end of file + time.sleep(0.5) \ No newline at end of file diff --git a/CHATTER/users/JefferyEpstein/info.txt b/CHATTER/users/JefferyEpstein/info.txt new file mode 100644 index 0000000..db67419 --- /dev/null +++ b/CHATTER/users/JefferyEpstein/info.txt @@ -0,0 +1,4 @@ +JefferyEpstein + + +A new user \ No newline at end of file diff --git a/CHATTER/users/JefferyEpstein/pass.txt b/CHATTER/users/JefferyEpstein/pass.txt new file mode 100644 index 0000000..19a1eea --- /dev/null +++ b/CHATTER/users/JefferyEpstein/pass.txt @@ -0,0 +1 @@ +075a7a39b6da7ca35b0c6e2b557292cd:ff2c58215dcc972de006d5e20c83b3be3b3d07fe23dc638b6b06cdcf817f63992424cf607441b37550da7c7b01b904a4cccf7963848ade0fbf3265c002363a40 \ No newline at end of file diff --git a/CHATTER/users/helen_zhao/info.txt b/CHATTER/users/helen_zhao/info.txt deleted file mode 100644 index 8a438a8..0000000 --- a/CHATTER/users/helen_zhao/info.txt +++ /dev/null @@ -1,4 +0,0 @@ -Helen Zhao -11/2/2010 -She, Her -My love... but you left me. \ No newline at end of file diff --git a/CHATTER/users/helen_zhao/pass.txt b/CHATTER/users/helen_zhao/pass.txt deleted file mode 100644 index e69de29..0000000