Code Monkey home page Code Monkey logo

docker-releases's Introduction

mitmproxy

Continuous Integration Status Codacy Badge autofix.ci: enabled Coverage Status Latest Version Supported Python versions

mitmproxy is an interactive, SSL/TLS-capable intercepting proxy with a console interface for HTTP/1, HTTP/2, and WebSockets.

mitmdump is the command-line version of mitmproxy. Think tcpdump for HTTP.

mitmweb is a web-based interface for mitmproxy.

Installation

The installation instructions are here. If you want to install from source, see CONTRIBUTING.md.

Documentation & Help

General information, tutorials, and precompiled binaries can be found on the mitmproxy website.

mitmproxy.org

The documentation for mitmproxy is available on our website:

mitmproxy documentation stable mitmproxy documentation dev

If you have questions on how to use mitmproxy, please use GitHub Discussions!

mitmproxy discussions

Contributing

As an open source project, mitmproxy welcomes contributions of all forms.

Dev Guide

docker-releases's People

Contributors

dweinstein avatar kriechi avatar mapitman avatar maxcnunes avatar mhils avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-releases's Issues

Can't export flow neither to clipboard or file

I believe this is because of container permissions.

Steps to reproduce:

  1. start MITM on docker:
docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 9999:8080 mitmproxy/mitmproxy
  1. Send any request to your proxy.

  2. hit Shift + C to call the export menu, then for instance, hit r to export as curl . You'll get the message:
    Cannot copy data to clipboard. Save as file? (yes, no)

  3. hit y and enter any filename. You'll get: permission denied

Potential Issue with Console width?

I am unable to get the latest docker image to start. I get the error below.

I am running this through portainer, docker version is 17.12.0-ce-mac55 ( 23011 ).

Stepping back in mitm build versions,

3.0.0 breaks and each version up until latest shows the same issue.
2.0.1 works without issue

I'm not sure what other information is needed.

/usr/lib/python3.6/site-packages/mitmproxy/tools/console/commands.py", line 119, in widget

id.Text(i) for i in textwrap.wrap(txt, cols)]

/usr/lib/python3.6/textwrap.py", line 379, in wrap

rn w.wrap(text)

/usr/lib/python3.6/textwrap.py", line 354, in wrap

rn self._wrap_chunks(chunks)

/usr/lib/python3.6/textwrap.py", line 248, in _wrap_chunks

e ValueError("invalid width %r (must be > 0)" % self.width)

or: invalid width 0 (must be > 0)

k (most recent call last):

/usr/bin/mitmproxy", line 11, in <module>

exit(mitmproxy())

/usr/lib/python3.6/site-packages/mitmproxy/tools/main.py", line 142, in mitmproxy

console.master.ConsoleMaster, cmdline.mitmproxy, args)

/usr/lib/python3.6/site-packages/mitmproxy/tools/main.py", line 124, in run

er.run()

/usr/lib/python3.6/site-packages/mitmproxy/tools/console/master.py", line 211, in run

.window = window.Window(self)

/usr/lib/python3.6/site-packages/mitmproxy/tools/console/window.py", line 149, in __init__

owStack(master, "flowlist"),

/usr/lib/python3.6/site-packages/mitmproxy/tools/console/window.py", line 57, in __init__

ands = commands.Commands(master),

/usr/lib/python3.6/site-packages/mitmproxy/tools/console/commands.py", line 131, in __init__

 CommandHelp(master)

/usr/lib/python3.6/site-packages/mitmproxy/tools/console/commands.py", line 107, in __init__

r().__init__(self.widget(""))

/usr/lib/python3.6/site-packages/mitmproxy/tools/console/commands.py", line 119, in widget

id.Text(i) for i in textwrap.wrap(txt, cols)]

/usr/lib/python3.6/textwrap.py", line 379, in wrap

rn w.wrap(text)

/usr/lib/python3.6/textwrap.py", line 354, in wrap

rn self._wrap_chunks(chunks)

/usr/lib/python3.6/textwrap.py", line 248, in _wrap_chunks

e ValueError("invalid width %r (must be > 0)" % self.width)

or: invalid width 0 (must be > 0)

mitmweb

Dear Team !

I can start mitmweb by running this command
docker run -d -it -p 8081:8081 -p 8080:8080 mitm mitmweb

But I can not open web interface , because It looks like that mitmweb only listening localhost 127.0.0.1

