diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-09-14 12:33:07 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-09-14 12:33:07 +1200 |
commit | ff09529ba3a5ec6d8df38a354ca61a6a4d33d3a1 (patch) | |
tree | 81bddd901bf668749ad4d56e177abe9448c86aaf | |
parent | 6812d304a1a1893480360d5439fa09445ad55a2c (diff) | |
download | mitmproxy-ff09529ba3a5ec6d8df38a354ca61a6a4d33d3a1.tar.gz mitmproxy-ff09529ba3a5ec6d8df38a354ca61a6a4d33d3a1.tar.bz2 mitmproxy-ff09529ba3a5ec6d8df38a354ca61a6a4d33d3a1.zip |
Add tornado dependency, serve index file
-rw-r--r-- | libmproxy/web/__init__.py | 3 | ||||
-rw-r--r-- | libmproxy/web/app.py | 6 | ||||
-rw-r--r-- | libmproxy/web/templates/index.html | 16 | ||||
-rw-r--r-- | setup.py | 3 |
4 files changed, 24 insertions, 4 deletions
diff --git a/libmproxy/web/__init__.py b/libmproxy/web/__init__.py index 99b190aa..8f98060c 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 7c26c29d..31b299a3 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 00000000..434f15f9 --- /dev/null +++ b/libmproxy/web/templates/index.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head lang="en"> + <meta charset="UTF-8"> + <title>mitmproxy</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" href="static/mitmproxy.css"/> + <script src="static/mitmproxy.js"></script> +</head> +<body> +<div id="mitmproxy"></div> +</body> +<script> + app = React.renderComponent(routes, document.body); +</script> +</html>
\ No newline at end of file @@ -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": { |