MCPcopy
hub / github.com/trustedsec/social-engineer-toolkit / start_web_server

Function start_web_server

src/core/setcore.py:597–618  ·  view source on GitHub ↗
(directory)

Source from the content-addressed store, hash-verified

595# you clone a website then run it in that web server, it will pull any index.html file
596#
597def start_web_server(directory):
598 try:
599 # import the threading, socketserver, and simplehttpserver
600 import socketserver
601 import http.server
602 # create the httpd handler for the simplehttpserver
603 # we set the allow_reuse_address incase something hangs can still bind
604 # to port
605
606 class ReusableTCPServer(socketserver.TCPServer):
607 allow_reuse_address = True
608 # specify the httpd service on 0.0.0.0 (all interfaces) on port 80
609 httpd = ReusableTCPServer(
610 ("0.0.0.0", 80), http.server.SimpleHTTPRequestHandler)
611 # thread this mofo
612 os.chdir(directory)
613 thread.start_new_thread(httpd.serve_forever, ())
614
615 # handle keyboard interrupts
616 except KeyboardInterrupt:
617 print_info("Exiting the SET web server...")
618 httpd.socket.close()
619
620#
621# this will start a web server without threads

Callers 1

java_applet_attackFunction · 0.85

Calls 2

print_infoFunction · 0.85
ReusableTCPServerClass · 0.70

Tested by

no test coverage detected