From 4e17b00ce8b5dc9cdac8d2fae8ef925a7c857fa4 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 13 Mar 2014 23:43:26 +0100 Subject: order command line options, add disting proxy option group --- libmproxy/cmdline.py | 129 ++++++++++++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 64 deletions(-) (limited to 'libmproxy/cmdline.py') diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index d933ba4b..ed3a8f6b 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -180,11 +180,6 @@ def get_common_options(options): def common_options(parser): - parser.add_argument( - "-b", - action="store", type = str, dest="addr", default='', - help = "Address to bind proxy to (defaults to all interfaces)" - ) parser.add_argument( "--anticache", action="store_true", dest="anticache", default=False, @@ -196,57 +191,10 @@ def common_options(parser): help = "Configuration directory. (~/.mitmproxy)" ) parser.add_argument( - "-n", - action="store_true", dest="no_server", - help="Don't start a proxy server." - ) - parser.add_argument( - "-p", - action="store", type = int, dest="port", default=8080, - help = "Proxy service port." - ) - # We could make a mutually exclusive group out of -R, -F, -T, but we don't do that because - # - --upstream-server should be in that group as well, but it's already in a different group. - # - our own error messages are more helpful - parser.add_argument( - "-R", - action="store", type=parse_server_spec, dest="reverse_proxy", default=None, - help="Reverse proxy to upstream server: http[s]://host[:port]" - ) - parser.add_argument( - "-F", - action="store", type=parse_server_spec, dest="forward_proxy", default=None, - help="Proxy to unconditionally forward to: http[s]://host[:port]" - ) - parser.add_argument( - "-T", - action="store_true", dest="transparent_proxy", default=False, - help="Set transparent proxy mode." - ) - - group = parser.add_argument_group( - "Advanced Proxy Options", - """ - The following options allow a custom adjustment of the proxy behavior. - Normally, you don't want to use these options directly and use the provided wrappers instead (-R, -F, -T). - """.strip() - ) - group.add_argument( - "--http-form-in", dest="http_form_in", default=None, - action="store", choices=("relative", "absolute"), - help="Override the HTTP request form accepted by the proxy" - ) - group.add_argument( - "--http-form-out", dest="http_form_out", default=None, - action="store", choices=("relative", "absolute"), - help="Override the HTTP request form sent upstream by the proxy" - ) - group.add_argument( - "--upstream-server", dest="manual_upstream_server", default=None, - action="store", type=parse_server_spec, - help="Override the destination server all requests are sent to." + "--host", + action="store_true", dest="showhost", default=False, + help="Use the Host header to construct URLs for display." ) - parser.add_argument( "-q", action="store_true", dest="quiet", @@ -295,17 +243,67 @@ def common_options(parser): help="Byte size limit of HTTP request and response bodies."\ " Understands k/m/g suffixes, i.e. 3m for 3 megabytes." ) - parser.add_argument( - "--host", - action="store_true", dest="showhost", default=False, - help="Use the Host header to construct URLs for display." + + + group = parser.add_argument_group("Proxy Options") + # We could make a mutually exclusive group out of -R, -F, -T, but we don't do that because + # - --upstream-server should be in that group as well, but it's already in a different group. + # - our own error messages are more helpful + group.add_argument( + "-b", + action="store", type = str, dest="addr", default='', + help = "Address to bind proxy to (defaults to all interfaces)" + ) + group.add_argument( + "-F", + action="store", type=parse_server_spec, dest="forward_proxy", default=None, + help="Proxy to unconditionally forward to: http[s]://host[:port]" + ) + group.add_argument( + "-n", + action="store_true", dest="no_server", + help="Don't start a proxy server." + ) + group.add_argument( + "-p", + action="store", type = int, dest="port", default=8080, + help = "Proxy service port." + ) + group.add_argument( + "-R", + action="store", type=parse_server_spec, dest="reverse_proxy", default=None, + help="Reverse proxy to upstream server: http[s]://host[:port]" + ) + group.add_argument( + "-T", + action="store_true", dest="transparent_proxy", default=False, + help="Set transparent proxy mode." ) - parser.add_argument( - "--no-upstream-cert", default=False, - action="store_true", dest="no_upstream_cert", - help="Don't connect to upstream server to look up certificate details." + + group = parser.add_argument_group( + "Advanced Proxy Options", + """ + The following options allow a custom adjustment of the proxy behavior. + Normally, you don't want to use these options directly and use the provided wrappers instead (-R, -F, -T). + """.strip() + ) + group.add_argument( + "--http-form-in", dest="http_form_in", default=None, + action="store", choices=("relative", "absolute"), + help="Override the HTTP request form accepted by the proxy" + ) + group.add_argument( + "--http-form-out", dest="http_form_out", default=None, + action="store", choices=("relative", "absolute"), + help="Override the HTTP request form sent upstream by the proxy" ) + group.add_argument( + "--upstream-server", dest="manual_upstream_server", default=None, + action="store", type=parse_server_spec, + help="Override the destination server all requests are sent to." + ) + group = parser.add_argument_group("Web App") group.add_argument( @@ -331,6 +329,7 @@ def common_options(parser): help="Serve the app outside of the proxy." ) + group = parser.add_argument_group("Client Replay") group.add_argument( "-c", @@ -368,6 +367,7 @@ def common_options(parser): "This makes it possible to replay same response multiple times." ) + group = parser.add_argument_group( "Replacements", """ @@ -434,4 +434,5 @@ def common_options(parser): help="Allow access to users specified in an Apache htpasswd file." ) - proxy.config.ssl_option_group(parser) + + proxy.config.ssl_option_group(parser) \ No newline at end of file -- cgit v1.2.3 From a66913d4a30b2ce2dedc58afcf79ad77faead278 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 14 Mar 2014 00:02:00 +0100 Subject: forward proxy -> upstream proxy --- libmproxy/cmdline.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libmproxy/cmdline.py') diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index ed3a8f6b..22db25fb 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -255,9 +255,9 @@ def common_options(parser): help = "Address to bind proxy to (defaults to all interfaces)" ) group.add_argument( - "-F", - action="store", type=parse_server_spec, dest="forward_proxy", default=None, - help="Proxy to unconditionally forward to: http[s]://host[:port]" + "-U", + action="store", type=parse_server_spec, dest="upstream_proxy", default=None, + help="Forward all requests to upstream proxy server: http[s]://host[:port]" ) group.add_argument( "-n", @@ -272,7 +272,7 @@ def common_options(parser): group.add_argument( "-R", action="store", type=parse_server_spec, dest="reverse_proxy", default=None, - help="Reverse proxy to upstream server: http[s]://host[:port]" + help="Forward all requests to upstream HTTP server: http[s][2http[s]]://host[:port]" ) group.add_argument( "-T", @@ -299,9 +299,9 @@ def common_options(parser): help="Override the HTTP request form sent upstream by the proxy" ) group.add_argument( - "--upstream-server", dest="manual_upstream_server", default=None, + "--destination-server", dest="manual_destination_server", default=None, action="store", type=parse_server_spec, - help="Override the destination server all requests are sent to." + help="Override the destination server all requests are sent to: http[s][2http[s]]://host[:port]" ) -- cgit v1.2.3