aboutsummaryrefslogtreecommitdiffstats
path: root/pathoc
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-11-16 11:31:04 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-11-16 13:46:42 +1300
commitef9cbe3b25face06f941a9f92aac5c79821e83bf (patch)
treebc744521b2c66d15cb8febd19632fde3cb4281ec /pathoc
parent5d18830f7169fcacac2d23b349a82502bd4171b4 (diff)
downloadmitmproxy-ef9cbe3b25face06f941a9f92aac5c79821e83bf.tar.gz
mitmproxy-ef9cbe3b25face06f941a9f92aac5c79821e83bf.tar.bz2
mitmproxy-ef9cbe3b25face06f941a9f92aac5c79821e83bf.zip
Add u User-agent shortcut.
Usage: 200:ua - Shortcut "a" for Android. 200:u"foo" - Or a value literal Shortcuts can be listed using the --show-uas argument to pathoc.
Diffstat (limited to 'pathoc')
-rwxr-xr-xpathoc19
1 files changed, 16 insertions, 3 deletions
diff --git a/pathoc b/pathoc
index 96cb9f0a..1d3f6004 100755
--- a/pathoc
+++ b/pathoc
@@ -1,10 +1,22 @@
#!/usr/bin/env python
import argparse, sys
from libpathod import pathoc, version, language
-from netlib import tcp
+from netlib import tcp, http_uastrings
if __name__ == "__main__":
- parser = argparse.ArgumentParser(description='A perverse HTTP client.')
+ preparser = argparse.ArgumentParser(add_help=False)
+ preparser.add_argument(
+ "--show-uas", dest="showua", action="store_true", default=False,
+ help="Print user agent shortcuts and exit."
+ )
+ pa = preparser.parse_known_args()[0]
+ if pa.showua:
+ print "User agent strings:"
+ for i in http_uastrings.UASTRINGS:
+ print " ", i[1], i[0]
+ sys.exit(0)
+
+ parser = argparse.ArgumentParser(description='A perverse HTTP client.', parents=[preparser])
parser.add_argument(
"-i", dest="sni", type=str, default=False,
help="SSL Server Name Indication"
@@ -33,8 +45,9 @@ if __name__ == "__main__":
'request', type=str, nargs="+",
help='Request specification'
)
+
group = parser.add_argument_group(
- 'Controlling Output',
+ 'Controlling Output',
"""
Some of these options expand generated values for logging - if
you're generating large data, use them with caution.