From 31c1d742e0218bf4aa142bf5de2b77ebb13a062c Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Fri, 25 Oct 2019 19:34:31 +0200 Subject: [PATCH] fix: webui /shutdown is now on POST --- pwnagotchi/ui/web.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pwnagotchi/ui/web.py b/pwnagotchi/ui/web.py index e5432717..60fa2559 100644 --- a/pwnagotchi/ui/web.py +++ b/pwnagotchi/ui/web.py @@ -52,7 +52,7 @@ INDEX = """

-
+
@@ -149,24 +149,31 @@ class Handler(BaseHTTPRequestHandler): return True - # main entry point of the http server + def do_POST(self): + if not self._is_allowed(): + return + if self.path.startswith('/shutdown'): + self._shutdown() + else: + self.send_response(404) + def do_GET(self): if not self._is_allowed(): return if self.path == '/': self._index() - elif self.path.startswith('/shutdown'): - self._shutdown() elif self.path.startswith('/ui'): self._image() + elif self.path.startswith('/plugins'): plugin_from_path = re.match(r'\/plugins\/([^\/]+)(\/.*)?', self.path) if plugin_from_path: plugin_name = plugin_from_path.groups()[0] right_path = plugin_from_path.groups()[1] if len(plugin_from_path.groups()) == 2 else None plugins.one(plugin_name, 'webhook', right_path) + else: self.send_response(404)