Is there any way to open web interface from anywhere ( not local )

Mitmweb Process Only Listens to Localhost

Hi, I'm trying to run mitmproxy and mitmweb via docker, but I found out that mitmweb only listens on localhost inside the container. This makes it imposible to forward the traffic via docker proxy using this command:

$ docker run --rm -it -p 8080:8080 -p 127.0.0.1:8081:8081 mitmproxy/mitmproxy mitmweb

when run docker run with external volume, got chown error.

When I run docker-run command as below:
docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 8080:8080 mitmproxy/mitmproxy
I got this error:

chown: /home/mitmproxy/.mitmproxy: Permission denied

I use a non-root user to run this, but seems sudo is also not working.
BTW, the host ~/.mitmproxy is generated with mitmproxy command with ca files in it like below:

-rw-r--r--. 1 user user 1.3K Feb 3 14:06 mitmproxy-ca-cert.cer
-rw-r--r--. 1 user user 2.5K Feb 3 14:06 mitmproxy-ca-cert.p12
-rw-r--r--. 1 user user 1.3K Feb 3 14:06 mitmproxy-ca-cert.pem
-rw-r--r--. 1 user user 3.0K Feb 3 14:06 mitmproxy-ca.pem
-rw-r--r--. 1 user user 770 Feb 3 14:06 mitmproxy-dhparam.pem

setup question: mitmproxy between hosts file and another proxy

Hello, I am trying to implement the following setup, but I am not sure if this is possible with docker. And if it possible in what mode should I start the mitmproxy?

So in my host machine I add the following line to hosts file

127.0.0.1 static.local

I start mitmproxy dockerized with -p 80:8080 -R http://127.0.0.1:1080
I start an nginx proxy dockerized with -p 1080:80 that forwards the requests depending on their host name

If you try to open http://static.local:1080/ the request goes directly to the nginx proxy and is forwarded further on correctly.

But if you try to open http://static.local/, the request sent from mitmproxy arrives to nginx proxy as http://127.0.0.1:1080/ which the nginx proxy can not forward correctly due to missing host name.

