add the scripts
This commit is contained in:
parent
26501f220e
commit
fcecf1a04b
12 changed files with 490 additions and 0 deletions
87
cloakcatcher/handle_input.py
Executable file
87
cloakcatcher/handle_input.py
Executable file
|
|
@ -0,0 +1,87 @@
|
|||
# handle_input.py
|
||||
# Made by user333_
|
||||
# Meant to be included with main.py
|
||||
|
||||
from extract_config import extract_config
|
||||
from sys import exit
|
||||
|
||||
def handle_input() -> dict:
|
||||
|
||||
try:
|
||||
|
||||
print("Welcome to CloakCatcher v1.4.1")
|
||||
|
||||
prompt = None
|
||||
|
||||
while prompt not in ["", "1", "2"]:
|
||||
|
||||
print("Select a function:\n")
|
||||
print("1. Scan an individual server for CloakV4 users (default)")
|
||||
print("2. Scan all servers for CloakV4 users")
|
||||
|
||||
prompt = input("\nSelect (1-2): ").strip()
|
||||
|
||||
config = extract_config()
|
||||
|
||||
if prompt == "1" or prompt == "":
|
||||
|
||||
if config != {}:
|
||||
|
||||
username: str = input("CloakV4 username (press enter for default): " ).strip() or config["username"]
|
||||
passwd: str = input("CloakV4 password (press enter for default): " ).strip() or config["passwd"]
|
||||
address: str = input("IP of server to scan (press enter for default): " ).strip() or config["address"]
|
||||
port: str = input("Port of server to scan (press enter for default): ").strip() or config["port"]
|
||||
|
||||
else:
|
||||
|
||||
username: str = input("CloakV4 username: " ).strip()
|
||||
passwd: str = input("CloakV4 password: " ).strip()
|
||||
address: str = input("IP of server to scan: " ).strip()
|
||||
port: str = input("Port of server to scan: ").strip()
|
||||
|
||||
new_config = {
|
||||
"username": username,
|
||||
"passwd": passwd,
|
||||
"address": address,
|
||||
"port": port,
|
||||
"serverlist_url": ""
|
||||
}
|
||||
|
||||
return new_config
|
||||
|
||||
if prompt == "2":
|
||||
|
||||
if config != {}:
|
||||
|
||||
username: str = input("CloakV4 username (press enter for default): ").strip() or config["username"]
|
||||
passwd: str = input("CloakV4 password (press enter for default): ").strip() or config["passwd"]
|
||||
servlist: str = input("Serverlist URL (press enter for default): " ).strip() or config["serverlist_url"]
|
||||
|
||||
else:
|
||||
|
||||
username: str = input("CloakV4 username: ").strip()
|
||||
passwd: str = input("CloakV4 password: ").strip()
|
||||
servlist: str = input("Serverlist URL (press enter for default serverlist): ").strip() or "http://servers.luanti.org/list"
|
||||
|
||||
new_config = {
|
||||
"username": username,
|
||||
"passwd": passwd,
|
||||
"address": "all",
|
||||
"port": "all",
|
||||
"serverlist_url": servlist
|
||||
}
|
||||
|
||||
return new_config
|
||||
|
||||
else:
|
||||
|
||||
print ("Invalid response.")
|
||||
|
||||
except Exception:
|
||||
|
||||
raise Exception("[ERROR] Invalid configuration.")
|
||||
exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
raise Exception("[ERROR] You ran the wrong script, run main.py instead.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue