made a lot of stuff
This commit is contained in:
@@ -8,9 +8,38 @@ import time
|
|||||||
# Sets the universal current path
|
# Sets the universal current path
|
||||||
script_dir = Path(__file__).parent
|
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():
|
def login_logic():
|
||||||
while True:
|
while True:
|
||||||
print("LOGIN CLIENT")
|
print("CordDie Login Client")
|
||||||
print("[1] Login [2] Sign up")
|
print("[1] Login [2] Sign up")
|
||||||
login_choice = input(" > ")
|
login_choice = input(" > ")
|
||||||
|
|
||||||
@@ -45,9 +74,11 @@ def login_logic():
|
|||||||
# 3. Rename it to .txt (After the 'with' block finishes)
|
# 3. Rename it to .txt (After the 'with' block finishes)
|
||||||
tmp_path.rename(final_path)
|
tmp_path.rename(final_path)
|
||||||
print("Request sent! Please wait...")
|
print("Request sent! Please wait...")
|
||||||
while True:
|
if wait_for_status(timestamp_ms):
|
||||||
# Waiting logic
|
print(f"Welcome Back, {login_username}!")
|
||||||
break
|
chat_ui()
|
||||||
|
else:
|
||||||
|
print("Login failed!")
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error in attempt {i+1}: {e}")
|
print(f"Error in attempt {i+1}: {e}")
|
||||||
@@ -94,6 +125,11 @@ def login_logic():
|
|||||||
# RENAME FILE!!!
|
# RENAME FILE!!!
|
||||||
tmp_path.rename(final_path)
|
tmp_path.rename(final_path)
|
||||||
print("Account creation request sent!")
|
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
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error in attempt {i+1}: {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)
|
# FAILSAFE 1: Ignore folders or non-txt files (like .DS_Store or .tmp)
|
||||||
if not file_path.is_file() or file_path.suffix != ".txt":
|
if not file_path.is_file() or file_path.suffix != ".txt":
|
||||||
print(f"Skipping non-txt file: {file_path.name}")
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -107,19 +106,33 @@ while True:
|
|||||||
if verify_password(password, data):
|
if verify_password(password, data):
|
||||||
file_path.rename(status_path / f"success_{file_path.name}")
|
file_path.rename(status_path / f"success_{file_path.name}")
|
||||||
# move and rename to success_filename.txt in status
|
# move and rename to success_filename.txt in status
|
||||||
|
print(f"{user} login success.")
|
||||||
else:
|
else:
|
||||||
file_path.rename(status_path / f"fail_{file_path.name}")
|
file_path.rename(status_path / f"fail_{file_path.name}")
|
||||||
|
print(f"{user} hash did not match.")
|
||||||
else:
|
else:
|
||||||
file_path.rename(status_path / f"fail_{file_path.name}")
|
file_path.rename(status_path / f"fail_{file_path.name}")
|
||||||
|
print(f"{user} does not exist.")
|
||||||
|
|
||||||
elif command == "CREATEUSER":
|
elif command == "CREATEUSER":
|
||||||
# TODO
|
new_user_path = user_path / user
|
||||||
|
|
||||||
#2. Hash password and store in hash.txt
|
if new_user_path.exists():
|
||||||
#3. Init basic files
|
file_path.rename(status_path / f"fail_{file_path.name}")
|
||||||
#4. Make success request file
|
print(f"{user} already exists!")
|
||||||
#5. Fail file as try/except
|
else:
|
||||||
pass
|
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():
|
elif file_path.is_file():
|
||||||
file_path.unlink()
|
file_path.unlink()
|
||||||
@@ -130,4 +143,4 @@ while True:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# 5. Heartbeat
|
# 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