diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-10-25 16:43:01 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-10-25 16:43:01 +1300 |
commit | ac4e9f8cb5a9541dcff0a86efdb04357b9bc027f (patch) | |
tree | f9672c297ea7afc3ca383f4b7e91136679856dc4 /libpathod/cmdline.py | |
parent | 384abbfdd5830467e4876ea164a49433084132ee (diff) | |
download | mitmproxy-ac4e9f8cb5a9541dcff0a86efdb04357b9bc027f.tar.gz mitmproxy-ac4e9f8cb5a9541dcff0a86efdb04357b9bc027f.tar.bz2 mitmproxy-ac4e9f8cb5a9541dcff0a86efdb04357b9bc027f.zip |
Rationalize pathoc arguments, add -r flag to randomly select a request from the provided specs
Diffstat (limited to 'libpathod/cmdline.py')
-rw-r--r-- | libpathod/cmdline.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libpathod/cmdline.py b/libpathod/cmdline.py index 3b1a86bf..a21fa218 100644 --- a/libpathod/cmdline.py +++ b/libpathod/cmdline.py @@ -36,7 +36,14 @@ def go_pathoc(): ) parser.add_argument( "-n", dest='repeat', default=1, type=int, metavar="N", - help='Repeat requests N times' + help='Repeat N times' + ) + parser.add_argument( + "-r", dest="random", action="store_true", default=False, + help=""" + Select a random request from those specified. If this is not specified, + requests are all played in sequence. + """ ) parser.add_argument( "-t", dest="timeout", type=int, default=None, @@ -48,7 +55,7 @@ def go_pathoc(): help='Host and port to connect to' ) parser.add_argument( - 'request', type=str, nargs="+", + 'requests', type=str, nargs="+", help=""" Request specification, or path to a file containing request specifcations @@ -110,7 +117,7 @@ def go_pathoc(): help="Print full request" ) group.add_argument( - "-r", dest="showresp", action="store_true", default=False, + "-p", dest="showresp", action="store_true", default=False, help="Print full response" ) group.add_argument( @@ -155,7 +162,7 @@ def go_pathoc(): args.connect_to = None reqs = [] - for r in args.request: + for r in args.requests: if os.path.exists(r): data = open(r).read() r = data @@ -165,7 +172,7 @@ def go_pathoc(): print >> sys.stderr, "Error parsing request spec: %s"%v.msg print >> sys.stderr, v.marked() sys.exit(1) - args.request = reqs + args.requests = reqs pathoc.main(args) |