question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't Set HTTP Proxy

See original GitHub issue
Steps to reproduce the problem:
  1. Open in console mitmproxy to show options like : mitmproxy --options
  2. There is an option upstream_bind_address
  3. But when I try to set it up , I get error as :
    mitmproxy: error: unrecognized arguments: --upstream_bind_address

In the screenshot below.

mitmproxy: error: unrecognized arguments: --upstream_bind_address

What I am trying to do

My college uses a proxy and so was trying to route my traffic through that, I have a proxy authentication and was trying to set it up

Also Another Issue I think worth mentioning

When using help in terminal mitmproxy --help I get this output :

(venv) root@Dell-PC:~/mitmproxy# mitmproxy --help
usage: mitmproxy [options] [filter]

positional arguments:
  filter_args           Filter view expression, used to only show flows that
                        match a certain filter. See help in mitmproxy for
                        filter expression syntax.

optional arguments:
  -h, --help            show this help message and exit
  --version
  --shortversion        show program's short version number and exit
  --options             Show all options and their default values
  --conf PATH           Read options from a configuration file
  --set option[=value]  Set an option. When the value is omitted, booleans are
                        set to true, strings and integers are set to None (if
                        permitted), and sequences are emptied.
  -q, --quiet           Quiet.
  -v, --verbose         Increase log verbosity.
  --mode MODE, -m MODE  Mode can be "regular", "transparent", "socks5",
                        "reverse:SPEC", or "upstream:SPEC". For reverse and
                        upstream proxy modes, SPEC is proxy specification in
                        the form of "http[s]://host[:port]".
  --no-anticache
  --anticache           Strip out request headers that might cause the server
                        to return 304-not-modified.
  --no-showhost
  --showhost            Use the Host header to construct URLs for display.
  --rfile PATH, -r PATH
                        Read flows from file.
  --scripts SCRIPT, -s SCRIPT
                        Execute a script. May be passed multiple times.
  --stickycookie FILTER
                        Set sticky cookie filter. Matched against requests.
  --stickyauth FILTER   Set sticky auth filter. Matched against requests.
  --streamfile PATH, -w PATH
                        Write flows to file. Prefix path with + to append.
  --no-anticomp
  --anticomp            Try to convince servers to send us un-compressed data.
  --flow-detail LEVEL   Flow detail display level.

Proxy Options:
  --listen-host HOST    Address to bind proxy to.
  --listen-port PORT, -p PORT
                        Proxy service port.
  --no-server, -n
  --server              Start a proxy server.
  --ignore-hosts HOST   Ignore host and forward all traffic without processing
                        it. In transparent mode, it is recommended to use an
                        IP address (range), not the hostname. In regular mode,
                        only SSL traffic is ignored and the hostname should be
                        used. The supplied value is interpreted as a regular
                        expression and matched on the ip or the hostname. May
                        be passed multiple times.
  --tcp-hosts HOST      Generic TCP SSL proxy mode for all hosts that match
                        the pattern. Similar to --ignore, but SSL connections
                        are intercepted. The communication contents are
                        printed to the log in verbose mode. May be passed
                        multiple times.
  --upstream-auth USER:PASS
                        Add HTTP Basic authentcation to upstream proxy and
                        reverse proxy requests. Format: username:password.
  --proxyauth SPEC      Require authentication before proxying requests. If
                        the value is "any", we prompt for authentication, but
                        permit any values. If it starts with an "@", it is
                        treated as a path to an Apache htpasswd file. If its
                        is of the form "username:password", it is treated as a
                        single-user credential.
  --no-rawtcp
  --rawtcp              Enable/disable experimental raw TCP support. Disabled
                        by default.

SSL:
  --certs SPEC          SSL certificates. SPEC is of the form "[domain=]path".
                        The domain may include a wildcard, and is equal to "*"
                        if not specified. The file at path is a certificate in
                        PEM format. If a private key is included in the PEM,
                        it is used, else the default key in the conf dir is
                        used. The PEM file should contain the full certificate
                        chain, with the leaf certificate as the first entry.
                        Can be passed multiple times. May be passed multiple
                        times.
  --no-ssl-insecure
  --ssl-insecure, -k    Do not verify upstream server SSL/TLS certificates.

Client Replay:
  --client-replay PATH, -C PATH
                        Replay client requests from a saved file. May be
                        passed multiple times.

Server Replay:
  --server-replay PATH, -S PATH
                        Replay server responses from a saved file. May be
                        passed multiple times.
  --no-replay-kill-extra
  --replay-kill-extra   Kill extra requests during replay.
  --no-server-replay-nopop
  --server-replay-nopop
                        Disable response pop from response flow. This makes it
                        possible to replay same response multiple times.

Replacements:
  --replacements PATTERN, -R PATTERN
                        Replacement patterns of the form
                        "/pattern/regex/replacement", where the separator can
                        be any character. May be passed multiple times.

Set Headers:
  --setheaders PATTERN, -H PATTERN
                        Header set pattern of the form
                        "/pattern/header/value", where the separator can be
                        any character. May be passed multiple times.
(venv) root@Dell-PC:~/mitmproxy# 

There is an option of --upstream-auth but no upstream_proxy_address , which made me wonder and find out the first issue.

System information

Mitmproxy version: 3.0.0 (2.0.0dev0201-0x253fa950) Python version: 3.5.3 Platform: Linux-4.6.0-kali1-amd64-x86_64-with-Kali-kali-rolling-kali-rolling SSL version: OpenSSL 1.1.0e 16 Feb 2017 Linux distro: Kali kali-rolling kali-rolling

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
LuD1161commented, Mar 18, 2017

@krsoninikhil Finally got it working Using this :

mitmproxy --set mode=upstream:http://172.31.1.5:8080 upstream_auth=user:pass --set ssl_insecure=True (edited)

0reactions
LuD1161commented, Mar 17, 2017

@krsoninikhil Yes that too didn’t work.

My mitmproxy --version output

(venv) root@Dell-PC:~/mitmproxy# mitmproxy --version
Mitmproxy version: 3.0.0 (2.0.0dev0203-0xc0882496) 
Python version: 3.5.3
Platform: Linux-4.6.0-kali1-amd64-x86_64-with-Kali-kali-rolling-kali-rolling
SSL version: OpenSSL 1.1.0e  16 Feb 2017
Linux distro: Kali kali-rolling kali-rolling
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Unable to Connect to the Proxy Server | VSS Guide
Go to settings of your windows 10 operating system · On the search bar, type proxy and hit enter. · This will take...
Read more >
Cannot change the manual proxy setting in Windows 10
Cannot change the manual proxy setting in Windows 10 · Press Windows · Type in regedit and click OK. · Follow this folder...
Read more >
Fix For Unable to Connect to Proxy Server Error In Windows 10
Unable to connect to Proxy Server error in Windows 10 can also be caused by change in internet settings. 1. Right-click on the...
Read more >
set http_proxy not working on windows - Stack Overflow
connection timed out. So I tried to set http_proxy and https_proxy by : set http_proxy = http://proxy:port set https_proxy = https://proxy:port.
Read more >
I can't use HTTP Proxy in the shell - Ask Ubuntu
Set http_proxy shell variable. Type the following command to set proxy server: $ export http_proxy=http://server-ip:port/ $ export ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found