text
stringlengths
1
93.6k
},
"author": "",
"url": "",
"params": False,
"redirect": True,
"reload": False,
"offline": False
}
}
try:
with open(os.path.join(EXPLOIT_LOC, entry_path, entry.name, "meta.json"), encoding="utf-8") as buf:
new_data = json.loads(buf.read())
except (IOError, PermissionError, json.decoder.JSONDecodeError):
pass
try:
del new_data["title"]
except KeyError:
pass
finished_data[entry.name].update(new_data)
output.update(finished_data)
if not output:
output = {"error": True, "message": "No Entries Found"}
return output
def api_menu(self):
categories = self.api_categories()
if categories != {"error": True, "message": "No Categories Found"}:
for key, value in categories.items():
UNUSED(value)
categories[key]["entries"] = self.api_entries(key)
self.my_sender("application/json", bytes(json.dumps(categories, sort_keys=True), "utf-8"), {"Cache-Control": "public, max-age=604800", "Last-Modified": self.last_mod_time(EXPLOIT_LOC)})
def api_theme_settings(self):
output = {}
output["languages"] = SETTINGS["Languages"]
output["themes"] = []
for entry in os.scandir(THEME_LOC):
if entry.is_dir(follow_symlinks=False):
output["themes"].append(entry.name)
self.my_sender("application/json", bytes(json.dumps(output), "utf-8"), {"Last-Modified": SCRIPT_START}) # TODO: Cache-Control Headers
def api_hostname(self):
hostname = "http://the.gate"
if SETTINGS["HTTP_Interface_IP"] == "127.0.0.1" and SETTINGS["DNS_Interface_IP"] == "165.227.83.145":
hostname = "https://cthugha.exploit.menu/"
elif SETTINGS["HTTP_Interface_IP"] == "127.0.0.1" and SETTINGS["DNS_Interface_IP"] == "108.61.128.158":
hostname = "https://ithaqua.exploit.menu/"
elif SETTINGS["HTTP_Port"] != 80:
hostname = f"{hostname}:{SETTINGS['HTTP_Port']}"
else:
hostname = f"{hostname}/"
self.my_sender("text/plain", bytes(hostname, "utf-8"), {"Last-Modified": SCRIPT_START}) # TODO: Cache-Control Headers
def api_view_settings(self):
if SETTINGS["Public"]:
return self.empty_response()
safe_settings = copy.deepcopy(SETTINGS)
try:
del safe_settings["Root_Check"]
del safe_settings["DNS"]
del safe_settings["HTTP"]
del safe_settings["DNS_Interface_IP"]
del safe_settings["DNS_Port"]
del safe_settings["HTTP_Interface_IP"]
del safe_settings["HTTP_Port"]
except KeyError:
pass
return self.my_sender("application/json", bytes(json.dumps(safe_settings), "utf-8"), {"Last-Modified": SCRIPT_START}) # TODO: Cache-Control Headers
def api_edit_settings(self, data):
# TODO: This function
if SETTINGS["Public"]:
return self.empty_response()
return self.empty_response()
def api_pkg_list(self):
try:
output = []
for path, dirs, files in os.walk(PKG_LOC):
UNUSED(dirs)
for entry in files:
if entry.endswith(".pkg") or entry.endswith(".json"):
pkgpath = quote("{}/{}".format(path.replace(CWD, "").replace("\\", "/"), entry), safe=";,/?:@&=+$-_.!~*'()#")
output.append({"Filename": entry, "Filesize": os.stat(os.path.join(path, entry)).st_size, "File_URL": f"http://{SETTINGS['HTTP_Interface_IP']}:{SETTINGS['HTTP_Port']}{pkgpath}"})
if len(output) == 0:
data = b'["No PKGs Found"]'
else:
data = bytes(json.dumps(output), "utf-8")
self.my_sender("application/json", data, {"Last-Modified": self.last_mod_time(PKG_LOC)}) # TODO: Cache-Control Headers
except (IOError, PermissionError):
data = b'["I/O Error on Host"]'
def rpi(self):