Commit Graph

9698 Commits

Author SHA1 Message Date
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
Shubhangi Choudhary
9b75f52073
migrated the files to tsx (#4972)
* migrated the files to tsx

* reverted unecessary changes

* reverted unecessary changes to app.css

* fixed the fails

* fixed the fails
2021-12-21 13:05:55 +00:00
Maximilian Hils
efd2980b8a catch OpenSSL SysCallError, refs #4985 2021-12-20 22:23:23 +01:00
Maximilian Hils
96f77453cc
fix change_upstream_proxy.py example, fix #4981 (#5007) 2021-12-20 21:10:06 +00:00
Maximilian Hils
c74806feac
fix tests 2021-12-20 21:06:14 +01:00
Maximilian Hils
ca646ebd40
fix #4957 2021-12-20 20:36:40 +01:00
James Yale
ace07e7e3c
Example specified incorrect header (#4997)
* Example specified incorrect header

* Add CHANGELOG entry reference the documentation update

* fixup! Add CHANGELOG entry reference the documentation update
2021-12-20 20:18:00 +01:00
Maximilian Hils
6997129bc0
make sure that running() is only invoked once on startup. (#4964)
fix #3584
2021-11-27 13:11:23 +00:00
Maximilian Hils
3a2c87432c
[requires.io] dependency update (#4961)
Co-authored-by: requires.io <support@requires.io>
2021-11-26 23:14:19 +01:00
Brad Dixon
b1d0887db4
Add deepcopy to allow view.flows.resolve (issue #4916) (#4952)
* Add deepcopy to allow view.flows.resolve (issue #4916)

* try to simplify deepcopy implementation

* remove leftover check

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2021-11-26 23:14:06 +01:00
Felix Ingram
b1c1cd3f2f
Fixes AttributeError in transparent mode (#4951)
If we haven't connected to the upstream host in transparent mode, then the call to `write` on line 74 will raise an `AttributeError` as we haven't initialised `self.wfile`.

If we add `AttributeError` to the `except` line, then we'll catch the exception and call `_connect`, which will in turn initialise `wfile`.
2021-11-24 16:49:47 +01:00
Maximilian Hils
27e69651f6
[requires.io] dependency update (#4946)
Co-authored-by: requires.io <support@requires.io>
2021-11-23 21:12:32 +01:00
Maximilian Hils
2dd845ed95 catch malformed cert warning in tests
we may need to catch this properly in `get_cert` at some point,
let's see if this ever turns out to be an issue.
2021-11-22 12:55:17 +01:00
Maximilian Hils
9803c90341 make it possible to disable exit on SIGUSR1 2021-11-22 12:54:02 +01:00
Maximilian Hils
68bce90754 require cryptography 36+
3.3+ should mostly work fine, but our tests cover v36-specific behavior
2021-11-22 12:52:37 +01:00
Maximilian Hils
57ae779b15
Merge pull request #4944 from mitmproxy/requires-io-main
[requires.io] dependency update on main branch
2021-11-22 11:20:23 +01:00