From 9927ebad3e026b8c080a50759234c88489fe84c7 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 12 Mar 2011 13:49:54 +1300 Subject: [PATCH] Make mitmproxy handle invalid flow data gracefully. --- mitmproxy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mitmproxy b/mitmproxy index 0b0cd336e..f65386d9a 100755 --- a/mitmproxy +++ b/mitmproxy @@ -16,7 +16,7 @@ # along with this program. If not, see . import sys, os.path -from libmproxy import proxy, controller, console, utils +from libmproxy import proxy, controller, console, utils, flow from libmproxy.version import VERSION from optparse import OptionParser, OptionGroup @@ -79,7 +79,12 @@ if __name__ == '__main__': m = console.ConsoleMaster(server, options) for i in args: - m.load_flows(i) + try: + m.load_flows(i) + except flow.FlowReadError, v: + print >> sys.stderr, "mitmproxy:", v.args[0] + sys.exit(1) + m.run()