diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-10-31 11:23:53 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-10-31 11:34:58 +1300 |
commit | 3f50930dc06a980ac5dcf012fa23ecc0a70ce1b4 (patch) | |
tree | 9c3bf8fe82326072d2c470f47d12ed654b991fb6 /libpathod/pathod.py | |
parent | 8c6cc8140c6ac51966bdfabd5bb1180c2dd623b0 (diff) | |
download | mitmproxy-3f50930dc06a980ac5dcf012fa23ecc0a70ce1b4.tar.gz mitmproxy-3f50930dc06a980ac5dcf012fa23ecc0a70ce1b4.tar.bz2 mitmproxy-3f50930dc06a980ac5dcf012fa23ecc0a70ce1b4.zip |
Use .freeze to implement the -e explain flags for pathod and pathoc.
This now prints (in pathoc) or logs (in pathod) a frozen specification that
includes an expanded record of all generated values and locations.
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r-- | libpathod/pathod.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index fb6a7725..bc5a1825 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -28,6 +28,9 @@ class PathodHandler(tcp.BaseHandler): ) return False, log + if self.server.explain: + crafted = crafted.freeze(self.server.request_settings, None) + print crafted response_log = language.serve(crafted, self.wfile, self.server.request_settings, None) log = dict( type = "crafted", @@ -171,7 +174,7 @@ class Pathod(tcp.TCPServer): def __init__( self, addr, ssloptions=None, craftanchor="/p/", staticdir=None, anchors=None, sizelimit=None, noweb=False, nocraft=False, noapi=False, nohang=False, - timeout=None, logreq=False, logresp=False, hexdump=False + timeout=None, logreq=False, logresp=False, explain=False, hexdump=False ): """ addr: (address, port) tuple. If port is 0, a free port will be @@ -192,6 +195,7 @@ class Pathod(tcp.TCPServer): self.sizelimit = sizelimit self.noweb, self.nocraft, self.noapi, self.nohang = noweb, nocraft, noapi, nohang self.timeout, self.logreq, self.logresp, self.hexdump = timeout, logreq, logresp, hexdump + self.explain = explain if not noapi: app.api() |