Skip to content

Commit

Permalink
Merge pull request #105 from christofferqa/mitmproxy_v0.18
Browse files Browse the repository at this point in the history
Handle mitmproxy API changes
  • Loading branch information
ksen007 authored Sep 14, 2016
2 parents 4af5a6e + 45c7a18 commit 423e6fd
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions scripts/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,15 @@ def processFile (flow, content, ext):
print(''.join(lines))
return content

if mitmversion >= 0.18:
def start():
_start(sys.argv)
else:
def start(context, argv):
_start(argv)

# Example usage: "proxy.py --no-cache --ignore http://cdn.com/jalangi --inlineIID --inlineSource --noResultsGUI --analysis ..."
def start(context, argv):
def _start(argv):
global jalangiArgs
global useCache

Expand All @@ -85,8 +92,16 @@ def mapper(p):
return path if not p.startswith('--') and (os.path.isfile(path) or os.path.isdir(path)) else p
jalangiArgs = ' '.join(map(mapper, [x for x in argv[1:]]))

@concurrent
def response(context, flow):
if (mitmversion >= 0.18):
@concurrent
def response(flow):
_response(flow)
else:
@concurrent
def response(context, flow):
_response(flow)

def _response(flow):
# Do not invoke jalangi if the domain is ignored
for path in ignore:
if flow.request.url.startswith(path):
Expand Down

0 comments on commit 423e6fd

Please sign in to comment.