Commit Graph

10301 Commits

Author SHA1 Message Date
Maximilian Hils
555a2d2199
disallow bare except statements (#6017) 2023-03-26 13:57:48 +00:00
dependabot[bot]
7bf388979a
Bump docker/setup-buildx-action (#6011)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from a19c1710881d7ce3cf668865cc8459bba5b912aa to b167a89702b8b5314c104ab9d211b3dcf774f2b1.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](a19c171088...b167a89702)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-26 15:07:58 +02:00
Maximilian Hils
8c6ec5cb56
update cryptography and pyOpenSSL (#6012) 2023-03-26 15:07:38 +02:00
dependabot[bot]
5c4c665bb2
Bump install-pinned/autoflake (#6010)
Bumps [install-pinned/autoflake](https://github.com/install-pinned/autoflake) from dfa39c5f136f5b885c175734a719dc6ad1f11fc7 to 80957f084eab3ad54adf35d689a3f0af436cbe0a.
- [Release notes](https://github.com/install-pinned/autoflake/releases)
- [Commits](dfa39c5f13...80957f084e)

---
updated-dependencies:
- dependency-name: install-pinned/autoflake
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-24 18:03:19 +00:00
dependabot[bot]
dffe070d37
Bump install-pinned/black (#6009)
Bumps [install-pinned/black](https://github.com/install-pinned/black) from eb57934f28e8d533bbcb4caa88d00b613b6ddd00 to 44aa4e4ccf77b6e312ba570f6774484ea6ef9007.
- [Release notes](https://github.com/install-pinned/black/releases)
- [Commits](eb57934f28...44aa4e4ccf)

---
updated-dependencies:
- dependency-name: install-pinned/black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-24 17:55:28 +00:00
ZzZombo
33a81a0ead
Fixed typo in __init__.py (#6008) 2023-03-24 11:25:36 +00:00
Alexander Prinzhorn
8e7564e995
Add a prettier npm script (#5986)
* Add a prettier npm script

* Linting -> Formatting
2023-03-13 12:26:30 +01:00
Alex Gershberg
8f13293771
Add prettier to mitmweb (#5985)
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-03-12 17:50:15 +01:00
Maximilian Hils
884fd60e26
fix #5972 (#5982) 2023-03-09 15:48:26 +00:00
Maximilian Hils
2b10e3f3a7
cleanups and mypy 1.1.1 fixes (#5977) 2023-03-08 12:14:12 +00:00
Maximilian Hils
c7de03bc36
Merge pull request #5967 from mhils/better-nextlayer
Update next layer detection, add option to block HTTP/3.
2023-03-05 23:38:56 +01:00
Maximilian Hils
ed740e72bf fix Python 3.10 compat 2023-03-05 23:33:03 +01:00
Maximilian Hils
aa61f70b53 update CHANGELOG 2023-03-05 19:55:24 +01:00
Maximilian Hils
f9d808562d add option to disable HTTP/3 2023-03-05 19:55:24 +01:00
Maximilian Hils
edb85d4af1 refactor NextLayer addon 2023-03-05 19:55:24 +01:00
Maximilian Hils
524adbf950 Revert "add MaybeClientTLSLayer"
This reverts commit e7b0e3f351686c2ef5f1daa13365216b775eefb3.
2023-03-05 19:55:24 +01:00
Maximilian Hils
0583e8e46c add MaybeClientTLSLayer 2023-03-05 19:55:24 +01:00
Maximilian Hils
262cadab75 is_[d]tls_record -> starts_like_[d]tls_record 2023-03-05 19:55:24 +01:00
dependabot[bot]
6054d31665
Bump install-pinned/pyupgrade (#5957)
Bumps [install-pinned/pyupgrade](https://github.com/install-pinned/pyupgrade) from 28e8d2633f6f1a03d5b4709682ce155a66324e6a to af7d65f31bddb01097a24da6c8fb694441f51cba.
- [Release notes](https://github.com/install-pinned/pyupgrade/releases)
- [Commits](28e8d2633f...af7d65f31b)

---
updated-dependencies:
- dependency-name: install-pinned/pyupgrade
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:50:06 +01:00
dependabot[bot]
71d35e18fe
Bump install-pinned/yesqa (#5958)
Bumps [install-pinned/yesqa](https://github.com/install-pinned/yesqa) from 4896f663e9c294fddfbf5f4e4fc4f9b1a4556658 to e45b0928dd14d5c2a22695e32de8936530ba7a49.
- [Release notes](https://github.com/install-pinned/yesqa/releases)
- [Commits](4896f663e9...e45b0928dd)

---
updated-dependencies:
- dependency-name: install-pinned/yesqa
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:50:01 +01:00
dependabot[bot]
3e04379eaf
Bump install-pinned/black (#5959)
Bumps [install-pinned/black](https://github.com/install-pinned/black) from 3375665f712256be11c3212db472c3dafc217fa1 to eb57934f28e8d533bbcb4caa88d00b613b6ddd00.
- [Release notes](https://github.com/install-pinned/black/releases)
- [Commits](3375665f71...eb57934f28)

---
updated-dependencies:
- dependency-name: install-pinned/black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:49:53 +01:00
dependabot[bot]
88e0d61093
Bump docker/setup-buildx-action (#5960)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 11e8a2e2910826a92412015c515187a2d6750279 to a19c1710881d7ce3cf668865cc8459bba5b912aa.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](11e8a2e291...a19c171088)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:49:41 +01:00
dependabot[bot]
098cf89187
Bump install-pinned/reorder_python_imports (#5961)
Bumps [install-pinned/reorder_python_imports](https://github.com/install-pinned/reorder_python_imports) from 2cc264e0f6bc33907796602661e5b26d8199314d to 9766e7ba4f33497b107014571afe3b5f4c2d946b.
- [Release notes](https://github.com/install-pinned/reorder_python_imports/releases)
- [Commits](2cc264e0f6...9766e7ba4f)

---
updated-dependencies:
- dependency-name: install-pinned/reorder_python_imports
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:49:33 +01:00
dependabot[bot]
80fb8f99d2
Bump pyinstaller from 5.7.0 to 5.8.0 (#5962)
Bumps [pyinstaller](https://github.com/pyinstaller/pyinstaller) from 5.7.0 to 5.8.0.
- [Release notes](https://github.com/pyinstaller/pyinstaller/releases)
- [Changelog](https://github.com/pyinstaller/pyinstaller/blob/develop/doc/CHANGES.rst)
- [Commits](https://github.com/pyinstaller/pyinstaller/compare/v5.7.0...v5.8.0)

---
updated-dependencies:
- dependency-name: pyinstaller
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:49:24 +01:00
dependabot[bot]
37ac37598b
Update pytest-xdist requirement from <3.2,>=2.1.0 to >=2.1.0,<3.3 (#5963)
Updates the requirements on [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) to permit the latest version.
- [Release notes](https://github.com/pytest-dev/pytest-xdist/releases)
- [Changelog](https://github.com/pytest-dev/pytest-xdist/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-xdist/compare/v2.1.0...v3.2.0)

---
updated-dependencies:
- dependency-name: pytest-xdist
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:49:15 +01:00
dependabot[bot]
7b3e0a6939
Update zstandard requirement from <0.20,>=0.11 to >=0.11,<0.21 (#5964)
Updates the requirements on [zstandard](https://github.com/indygreg/python-zstandard) to permit the latest version.
- [Release notes](https://github.com/indygreg/python-zstandard/releases)
- [Changelog](https://github.com/indygreg/python-zstandard/blob/main/docs/news.rst)
- [Commits](https://github.com/indygreg/python-zstandard/compare/0.11.0...0.20.0)

---
updated-dependencies:
- dependency-name: zstandard
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 00:49:02 +01:00
Przemysław Dąbek
d9bdaa060a
Update links to mitmweb issue (#5952)
Replace: https://github.com/mitmproxy/mitmweb/issues/10
with: https://github.com/mitmproxy/mitmproxy/issues/3609
2023-02-27 13:42:47 +01:00
autofix-ci[bot]
51670861e6 [autofix.ci] apply automated fixes 2023-02-27 08:37:11 +01:00
Maximilian Hils
46bfb35488 drop support for Python 3.9 2023-02-27 08:37:11 +01:00
WenzelTian
5259d1e31a
add the architecture determination when running the wireguard test (#5953) 2023-02-26 15:25:10 +01:00
James O'Claire
01c1090ec1
Was pointing to issue on archived mitmweb issue, instead point to active mitmproxy issue (#5951) 2023-02-25 10:29:26 +01:00
Maximilian Hils
244ff35e60
fix usage of asyncio.create_task (#5928)
this fixes #5926
2023-02-13 21:45:02 +00:00
Jurrie Overgoor
7e3380e628
Add a section on using Magisk and Magisk modules in the Android howto (#5924)
* Add a section on using Magisk and Magisk modules in the Android howto

This allows you to use Google Play builds with mitmproxy.

* [autofix.ci] apply automated fixes

* Explain how to get the Magisk module from mitmweb

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-02-13 17:07:24 +01:00
konradh
09a83a89b2
console: fix bug that caused wrong direction indicators in message stream flow view (#5923) 2023-02-10 14:22:05 +01:00
Maksym Medvied
5969f25db4
pass signals to mitmproxy in docker-entrypoint.sh (#5920)
Current docker-entrypoint.sh [0][1] runs

    gosu mitmproxy "$@"

for mitmproxy, mitmdump and mitmweb. There is a problem with this
approach: bash becomes a parent process for mitmproxy [2][3], but when
signals are sent by docker-compose to mitmproxy container they are sent
to bash, but they are not delivered to mitmproxy [4]. This leads to a
slow shutdown of the container, because by default docker sends SIGTERM,
waits for 10 seconds and then sends SIGKILL if the container is still
alive [5].

This patch solves the issue by replacing bash process with mitmproxy
entirely using "exec" - this way the signals are delivered to mitmproxy
directly.

To test the patch a Dockerfile [6] that applies the patch to the release
image from the dockerhub could be used along with slighly modified
compose.yml [7]. With the patch bash is no longer running inside the
container [8] and the `docker compose down` time on my machine drops
from 10.3s to 0.5s [9].

0. https://github.com/mitmproxy/mitmproxy/blob/main/release/docker/docker-entrypoint.sh
1. To confirm that this is what's actually in the image:
    ```
    > docker run mitmproxy/mitmproxy grep gosu /usr/local/bin/docker-entrypoint.sh
      gosu mitmproxy "$@"
    ```
2. compose.yaml
    ```
    services:
      mitmproxy-test:
        image: mitmproxy/mitmproxy
        command: ["mitmweb"]
        # https://github.com/mitmproxy/mitmproxy/issues/5727
        stdin_open: true
        tty: true
    ```
3. We can see that the parent PID for mitmweb is the pid of bash.
    ```
    > docker compose up -d
    [+] Running 2/2
     ⠿ Network mitmproxy_default             Created           0.1s
     ⠿ Container mitmproxy-mitmproxy-test-1  Started           0.5s
    > docker compose top
    mitmproxy-mitmproxy-test-1
    UID    PID     PPID    C    STIME   TTY     TIME       CMD
    root   31227   31202   0    16:12   pts/0   00:00:00   /bin/bash /usr/local/bin/docker-entrypoint.sh mitmweb
    root   31314   31227   1    16:12   pts/0   00:00:01   /usr/local/bin/python /usr/local/bin/mitmweb
    ```
4. https://unix.stackexchange.com/a/196053
5. https://docs.docker.com/compose/faq/#why-do-my-services-take-10-seconds-to-recreate-or-stop
6. Dockerfile:
    ```
    FROM mitmproxy/mitmproxy

    RUN sed -i 's/^  gosu mitmproxy/  exec gosu mitmproxy/' /usr/local/bin/docker-entrypoint.sh
    ```
7. compose.yaml to build an image from Dockerfile and use it:
    ```
    services:
      mitmproxy-test:
        build:
          dockerfile: Dockerfile
          context: .
        command: ["mitmweb"]
        # https://github.com/mitmproxy/mitmproxy/issues/5727
        stdin_open: true
        tty: true
    ```
8. With the patch:
    ```
    > docker compose top
    mitmproxy-mitmproxy-test-1
    UID    PID    PPID   C    STIME   TTY     TIME       CMD
    root   4994   4970   50   17:00   pts/0   00:00:02   /usr/local/bin/python /usr/local/bin/mitmweb
     ```
9. Without the patch:
    ```
    > docker compose down
    [+] Running 2/2
     ⠿ Container mitmproxy-mitmproxy-test-1  Removed          10.2s
     ⠿ Network mitmproxy_default             Removed           0.1s
    ```
   With the patch:
    ```
    > docker compose down
    [+] Running 2/2
     ⠿ Container mitmproxy-mitmproxy-test-1  Removed           0.4s
     ⠿ Network mitmproxy_default             Removed           0.1s
    ```
2023-02-09 11:43:47 +01:00
Pradyot Ranjan
41555edab9
Reformatted list (#5919)
* Reformatted list

* [autofix.ci] apply automated fixes

* Reformatted list

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-02-09 11:38:27 +01:00
Maximilian Hils
8f78052493
update to mypy 1.0 (#5918) 2023-02-07 10:35:11 +00:00
Maximilian Hils
7da3a8e871
treat multipart as bytes, not str. fixes #5148 (#5917) 2023-02-07 10:29:08 +00:00
Xiao Wang
430833e3d9
Fix server addr issue in tls_passthrough example. (#5904)
* fix server peername is None issue

peername would be None, we should use other not None property as key.

* Update tls_passthrough.py

---------

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2023-02-07 09:57:24 +01:00
Sujal Singh
b9f3574728
fix Host and :authority header not being updated on changes to host or port (#5908)
* fix map remote addon not setting `Host` header correctly

* fix failing tests

* fix coverage

* fix host and authority headers

* raise error when port is not of type int

* fix nits

* [autofix.ci] apply automated fixes

* coverage++

---------

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-02-06 17:35:16 +01:00
Maximilian Hils
54185c2c8d
Add experimental Windows OS proxy mode (#5912)
* add experimental Windows OS proxy mode

this is merely a proof-of-concept now, but works under the most ideal circumstances.
2023-02-06 17:34:48 +01:00
Maximilian Hils
a7e50c793e
mitmproxy-wireguard -> mitmproxy_rs (#5909)
mitmproxy-rs includes all the fantastic WireGuard work,
but will add more non-WireGuard stuff. :)
2023-02-04 22:28:15 +01:00
Maximilian Hils
977385ceab
docs: Server.peername may be None, refs #5904 2023-02-04 01:01:01 +01:00
dependabot[bot]
dfeddcf4ad
Bump install-pinned/black from 9101a4d68e870eaaaae21c412d1d879b93c9afcb to 13c8a20eb904ba800c87f0b34ccfd932ac2ff81d (#5899)
* Bump install-pinned/black

Bumps [install-pinned/black](https://github.com/install-pinned/black) from 9101a4d68e870eaaaae21c412d1d879b93c9afcb to 13c8a20eb904ba800c87f0b34ccfd932ac2ff81d.
- [Release notes](https://github.com/install-pinned/black/releases)
- [Commits](9101a4d68e...13c8a20eb9)

---
updated-dependencies:
- dependency-name: install-pinned/black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* [autofix.ci] apply automated fixes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-02-01 23:08:09 +00:00
dependabot[bot]
317b7a2be2
Bump install-pinned/yesqa (#5903)
Bumps [install-pinned/yesqa](https://github.com/install-pinned/yesqa) from a1262fbe567d4c0b3445afade67b90f3bba2c9a2 to 4af1e53e86a56db346a03ece9e89c19bfd0e5d0e.
- [Release notes](https://github.com/install-pinned/yesqa/releases)
- [Commits](a1262fbe56...4af1e53e86)

---
updated-dependencies:
- dependency-name: install-pinned/yesqa
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-01 22:20:13 +00:00
dependabot[bot]
985a77e77d
Bump install-pinned/reorder_python_imports (#5901)
Bumps [install-pinned/reorder_python_imports](https://github.com/install-pinned/reorder_python_imports) from 515035fd9eb355713f61dee238b17a04ce01f4d2 to 946c8bbd8fe048a3bee76063c90c938d5a59a9aa.
- [Release notes](https://github.com/install-pinned/reorder_python_imports/releases)
- [Commits](515035fd9e...946c8bbd8f)

---
updated-dependencies:
- dependency-name: install-pinned/reorder_python_imports
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-01 22:18:07 +00:00
dependabot[bot]
5859d998f3
Bump docker/setup-buildx-action (#5902)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 165fe681b849eec43aaa64d786b9ec53e690475f to 11e8a2e2910826a92412015c515187a2d6750279.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](165fe681b8...11e8a2e291)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-01 22:18:02 +00:00
dependabot[bot]
8683f8392c
Bump install-pinned/autoflake (#5900)
Bumps [install-pinned/autoflake](https://github.com/install-pinned/autoflake) from 1a248450153f02b75d051acf6c2a05df8c797666 to 19ecc14a8688d57cca9dc6cfd705f16f200ff097.
- [Release notes](https://github.com/install-pinned/autoflake/releases)
- [Commits](1a24845015...19ecc14a86)

---
updated-dependencies:
- dependency-name: install-pinned/autoflake
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-01 22:14:05 +00:00
Sujal Singh
89d688e9fc
temporary fix for unhandled AlternativeServiceAvailable event (#5898)
* temporary fix for unhandled AlternativeServiceAvailable event

* [autofix.ci] apply automated fixes

* better log message for AlternativeServiceAvailable service

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-02-01 18:05:09 +01:00
Sujal Singh
e3a7941913
add delete shortcut to delete flows in mitmweb (#5896) 2023-01-30 13:59:21 +01:00