If I run mitmproxy in transparent mode (even with cap_add: - NET_ADMIN) it is getting into an infinite loop.
If I run mitmproxy in regular mode or in upstream mode (-U http://127.0.0.1:1080) and I get

HttpException('Invalid HTTP request form (expected: authority or absolute, got: relative)',)

Also all of the above setups, with the use of FoxyProxy plugin instead of hosts file - work.

I can also provide a docker-compose.yml

Docker missing the ability to set an upstream proxy

Run any mitmproxy docker container in a corporate environment where there is a real proxy server.

docker run --rm -p 8081:8080 -v $(pwd):/root/.mitmproxy -ti mitmproxy/mitmproxy
(Obviously this wont work because there is no way to set the -U argument

The documentation of mitmproxy clearly shows support for an upstream proxy
http://docs.mitmproxy.org/en/stable/features/upstreamproxy.html

This option is critical in a corporate environment and needs to be exposed

You need to allow an environment entry to the docker run command
https://github.com/mitmproxy/docker-releases/blob/master/alpine/docker-entrypoint.sh
su-exec mitmproxy "$@" -U http://myproxy.bloomberg.com:8080

I currently worked around the issue by --entrypoint ash and manually changing the docker-entrypoint.sh file

starting errors

Tried to start mitmproxy from docker-compose.yml:

  mitmproxy:
    image: mitmproxy/mitmproxy
    ports:
      - "8080:8080"
    volumes:
       - ./storage/mitmproxy/.mitmproxy:/home/mitmproxy/.mitmproxy

the result was:

$ docker-compose up mitmproxy
Pulling mitmproxy (mitmproxy/mitmproxy:latest)...
latest: Pulling from mitmproxy/mitmproxy
019300c8a437: Pull complete
b6f2ab2e0e43: Pull complete
a62f1b73f579: Pull complete
d24c6724c3ed: Pull complete
Digest: sha256:6a38773c1dc2d0751e6ac0a73148e59030ebc143a47a20904966ecf3de3b2860
Status: Downloaded newer image for mitmproxy/mitmproxy:latest
Creating rxsymfonydev_mitmproxy_1
Attaching to rxsymfonydev_mitmproxy_1
mitmproxy_1  | Traceback (most recent call last):
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/mitmproxy/tools/console/master.py", line 281, in run
mitmproxy_1  |     self.loop.run()
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 278, in run
mitmproxy_1  |     self._run()
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 376, in _run
mitmproxy_1  |     self.event_loop.run()
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 682, in run
mitmproxy_1  |     self._loop()
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 719, in _loop
mitmproxy_1  |     self._watch_files[fd]()
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/raw_display.py", line 393, in <lambda>
mitmproxy_1  |     event_loop, callback, self.get_available_raw_input())
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/raw_display.py", line 427, in get_available_raw_input
mitmproxy_1  |     codes = self._get_gpm_codes() + self._get_keyboard_codes()
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/raw_display.py", line 501, in _get_keyboard_codes
mitmproxy_1  |     code = self._getch_nodelay()
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/raw_display.py", line 635, in _getch_nodelay
mitmproxy_1  |     return self._getch(0)
mitmproxy_1  |   File "/usr/lib/python3.5/site-packages/urwid/raw_display.py", line 545, in _getch
mitmproxy_1  |     return ord(os.read(self._term_input_file.fileno(), 1))
mitmproxy_1  | TypeError: ord() expected a character, but string of length 0 found
mitmproxy_1  | 
mitmproxy_1  | mitmproxy has crashed!
mitmproxy_1  | Please lodge a bug report at:
mitmproxy_1  |  https://github.com/mitmproxy/mitmproxy
mitmproxy_1  | Shutting down...
rxsymfonydev_mitmproxy_1 exited with code 0

... any suggestions?

Permission denied: '/home/mitmproxy/.mitmproxy/mitmproxy-ca.pem'

I'm trying to run mitmproxy with the following command:

docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 8080:8080 mitmproxy/releases

This is the output I get:

Traceback (most recent call last):
  File "/usr/bin/mitmproxy", line 11, in <module>
    sys.exit(mitmproxy())
  File "/usr/lib/python2.7/site-packages/mitmproxy/main.py", line 56, in mitmproxy
    proxy_config = process_proxy_options(parser, options)
  File "/usr/lib/python2.7/site-packages/mitmproxy/proxy/config.py", line 229, in process_proxy_options
    add_upstream_certs_to_client_chain=options.add_upstream_certs_to_client_chain,
  File "/usr/lib/python2.7/site-packages/mitmproxy/proxy/config.py", line 100, in __init__
    CONF_BASENAME
  File "/usr/lib/python2.7/site-packages/netlib/certutils.py", line 209, in from_store
    key, ca = cls.create_store(path, basename)
  File "/usr/lib/python2.7/site-packages/netlib/certutils.py", line 233, in create_store
    with open(os.path.join(path, basename + "-ca.pem"), "wb") as f:
IOError: [Errno 13] Permission denied: '/home/mitmproxy/.mitmproxy/mitmproxy-ca.pem'

How can I fix it? :)

Error 502 when connecting to a site with self-signed certificates

When connecting to a site with a self-signed certificate mitmproxy issues a 502 Bad Gateway error. The connection cannot be established.

A web search suggested parameters and configuration options like --verify-upstream-cert, --insecure, and ssl_insecure, as well as a config.yaml. But none of them seem to be documented in a way such that it could be used with the docker image.

want to modify the image to run bash get errors

run docker exec -it elated_borg bash

the errors message is rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"bash\": executable file not found in $PATH"

docker-entrypoint.sh execution flag is lacking

I get the following error message :

# docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy
exec: "docker-entrypoint.sh": executable file not found in $PATH

This is because when building the image from the Dockerfile, the file permissions of docker-entrypoint.sh in the image are just copied from the ones of the entrypoint file extracted from the git repository, and the permissions of this file in the git repository does not contain the executable flag :
# git log --summary docker-entrypoint.sh | grep mode
create mode 100644 alpine/docker-entrypoint.sh
It should contain 755, not 644.

To get the image working, just add the following line in the Dockerfile :
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
Add this line just after the line "COPY docker-entrypoint.sh /usr/local/bin/".

You can also change the mode of docker-entrypoint.sh in the git repository.

Sincerely

Cannot establish TLS with client (sni: beacons5.gvt3.com): TlsException("(-1, 'Unexpected EOF')",)

Hello,

