Commit Graph

385 Commits

Author SHA1 Message Date
Maximilian Hils
96f77453cc
fix change_upstream_proxy.py example, fix #4981 (#5007) 2021-12-20 21:10:06 +00:00
Maximilian Hils
3cb87f5a2f split tls_handshake hook into client/server and success/fail variants 2021-11-22 10:23:21 +01:00
Maximilian Hils
a72f61ef57 Merge remote-tracking branch 'origin/main' into ignore-after-clienthello 2021-11-22 09:54:08 +01:00
Marius
301f8cf79d
Create search.py (#4900)
* Create search.py

* Address linter findings

* Address linter findings
2021-11-16 12:47:34 +01:00
mame82
480052f58b
Grpc contentview (#4851)
* Partial gRPC contentview prototype, not linted, no tests, not as add-on

* Linted (flake8)

* Save dev state

* Rewrote of protobuf parser, use decoding strategy, reduced rendered data. Parser uses  generators

* minor cleanup

* fix: preferred encoding was provided as function instead of value

* flake8: line length

* Backlinked message tree objects, temporary debug out

* Partial implementation of gRPC definitions. Save state to fix a cras (data invalidate in edit mode)

* hack: deal with missing exception handling for generator based content views

* gRPC/Protoparser descriptions (with test code)

* replaced manual gzip decoding with mitmproxy.net.encoding.decode

* Refactored typing imports

* Reafctoring

* distinguish request vs response definitions, separate view config from parser config

* Code cleaning, moved customized protobuf definitions to example addon

* final cleanup

* changelog

* Stubs for tests

* Fixed render_riority of addon example

* Started adding tests

* Work on tests

* mypy

* Added pseudo encoder to tests, to cover special decodings

* Example addon test added

* finalized tests, no 100 percent coverage possible, see comments un uncovered code

* minor adjustments

* fixup tests

* Typos

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2021-10-12 13:32:56 +02:00
Maximilian Hils
c43a2ef8dc improve flowfilter api: raise on invalid input, add ~all 2021-10-08 17:45:47 +02:00
Maximilian Hils
79896e23b7 contentview example: be explicit about passed metadata 2021-10-07 15:21:46 +02:00
Maximilian Hils
7fd887a553 move tls hook data to mitmproxy.tls 2021-09-04 16:37:39 +02:00
Maximilian Hils
9f39e2f387 tests++ 2021-09-04 16:03:06 +02:00
Maximilian Hils
98a3e33477 tls: add tls_handshake, ignore-after-clienthello
this fixes #4702
2021-09-04 00:24:41 +02:00
Maximilian Hils
d518622976
Update examples/contrib/README.md 2021-08-22 14:57:20 +02:00
Alexander Prinzhorn
edbb3d6791
update ws injection example, fixes #4751 (#4761)
* update ws injection example, fixes #4751

* Update websocket-inject-message.py

* Revert "Update websocket-inject-message.py"

This reverts commit 86b4cda2f4.

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2021-08-18 11:37:28 +00:00
KORraNpl
52c81c287e Fix DeprecationWarning in har_dump.py 2021-08-11 20:32:39 +02:00
Maximilian Hils
c7e8b82420 update streaming example 2021-08-02 13:57:12 +02:00
Maximilian Hils
bb40ab9044 WebSocketMessage.kill() -> .drop() 2021-07-15 14:57:43 +02:00
Alexander Prinzhorn
eef6522a5e remove websocket_error event, fixes #4674 2021-07-12 16:35:25 +02:00
Maximilian Hils
d6975e0b80 add next_layer docs + example, minor fixes 2021-06-20 02:15:09 +02:00
Maximilian Hils
15adb2cd79
Update tls_passthrough.py 2021-06-18 08:49:48 +02:00
Brad Dixon
c6ba97eab6
Use emoji and characters as markers. Add ~marker filter syntax. (#4587)
* Use emoji and characters as markers. Add ~marker filter syntax.

* Add a test to please our CI overlords. :)
2021-05-27 11:40:41 +02:00
Maximilian Hils
fe6f0d368b inject -> inject.tcp/inject.websocket 2021-03-16 15:01:33 +01:00
Maximilian Hils
ac9852122f add websocket.timestamp_end 2021-03-16 14:52:15 +01:00
Maximilian Hils
6c07dba752 re-add WebSocket injection example 2021-03-14 00:49:24 +01:00
Peter Dave Hello
123342ea0b
Improve Markdown syntax(styling) (#4496)
* Improve Markdown syntax

- Add missing blank lines
- Remove trailing spaces
- Remove additional blank lines
- Fix indentation consistency and correctness

* Update addons-examples.md

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2021-03-11 19:13:02 +01:00
Maximilian Hils
e1f938f05b tests++ 2021-03-09 00:55:47 +01:00
Maximilian Hils
eb65bc748b merge WebSocketFlow into HTTPFlow, add WebSocket UI 2021-03-08 19:36:18 +01:00
Maximilian Hils
748fc93699
Merge pull request #4422 from mhils/pdoc
Docs: Add API Reference Using Pdoc
2021-02-13 00:18:49 +01:00
Maximilian Hils
805aed4f6a docs++ 2021-02-13 00:13:37 +01:00
Anatoli Babenia
cff98a30e2
Fix HAR dump (#4439)
* Fix `KeyError: 'Unknown options: hardump'` in HAR test_simple

The reason was an invalid import of `connections` which is gone
in d159897d98, but the loading error
was silently ignored (#4438) resulting in a misleading exception
at a later stage.

This still doesn't make the test suite run, because it is better
to fix one error at a time.

The way to run tests from examples.

    ln -sr test/conftest.py examples
    pytest examples/contrib/test_har_dump.py -k simpl

The way to see the execution flow with silenced exceptions.

    from hunter import trace, Q
    trace(Q(stdlib=False), ~Q(filename_contains='site-packages'))

* Fix `TypeError: invoke() takes 3 positional arguments but 4 were given`

* Fix `TypeError: 'bool' object is not callable`
2021-02-11 21:07:09 +01:00
Maximilian Hils
0ab59e5524 docs++ 2021-02-05 22:04:45 +01:00
Maximilian Hils
9409bf0368 move Headers/Message/Request/Response into mitmproxy.http 2021-02-05 08:43:15 +01:00
Maximilian Hils
990116b44a update mypy 2021-02-03 23:03:49 +01:00
Anatoli Babenia
00f718e6c0
Fix location for contrib har_dump.py in its test (#4424)
To run the test, I had to copy `conftest.py` to examples.

    cp test/conftest.py examples
    pytest examples/contrib/test_har_dump.py

This fixes the `fixture 'tdata' not found` error.
2021-02-03 18:52:56 +01:00
Kamil Borzym
f51019cb63
[#4235] Automatic view mode based on should_render method (#4236)
* [#4235] Automatic view based on should_render method instead of content_types property

* [#4235] Update CHENGELOG

* [#4235] Fix linter warnings

* Add an explicit test for the new forward-compatible behaviour

* wip

* contentviews: introduce render_priority (2/2)

* coverage++, lint!

* minor fixes

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2021-01-17 11:39:51 +01:00
Maximilian Hils
667cacba3f generate event documentation from source 2021-01-05 21:54:44 +01:00
Maximilian Hils
70f1d173e2 Reply: remove return value 2020-12-28 22:09:57 +01:00
Thomas Kriechbaumer
c35316f85a remove pathod and pathoc 2020-12-13 20:21:11 +01:00
Thomas Kriechbaumer
04cda70d1a add example to shutdown the proxy master 2020-11-29 17:13:44 +01:00
Thomas Kriechbaumer
af3dfac855
Merge pull request #4301 from Kriechi/pyupgrade-py36
pyupgrade --py36-plus mitmproxy/**/*.py
2020-11-21 11:05:16 +01:00
Thomas Kriechbaumer
82b5d61456 revert some minor changes 2020-11-21 10:46:19 +01:00
Thomas Kriechbaumer
38cca379df pyupgrade --py36-plus mitmproxy/**/*.py 2020-11-20 19:25:26 +01:00
Maximilian Hils
e36c790d55
Merge pull request #4300 from anneborcherding/fix/webscanner-helper
[contrib addons] updated imports and style.
2020-11-20 10:06:13 +01:00
anneborcherding
97bf522165
Added addon to suppress the sending of 502 Bad Gateway response… (#4299)
* WIP: Added option to suppress the sending of 502 Bad Gateway responses if the server is not responding

* Revert "WIP: Added option to suppress the sending of 502 Bad Gateway responses if the server is not responding"

This reverts commit 21b74f38b7.

* Added addon which suppresses the bad gateway error messages sent by mitmproxy

* fix type annotation

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2020-11-20 09:15:12 +01:00
Anne Borcherding
d4db078312 [contrib addons] updated imports and style. 2020-11-20 09:10:08 +01:00
Thomas Kriechbaumer
6289d9bca8 refactor and remove dead code 2020-11-08 13:07:44 +01:00
Blake Burkhart
21330f511e is_http10 and is_http11 properties to requests 2020-10-13 09:21:15 -05:00
Blake Burkhart
b17857c7ae Send http/1 request and response trailer headers 2020-10-08 20:43:28 -05:00
Maximilian Hils
67885320c0 add ASGI support for embedded apps
This commit replaces our WSGI implementation with a new ASGI one,
which then uses `asgiref`'s compatibility mode to still support WSGI applications.
The ASGI implementation is a bit bare-bone, but good enough for our purposes.

The major changes are:

  - We now support ASGI apps.
  - Instead of taking connections out of mitmproxy's normal processing,
    we now just set flow.response and let things continue as usual.
    This allows users to see responses in mitmproxy, use the response hook
    to modify app responses, etc. Also important for us,
    this makes the new implementation work for shenanigans like sans-io.
2020-08-13 17:22:31 +02:00
Maximilian Hils
5af57cfa99 HTTPRequest -> http.Request, add request.authority 2020-07-16 16:55:15 +02:00
Maximilian Hils
dfcc1578e5
Merge pull request #3962 from anneborcherding/feature/selenium-auth-addon
Added add-on with support for proxy authentication using selenium.
2020-07-15 13:54:48 +02:00
Maximilian Hils
83c6ab1393 move selenium example into contrib 2020-07-14 16:46:36 +02:00