From ff09529ba3a5ec6d8df38a354ca61a6a4d33d3a1 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 14 Sep 2014 12:33:07 +1200 Subject: [PATCH] Add tornado dependency, serve index file --- libmproxy/web/__init__.py | 3 --- libmproxy/web/app.py | 6 ++++++ libmproxy/web/templates/index.html | 16 ++++++++++++++++ setup.py | 3 ++- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 libmproxy/web/templates/index.html diff --git a/libmproxy/web/__init__.py b/libmproxy/web/__init__.py index 99b190aab..8f98060ca 100644 --- a/libmproxy/web/__init__.py +++ b/libmproxy/web/__init__.py @@ -82,20 +82,17 @@ class WebMaster(flow.FlowMaster): self.shutdown() def handle_request(self, f): - print "req" flow.FlowMaster.handle_request(self, f) if f: f.reply() return f def handle_response(self, f): - print "resp" flow.FlowMaster.handle_response(self, f) if f: f.reply() return f def handle_error(self, f): - print "err" flow.FlowMaster.handle_error(self, f) return f diff --git a/libmproxy/web/app.py b/libmproxy/web/app.py index 7c26c29d0..31b299a3e 100644 --- a/libmproxy/web/app.py +++ b/libmproxy/web/app.py @@ -3,9 +3,15 @@ import os.path import tornado.web +class IndexHandler(tornado.web.RequestHandler): + def get(self): + self.render("index.html") + + class Application(tornado.web.Application): def __init__(self, debug): handlers = [ + (r"/", IndexHandler), ] settings = dict( template_path=os.path.join(os.path.dirname(__file__), "templates"), diff --git a/libmproxy/web/templates/index.html b/libmproxy/web/templates/index.html new file mode 100644 index 000000000..434f15f9a --- /dev/null +++ b/libmproxy/web/templates/index.html @@ -0,0 +1,16 @@ + + + + + mitmproxy + + + + + +
+ + + \ No newline at end of file diff --git a/setup.py b/setup.py index a18dda3cf..8d87bc5d6 100644 --- a/setup.py +++ b/setup.py @@ -85,7 +85,8 @@ deps = { "pyasn1>0.1.2", "requests>=2.4.0", "pyOpenSSL>=0.14", - "Flask>=0.10.1" + "Flask>=0.10.1", + "tornado>=4.0.2" } script_deps = { "mitmproxy": {