web.py 文件源码

python
阅读 39 收藏 0 点赞 0 评论 0

项目:DKMC 作者: Mr-Un1k0d3r 项目源码 文件源码
def run_action(self):
        current_cwd = os.getcwd()
        self.ui.print_msg("Starting web server on port %s" % self.vars["port"][0])
        print "\033[33m"
        try:
            httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', int(self.vars["port"][0])), SimpleHTTPServer.SimpleHTTPRequestHandler)
            if self.vars["https"][0].lower() == "true":
                httpd.socket = ssl.wrap_socket(httpd.socket, certfile=self.vars["certificate"][0], server_side=True)
            os.chdir(self.vars["folder"][0])
            httpd.serve_forever()
        except KeyboardInterrupt:
            print "\033[00m"
            self.ui.print_msg("Stopping web server")
        except:
            print "\033[00m"
            self.ui.print_error("The web server raised an exception")

        os.chdir(current_cwd)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号