text stringlengths 1 93.6k |
|---|
try:
|
with open(os.path.join(THEME_LOC, SETTINGS["Theme"], "rpi.html"), "rb") as buf:
|
data = buf.read()
|
self.my_sender("text/html", data, {"Cache-Control": "public, max-age=31536000", "Last-Modified": self.last_mod_time(os.path.join(THEME_LOC, SETTINGS["Theme"], "rpi.html"))})
|
except (IOError, PermissionError):
|
self.my_send_error(404)
|
def pkgs(self):
|
if re.match(r"^\/pkgs[\/]?$", self.path):
|
self.api_pkg_list()
|
elif self.path.endswith(".pkg") or self.path.endswith(".json"):
|
path = unquote(self.path.split("/", 2)[-1])
|
try:
|
with open(os.path.join(PKG_LOC, path), "rb") as buf:
|
data = buf.read()
|
self.my_sender("application/octet-stream", data, {"Cache-Control": "public, max-age=31536000", "Last-Modified": self.last_mod_time(os.path.join(PKG_LOC, path))})
|
except (IOError, PermissionError):
|
self.my_send_error(404)
|
else:
|
self.my_send_error(403)
|
def exploit(self):
|
path = unquote(self.path.split("/", 2)[-1])
|
if path[-1:] == "/":
|
path += "index.html"
|
mime = mimetypes.guess_type(self.path.rsplit("/", 1)[-1])
|
if mime[0]:
|
mime = mime[0]
|
else:
|
mime = "application/octet-stream"
|
try:
|
with open(os.path.join(EXPLOIT_LOC, path), "rb") as buf:
|
data = buf.read()
|
self.my_sender(mime, data, {"Last-Modified": self.last_mod_time(os.path.join(EXPLOIT_LOC, path))}) # TODO: Cache-Control Headers
|
except (IOError, PermissionError):
|
self.my_send_error(404)
|
def favicon(self):
|
try:
|
with open(os.path.join(THEME_LOC, SETTINGS["Theme"], "favicon.ico"), "rb") as buf:
|
data = buf.read()
|
self.my_sender("image/x-icon", data, {"Cache-Control": "public, max-age=31536000", "Last-Modified": self.last_mod_time(os.path.join(THEME_LOC, SETTINGS["Theme"], "favicon.ico"))})
|
except (IOError, PermissionError):
|
self.my_send_error(404)
|
def robots(self):
|
try:
|
with open(os.path.join(THEME_LOC, SETTINGS["Theme"], "robots.txt"), "rb") as buf:
|
data = buf.read()
|
self.my_sender("text/plain", data, {"Cache-Control": "public, max-age=31536000", "Last-Modified": self.last_mod_time(os.path.join(THEME_LOC, SETTINGS["Theme"], "robots.txt"))})
|
except (IOError, PermissionError):
|
self.my_send_error(404)
|
def sitemap(self):
|
try:
|
with open(os.path.join(THEME_LOC, SETTINGS["Theme"], "sitemap.xml"), "rb") as buf:
|
data = buf.read()
|
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/"
|
self.my_sender("text/plain", data.replace(b"{{HOSTNAME}}", bytes(hostname, "utf-8")), {"Cache-Control": "public, max-age=31536000", "Last-Modified": self.last_mod_time(os.path.join(THEME_LOC, SETTINGS["Theme"], "sitemap.xml"))})
|
except (IOError, PermissionError):
|
self.my_send_error(404)
|
def success(self):
|
self.empty_response()
|
if SETTINGS["Public"]:
|
return
|
if not MENU_OPEN:
|
payload_brain(self.client_address[0])
|
def success_args(self):
|
self.empty_response()
|
if SETTINGS["Public"]:
|
return
|
result = re.search(r"^\/success\/([0-9]{1,5})\/([0-9]{1,3})\/(.*)$", self.path)
|
if int(result.group(1)) < 1 or int(result.group(1)) > 65535:
|
print(">> Success request port number is out of range")
|
elif int(result.group(2)) < 0 or int(result.group(2)) > 999:
|
print(">> Success request timeout is out of range")
|
else:
|
try:
|
with open(os.path.join(PAYLOAD_LOC, result.group(3)), "rb") as buf:
|
print(f">> Sending {result.group(3)}...")
|
send_payload(self.address_string(), int(result.group(1)), int(result.group(2)), buf.read())
|
except (IOError, PermissionError):
|
print(f">> Success request payload ({result.group(2)}) not found")
|
def theme_loader(self):
|
try:
|
cookies = SimpleCookie(self.headers.get("Cookie"))
|
default_cookie = f"theme={SETTINGS['Theme']}; expires={(datetime.datetime.now(datetime.UTC) + datetime.timedelta(days=36500)).strftime('%a, %d %b %Y %H:%M:%S GMT')}; domain={self.headers.get('Host')}; path={quote(self.path)};"
|
theme_error_html = b'<!DOCTYPE html><html><head><meta charset="utf-8"><title>Theme Error</title></head><body><script>"use strict";window.addEventListener("load",function(){alert("Error retrieving theme data, resetting theme to default and reloading."),window.location.reload(!0)});</script></body></html>'
|
extra_headers = {}
|
theme = cookies["theme"].value
|
if not os.path.isdir(os.path.join(THEME_LOC, theme)):
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.