35 lines
872 B
Python
Executable file
35 lines
872 B
Python
Executable file
# extract_config.py
|
|
# Made by user333_
|
|
# Meant to be included with main.py
|
|
|
|
from ast import literal_eval
|
|
from sys import exit
|
|
|
|
CONFIG_FILE = "cloakcatcher.conf"
|
|
|
|
def extract_config() -> dict:
|
|
|
|
try:
|
|
|
|
with open(CONFIG_FILE, "r") as f:
|
|
|
|
config_data = f.read().strip()
|
|
|
|
config = literal_eval(config_data)
|
|
restructured_config = {
|
|
"username": config["cloakv4_username"],
|
|
"passwd": config["cloakv4_password"],
|
|
"address": config["server_ip"],
|
|
"port": config["server_port"],
|
|
"serverlist_url": config["serverlist_url"]}
|
|
return restructured_config
|
|
|
|
except Exception as e:
|
|
|
|
print(f"[WARNING] {CONFIG_FILE} is empty, missing, or incorrectly structured.")
|
|
return {}
|
|
|
|
if __name__ == "__main__":
|
|
|
|
raise Exception("[ERROR] You ran the wrong script, run main.py instead.")
|
|
exit(1)
|