From 29d5f63c580247e1088875c60e368a89cd019a8e Mon Sep 17 00:00:00 2001 From: Roman Hergenreder Date: Sat, 5 Jun 2021 14:24:35 +0200 Subject: [PATCH] fileserver.stop() --- fileserver.py | 9 +++++++++ startHttpServer.sh | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) delete mode 100755 startHttpServer.sh diff --git a/fileserver.py b/fileserver.py index d0053d3..44e9522 100755 --- a/fileserver.py +++ b/fileserver.py @@ -115,6 +115,7 @@ class HttpFileServer(HTTPServer): self.routes = { } self.dumpRequests = [] self.prefix_routes = { } + self.is_running = True def cleanPath(self, path): @@ -176,6 +177,14 @@ class HttpFileServer(HTTPServer): def start(self): return self.serve_forever() + def stop(self): + self.is_running = False + + def serve_forever(self): + while self.is_running: + self.handle_request() + + if __name__ == "__main__": if len(sys.argv) < 2 or sys.argv[1] not in ["shell","dump","proxy","xss"]: print("Usage: %s [shell,dump,proxy,xss]" % sys.argv[0]) diff --git a/startHttpServer.sh b/startHttpServer.sh deleted file mode 100755 index 21aed28..0000000 --- a/startHttpServer.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/bash - -ipAddress=$(ip a show dev tun0 | grep inet | awk '{print $2'} | cut -d'/' -f1 | head -n 1) -echo "wget http://${ipAddress}/" -echo "curl http://${ipAddress}/" -echo "(New-Object System.Net.WebClient).DownloadFile('http://${ipAddress}/', 'C:\\Temp\\')" - -echo "" -sudo python -m http.server 80