Commit Graph

9663 Commits

Author SHA1 Message Date
Maximilian Hils
5fc20e3e8c tests++ 2022-03-15 18:43:56 +01:00
Maximilian Hils
bbc65e5f37 clean up initialization mess
We now manage the eventloop ourselves no matter which tool.
2022-03-15 11:22:03 +01:00
Maximilian Hils
46ccf6049c add asyncio_utils.run() 2022-03-15 10:28:53 +01:00
Maximilian Hils
c3dade0950 inline _change_reverse_host to make sure it is not used elsewhere 2022-03-14 14:11:01 +01:00
Maximilian Hils
33742122a5 set an exception handler for asyncio, fix #5159, refs #5016 2022-03-14 14:06:05 +01:00
Maximilian Hils
8bb7ad468f remove workaround for a Python <=3.7 bug 2022-03-13 19:20:26 +01:00
Maximilian Hils
2387719ace urwid: support sgr mouse reporting
this commit vendors e2423b5069
so that we don't have to wait for a new release.
2022-03-13 19:16:01 +01:00
Maximilian Hils
6c4b3954aa urwid windows: use utf8 2022-03-13 19:15:55 +01:00
Maximilian Hils
3387dac679 remove leftover import 2022-03-08 17:44:20 +01:00
Maximilian Hils
e077e60590 tls: gracefully catch connection errors 2022-03-07 18:59:00 +01:00
Maximilian Hils
b491528981 exclude time-sensitive test from CI 2022-03-04 11:38:28 +01:00
Maximilian Hils
65773cc9c0 speculative fix for #5158 2022-02-27 07:58:20 +01:00
Maximilian Hils
5cdd2bc6ec docs: TCPFlow.messages 2022-02-27 07:58:00 +01:00
Maximilian Hils
2d2a9f3c52
adjust to template changes in pdoc 10 (#5132) 2022-02-14 15:07:20 +00:00
Sandro
f85c64401b
Update dead link (#5128) 2022-02-11 17:22:13 +01:00
Maximilian Hils
ffe58ae34c fix map local examples 2022-02-09 09:03:59 +01:00
Maximilian Hils
4d1d54d4a5
fix hugo version 2022-02-09 08:52:52 +01:00
Maximilian Hils
41979a1cb4
update hugo 2022-02-09 08:49:18 +01:00
Maximilian Hils
2480eae5b0 Revert "Fix websocket view jumps to top bug (#4845)"
This reverts commit 278611bf77,
which introduced a bug for the regular HTTP views,
which would initially scroll to the bottom.

fix #5089
2022-02-05 18:24:56 +01:00
Maximilian Hils
4468046a26
Merge pull request #5106 from nneonneo/async_addons
Support async hooks. Fixes #4207.
2022-02-04 21:20:33 +01:00
Maximilian Hils
372a632161 reintroduce Flow.live
We previously relied on the state of `Flow.reply` to check if a flow can be killed,
but this doesn't work anymore with `Flow.reply` being removed. Instead, we now
reintroduce the `Flow.live` attribute, which signals if we are on a live connection.
Killing still is not ideal (see comment in `Flow.killable`), but this paves the way.
2022-02-04 17:30:58 +01:00
Maximilian Hils
4f5930ec5d simplify concurrency tests 2022-02-04 17:30:20 +01:00
Maximilian Hils
068204fc59 perf: fast path for sync hooks 2022-02-04 17:30:20 +01:00
Robert Xiao
6dc6269b8e Remove no-longer-used tctx.invoke function 2022-02-04 17:30:20 +01:00
Robert Xiao
794c18bec0 Entirely remove the reply system.
The major, breaking change is that it is no longer possible to "take" a reply in
order to block the effect of a later addon hook.

This is patch 4/4 of the reply-ectomy.
2022-02-04 17:30:20 +01:00
Robert Xiao
ede269fce4 Flow.intercept: use an Event instead of the reply system
This is patch 3/4 of the reply-ectomy.
2022-02-04 17:30:20 +01:00
Robert Xiao
fd43ca19c4 Flow.kill: don't depend on reply status.
In principle, a flow is killable as long as the connection handler is still
checking the error status of the flow.

This is patch 2/4 of the reply-ectomy.
2022-02-04 17:30:20 +01:00
Robert Xiao
4448550746 Rewrite @concurrent to use async instead of the reply mechanism.
This should improve behaviour, since calls to @concurrent will now be serialized
relative to other hooks on the same flow (but will still run in parallel with
hooks on different flows). Unlike a plain async hook, @concurrent allows blocking
sync APIs to run concurrently (e.g. requests).

This is patch 1/4 of the reply-ectomy.
2022-02-04 17:30:20 +01:00
Robert Xiao
caf49300c2 Use async for tctx.cycle/tctx.invoke. 2022-02-04 17:30:20 +01:00
Robert Xiao
e186ccb3ba fix test.helper_tools.dumperview script.
Previously, it was throwing the following error:

  File mitmproxy/addons/dumper.py, line 133, in _echo_request_line
    elif flow.client_conn.peername:
AttributeError: 'bool' object has no attribute 'peername'
2022-02-04 17:30:20 +01:00
Robert Xiao
ee4999e8e4 Rename new async helper functions.
async_trigger -> trigger_event
invoke_addon -> invoke_addon_sync (API breakage)
async_invoke_addon -> invoke_addon
2022-02-04 17:30:20 +01:00
Robert Xiao
687ab4b589 Tests for async hook support 2022-02-04 17:30:20 +01:00
Robert Xiao
cee4b72459 Support async hooks. Fixes #4207. 2022-02-04 17:30:20 +01:00
Maximilian Hils
8c86fd06db add changelog linkifier util 2022-02-04 16:00:44 +01:00
Alexander Prinzhorn
437e55c2c2
await server_connected hook before doing something with the connection, fixes #5108 (#5110)
* await server_connected hook before doing something with the connection

* refine changelog wording

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2022-02-04 13:49:57 +00:00
Remigiusz Żętkowski
59033371e8
iOS 15 certificate installation instructions update (#5107)
* Update certificate intructions for iOS 15

* Formatting fixes
2022-02-03 12:53:50 +01:00
nt8en
83b43b93a7
Fix a typo in addons-overview.md (#5088) 2022-01-25 09:39:54 +01:00
pmoulton
b5c1ef11c1
Pass length of hostname.encode() to X509_VERIFY_PARAM_set1_host (#5083)
* Pass length of hostname.encode() to X509_VERIFY_PARAM_set1_host

Passing zero for the size_t length argument of
X509_VERIFY_PARAM_set1_host causes MITM Proxy to crash when used with
BoringSSL.

https://www.openssl.org/docs/man1.1.1/man3/X509_VERIFY_PARAM_set1_host.html

https://boringssl.googlesource.com/boringssl/

* Update CHANGELOG.md

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2022-01-21 12:22:01 +01:00
EndUser509
11c22d8a4a
Fix #5077 (#5080)
* Example addon for saving streamed data including a small bug fix to make it work.

* Revert "Example addon for saving streamed data including a small bug fix to make it work."

This reverts commit 02ab78def9a52eaca1a89d0757cd9475ce250eaa.

* Fix for issue #5077
2022-01-20 08:46:52 +01:00
Maximilian Hils
53f60c88b1
fix a crash when refreshing headers with a negative unix timestamp, fix #5054 (#5078) 2022-01-18 22:32:38 +00:00
Maximilian Hils
d47fd3e9c3
ClientHello: add .raw_bytes(), refs #4877 (#5075) 2022-01-18 11:34:09 +00:00
ian klatzco
1abb8f6921
add keyboard shortcut n to mitmweb (by using runCommand inside the kb shortcut handler) (#5061)
* add keyboard shortcut n to mitmweb (by creating /flows/create route)

* add keyboard shortcut n to mitmweb (simplified, by using runCommand instead of a new route)
2022-01-16 15:34:07 +01:00
ian klatzco
2455632a9c
typo (#5062) 2022-01-16 00:37:57 +01:00
ian klatzco
33e58e2c2b
Clarify web frontend docs (#5055) 2022-01-14 13:00:47 +01:00
PavelICS
1e97073078
Fix crush shutdown when MITM has it's own loop (#5042)
When I call shutdown with a different loop in the current thread from MITM loop, it's crashes with the error:
`ValueError: The future belongs to a different loop than the one specified as the loop argument`

Setting a loop explicit fixes the problem.
2022-01-10 15:58:14 +01:00
Maximilian Hils
000e26674e
catch cancellation errors when draining writers, fix #5034 (#5040) 2022-01-08 08:06:58 +01:00
Maximilian Hils
ef8c88da1f
setup websocket connection before finishing HTTP response, fix #5017 (#5020) 2021-12-27 15:58:24 +00:00
Maximilian Hils
3fbf3cf8ee tlsconfig: don't overwrite existing TLS context, refs #5019 2021-12-27 12:22:08 +01:00
Maximilian Hils
9c5bebae9e better expose raw ClientHello bytes, fix #4877 2021-12-25 12:28:52 +01:00
Maximilian Hils
f68666d227 socks5: fix a (non-critical) off-by-one, fix #4998 2021-12-23 13:43:46 +01:00