made a lot of stuff
This commit is contained in:
@@ -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}")
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
LOGIN:JeffreyEpstein:TheIslandIsMine
|
||||
@@ -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
|
||||
new_user_path = user_path / user
|
||||
|
||||
#2. Hash password and store in hash.txt
|
||||
#3. Init basic files
|
||||
#4. Make success request file
|
||||
#5. Fail file as try/except
|
||||
pass
|
||||
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)
|
||||
time.sleep(0.5)
|
||||
4
CHATTER/users/JefferyEpstein/info.txt
Normal file
4
CHATTER/users/JefferyEpstein/info.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
JefferyEpstein
|
||||
|
||||
|
||||
A new user
|
||||
1
CHATTER/users/JefferyEpstein/pass.txt
Normal file
1
CHATTER/users/JefferyEpstein/pass.txt
Normal file
@@ -0,0 +1 @@
|
||||
075a7a39b6da7ca35b0c6e2b557292cd:ff2c58215dcc972de006d5e20c83b3be3b3d07fe23dc638b6b06cdcf817f63992424cf607441b37550da7c7b01b904a4cccf7963848ade0fbf3265c002363a40
|
||||
@@ -1,4 +0,0 @@
|
||||
Helen Zhao
|
||||
11/2/2010
|
||||
She, Her
|
||||
My love... but you left me.
|
||||
Reference in New Issue
Block a user