diff options
Diffstat (limited to 'libmproxy')
| -rw-r--r-- | libmproxy/cmdline.py | 6 | ||||
| -rw-r--r-- | libmproxy/dump.py | 14 | 
2 files changed, 20 insertions, 0 deletions
diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index f4d0e430..5f51b854 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -19,6 +19,7 @@ def get_common_options(options):          anticomp = options.anticomp,          autodecode = options.autodecode,          client_replay = options.client_replay, +        eventlog = options.eventlog,          kill = options.kill,          no_server = options.no_server,          refresh_server_playback = not options.norefresh, @@ -46,6 +47,11 @@ def common_options(parser):          help="Automatically decode compressed server responses."      )      parser.add_option( +        "-e", +        action="store_true", dest="eventlog", +        help="Show event log." +    ) +    parser.add_option(          "--confdir",          action="store", type = "str", dest="confdir", default='~/.mitmproxy',          help = "Configuration directory. (~/.mitmproxy)" diff --git a/libmproxy/dump.py b/libmproxy/dump.py index e547d78d..75628631 100644 --- a/libmproxy/dump.py +++ b/libmproxy/dump.py @@ -10,6 +10,7 @@ class Options(object):          "anticomp",          "autodecode",          "client_replay", +        "eventlog",          "keepserving",          "kill",          "no_server", @@ -58,6 +59,7 @@ class DumpMaster(flow.FlowMaster):          self.anticache = options.anticache          self.anticomp = options.anticomp          self.autodecode = options.autodecode +        self.eventlog = options.eventlog          self.refresh_server_playback = options.refresh_server_playback          if filtstr: @@ -130,8 +132,20 @@ class DumpMaster(flow.FlowMaster):                      "%s: %s\n%s"%(script, e.args[0], eout)                  ) +    def handle_clientconnect(self, c): +        if self.eventlog: +            print >> self.outfile, "Connection from: %s:%s"%c.address +        return flow.FlowMaster.handle_clientconnect(self, c) + +    def handle_clientdisconnect(self, c): +        if self.eventlog: +            print >> self.outfile, "Disconnect from: %s:%s"%c.client_conn.address +        return flow.FlowMaster.handle_clientconnect(self, c) +      def handle_request(self, r):          f = flow.FlowMaster.handle_request(self, r) +        if self.eventlog: +            print >> self.outfile, "Request: %s"%str_request(r)          if f:              r.ack()          return f  | 
