Browse Source

fileserver.stop()

Roman Hergenreder 2 years ago
parent
commit
29d5f63c58
2 changed files with 9 additions and 9 deletions
  1. 9 0
      fileserver.py
  2. 0 9
      startHttpServer.sh

+ 9 - 0
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])

+ 0 - 9
startHttpServer.sh

@@ -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