Commit Graph

10011 Commits

Author SHA1 Message Date
Maximilian Hils 0e2d9b6786
Update README.md 2022-10-14 08:19:55 +02:00
Maximilian Hils 80803593c0
udp: bind to 0.0.0.0 on Windows (#5642) 2022-10-14 05:54:42 +00:00
Maximilian Hils 16c5862ae2
Merge pull request #5645 from mhils/nits
Fix nits
2022-10-14 07:44:18 +02:00
BigSully b2303558b2
get real url in transparent mode (#5613)
flow.request.url shows the ip address rather than host name when mitmproxy works on transparent mode
flow.request.pretty_url can show the correct url
2022-10-14 07:44:01 +02:00
Maximilian Hils c2e8987c5f tests: remove file with invalid syntax 2022-10-14 07:35:30 +02:00
Maximilian Hils 360ac36666 `type` -> `type_name` to avoid name clash with builtin 2022-10-14 07:35:08 +02:00
Maximilian Hils dbf424169d
Merge pull request #5643 from mhils/h3-cv
Improve HTTP/3 Frame Contentview
2022-10-13 20:14:48 +02:00
Maximilian Hils 7ffdac506b console: use `get_message_content_view` 2022-10-13 20:09:21 +02:00
Maximilian Hils 051c90067f improve h3 frame contentview 2022-10-13 20:08:26 +02:00
Maximilian Hils e2e728d0af
Update pyOpenSSL (#5639)
* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

* Update setup.py

* use latest pyOpenSSL APIs

Co-authored-by: requires.io <support@requires.io>
2022-10-13 12:33:55 +00:00
Mazen Ramadan 5697b2e352
docs: Fix wrong option type (#5633) 2022-10-05 14:13:03 +02:00
Fabio Valentini a1631154d7
README: fix link to "dev" documentation in badge (#5619) 2022-10-01 15:58:06 +02:00
Fabio Valentini 19afd8f9dd
docs: add documentation for wireguard mode (#5607) 2022-09-25 18:49:05 +02:00
Alexander Prinzhorn 75332d447e
Fix mitmweb not properly opening a browser and being stuck on some Linux (#5603) 2022-09-24 10:03:29 +02:00
Maximilian Hils 810401f454
Merge pull request #5604 from mhils/mypy-and-closing
Re-add `is_closing` check, fixup mypy.
2022-09-22 19:00:07 +02:00
Maximilian Hils 0e824c6228 mypy: install _all_ dependencies 2022-09-22 18:52:45 +02:00
Maximilian Hils f89a8cea55 dns dumper: fix colors 2022-09-22 18:50:50 +02:00
Maximilian Hils db9b3c21be Revert "Revert "Don't write to closing streams, fix #5363 (#5589)""
This reverts commit ec5a74cd0e.
2022-09-22 18:29:11 +02:00
Maximilian Hils ec5a74cd0e Revert "Don't write to closing streams, fix #5363 (#5589)"
This reverts commit a1ddbcad53.
2022-09-22 17:11:40 +02:00
Maximilian Hils a1ddbcad53
Don't write to closing streams, fix #5363 (#5589)
* don't write to closing streams, fix #5363

* tests++
2022-09-22 16:47:26 +02:00
Maximilian Hils d3fb9f4349
mitmweb: use `gio` to open browser where available 2022-09-22 14:23:32 +02:00
daycoder bbfb639835
Update options-simple.py (#5600)
Usage in the docstring is incorrect. Changes "--set addheader true" to "--set addheader=true"
2022-09-21 16:39:21 +02:00
Maximilian Hils 64c3f32276
Merge pull request #5593 from mhils/wg-polish
WireGuard: Polish
2022-09-19 17:51:54 +02:00
Maximilian Hils 3fcb3f0773 set `client.sockname` to original destination for transparent modes
If we don't do this we have non-unique connection tuples, which would be bad.
2022-09-19 17:10:31 +02:00
Maximilian Hils 52f303c636 fix nits 2022-09-19 17:10:31 +02:00
Maximilian Hils 46c3e5f374 don't dim debug logs
that makes them too hard to read.
2022-09-19 17:10:31 +02:00
Maximilian Hils 539dff7c2a h2: use proper logging 2022-09-19 17:10:31 +02:00
Maximilian Hils b5834a604b wireguard: specify dns server
without this Android clients will do DNS lookups outside of WireGuard,
which a) is leaking and b) may or may not work at all.
2022-09-19 17:10:31 +02:00
Maximilian Hils 8b3e3e7b40 remove unused basethread implementation 2022-09-19 17:10:31 +02:00
Maximilian Hils 3212c3f9ec WireGuard: Show QR Code (#5591)
* fixup wireguard config

* mitmweb: add WireGuard QR code
2022-09-19 17:08:07 +02:00
Fabio Valentini 2d495c093c
add transparent server mode based on WireGuard (#5562)
* add mode spec for WireGuard mode

* add WireGuard server implementation

* remove coverage excludes

* simplify wireguard spec

* lint!

* remove superfluous tests

* bump to mitmproxy_wireguard 0.1.1

* proxy/test_mode_specs: remove unused import

* fix wireguard server mode

* WireGuard: move keyfile gen into `.start()`

This way any file format errors result in `.last_exception` being set.

* fixup UDP support

* bump to mitmproxy_wireguard v0.1.2

This release fixes TCP connections which were broken in v0.1.1.

* fix crash handler

* add simple test for WireGuard server instances

* bump to mitmproxy_wireguard v0.1.5 and fix launching wg-test-client

* fixups

 - monkeypatch `handle_client` instead of the handlers.
 - fix OS detection
 - ctx.log -> logging

* nits

* bump to mitmproxy_wireguard 0.1.6 for fixed test client

* move WireGuardDatagramTransport into dedicated module

this allows us to exclude it from individual coverage, which makes no sense.
Also improve type checking to make sure that it's a full replacement.

* cover WireGuardServerInstance.is_running property with tests

* enable specialized server instance creation

* test wireguard conf generation

* deduplicate tcp/udp handlers

* update CHANGELOG

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2022-09-18 17:15:15 +02:00
Maximilian Hils 12e2aecdf9 add MQTT contentview 2022-09-18 14:33:58 +02:00
Maximilian Hils a6ede600f3
Merge pull request #5590 from mhils/log-1
Switch to stdlib logging
2022-09-18 13:56:13 +02:00
Maximilian Hils dc8ff24685 don't remove `add_log` but deprecate it. 2022-09-18 13:45:37 +02:00
Maximilian Hils c69239bb90 switch to stdlib logging
mitmproxy previously used a homegrown logging mechanism based around
`mitmproxy.ctx.log` and the `add_log` hook. This worked well for everything
we control, but does not work outside the mitmproxy universe.
For now we have simply ignored logging in e.g. tornado or h2, but with the
upcoming introduction of mitmproxy_wireguard we now have a dependency
on some Rust/PyO3 code for which we definitely want logs, but which also
cannot easily be changed to use our homegrown logging (PyO3 does the heavy
lifting to add interoperability with stdlib logging). Long story short,
we want to introduce a log handler for stdlib logging.

Now there are two ways how such a handler could operate:

 1. We could build a handler that forwards all stdlib log events
    into our homegrown mechanism.
 2. We embrace stdlib's logging as the correct way to do things,
    and get rid of our homegrown stuff.

This PR follows the second approach by removing the `add_log` hook and
rewriting the `TermLog` and `EventStore` addons to listen for stdlib log records.
This means that all `mitmproxy.ctx.log.info` events are now simply `logging.info` etc.

One upside of this approach is that many parts of the codebase now don't depend
on the existence of `mitmproxy.ctx` and we can use off-the-shelf things like pytest's
`caplog`. We can also now better colorize log output and/or add timestamps.
2022-09-17 17:28:35 +02:00
Maximilian Hils 0afc48b714 Revert "use stdlib logging instead of Log command"
This reverts commit f2787be057.
2022-09-16 20:57:39 +02:00
Maximilian Hils f2787be057 use stdlib logging instead of Log command 2022-09-16 20:57:25 +02:00
Maximilian Hils 780adbaf9b fix #5584 2022-09-15 14:06:22 +02:00
Maximilian Hils b78869b584
Merge pull request #5582 from mhils/http3-contentview
Add HTTP/3 contentview
2022-09-13 09:06:51 +02:00
Maximilian Hils f6ac500698 add HTTP/3 content view 2022-09-13 09:00:09 +02:00
Maximilian Hils b5d06863b3 fix layout cycling 2022-09-12 19:05:19 +02:00
Maximilian Hils 1054f13c13
move `get_local_ip` out of platform-specific code (#5579) 2022-09-11 18:40:16 +02:00
Francisco Boni f9899fdd44
Improve http_manipulate_cookies.py example (#5578)
Improve the example helper functions to use the get_all functions recommended
in the Header class docs for use with cookies data. This will avoid errors when
dealing with multiple headers.

cf655a664f/mitmproxy/http.py (L148)
cf655a664f/mitmproxy/http.py (L91)
2022-09-11 15:58:29 +02:00
Aldo Cortesi ea23f1cc29
[requires.io] dependency update (#5577)
Co-authored-by: requires.io <support@requires.io>
2022-09-11 13:31:14 +02:00
Aldo Cortesi a5f2a03ce3
[requires.io] dependency update on main branch (#5573)
* [requires.io] dependency update

* [requires.io] dependency update

* [requires.io] dependency update

Co-authored-by: requires.io <support@requires.io>
2022-09-10 17:05:17 +02:00
Maximilian Hils 57c71ea5bc update CHANGELOG 2022-09-09 17:35:06 +02:00
shuyiLiu 3ccfad1896
fix issue #5198: mitmWeb crash (#5507)
* fix issue #5198: mitmWeb crash

* fix mitmWeb crash

* test cases

* fix test cases

* fix mistake

* update snapshots

* why line221 not covered by test?

Co-authored-by: liushuyi.sputnik <liushuyi.sputnik@bytedance.com>
2022-09-09 17:27:25 +02:00
sanlengjingvv 9223c178c9
Make mitmweb use option "content_view_lines_cutoff" (#5548) 2022-09-09 17:20:30 +02:00
Maximilian Hils 8023b22498
Docker: assume uid of who holds permissions (#5550)
* Docker: assume uid of who holds permissions

* add docs
2022-09-08 17:42:09 +00:00
Manuel Meitinger 891dae031c
Make default_port protocol specific. (#5563)
* [modes] make default_port protocol specific

* fix nits

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2022-09-07 12:14:48 +00:00