Using the mitmproxy docker container and using a specific application I get these unexpected EOF.
The unfortunate part is I don't have control of the application.
I have imported the certificate and can browse with common browsers.
I can use wget and get the same link that I need to work.

Furthermore I redirect a stream to a server and I see the process complete successfully on that server. So I know that the client request hits mitm, sends the right data then mitm reaches out to the server pulls the data gets a 200 then the application or something pukes on the return trip. It is possible that the returned data is malformed but wget works fine and returned data is not malformed.

I installed it with this.
sudo docker pull mitmproxy/mitmproxy

I have run it many ways finally ending up with:
sudo docker -D run -v /home/ec2-user/gdev/misc-scripts/mitmproxy:/scripts -p 48080:8080 mitmproxy/mitmproxy mitmdump --ssl-version-client TLSv1_2 --ssl-version-server TLSv1_2 --insecure --anticache -s /scripts/httpproxy.py

The httpproxy.py looks for a every specific thing. So for the most part it rarely fires.

    if not flow.request.url[-3:] == 'qvt':
        return
    else:
        debug = True
    resp = str(flow.response.content, 'utf-8')
    data = json.loads(resp) etc...

Here are the errors I see.
174.52.2.243:51503: CONNECT beacons5.gvt3.com:443
<< Cannot establish TLS with client (sni: beacons5.gvt3.com): TlsException("(-1, 'Unexpected EOF')",)
174.52.2.243:51503: clientdisconnect
174.52.2.243:51508: clientconnect
174.52.2.243:51508: CONNECT clients4.google.com:443
<< Cannot establish TLS with client (sni: clients4.google.com): TlsException("(-1, 'Unexpected EOF')",)
174.52.2.243:51508: clientdisconnect
174.52.2.243:51509: clientconnect
174.52.2.243:51509: CONNECT discourse.mitmproxy.org:443
<< Cannot establish TLS with client (sni: discourse.mitmproxy.org): TlsException("(-1, 'Unexpected EOF')",)

I have attached a pcap with what I think is the client and server side of the failed connection if it helps.
brokensession.zip

Any help or suggestions would be appreciated the only thing I can find on the internet with the same error referenced openssl and was specific to safari.

Create tagged image for 0.18.2

Can you please create a tagged image for version 0.18.2.

It should be as simple as creating as changing the alpine/requirements.txt file to:

mitmproxy==0.18.2

Crash on Startup

I assume this is a lack of understanding from my end however I can't work out what I'm not doing/doing wrong.

I built and ran a container without any attached volume, that worked fine and if I hit http://mitm.it/ I get the install cert page which is fine.

I then tried attaching a volume without anything in. This created some certificates and then crashes. The stack trace is below with a screenshot of what was created and my docker-compose file.

I've also tried this with having common.conf mitmdump.conf and mitmproxy.conf files in the attached volume but that doesn't seem to make things better.

Any help would be much appreciated (This might be a bug in mitmproxy itself, my knowledge of mitmproxy is currently rather limited).

Cheers
Steve

$ docker-compose build ; docker-compose up
mitmproxy uses an image, skipping
Starting c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1
Attaching to c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 | Traceback (most recent call last):
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/mitmproxy/console/__init__.py", line 512, in run
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     self.loop.run()
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 278, in run
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     self._run()
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 376, in _run
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     self.event_loop.run()
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 682, in run
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     self._loop()
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 719, in _loop
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     self._watch_files[fd]()
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/raw_display.py", line 393, in <lambda>
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     event_loop, callback, self.get_available_raw_input())
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/raw_display.py", line 427, in get_available_raw_input
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     codes = self._get_gpm_codes() + self._get_keyboard_codes()
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/raw_display.py", line 501, in _get_keyboard_codes
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     code = self._getch_nodelay()
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/raw_display.py", line 635, in _getch_nodelay
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     return self._getch(0)
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |   File "/usr/lib/python2.7/site-packages/urwid/raw_display.py", line 545, in _getch
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |     return ord(os.read(self._term_input_file.fileno(), 1))
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 | TypeError: ord() expected a character, but string of length 0 found
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 | 
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 | mitmproxy has crashed!
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 | Please lodge a bug report at:
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 |      https://github.com/mitmproxy/mitmproxy
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 | Shutting down...
c5a7996c5cd3_c5a7996c5cd3_clientscripttester_mitmproxy_1 exited with code 0

screen shot 2016-06-21 at 09 43 00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.