Commit graph

802 commits

Author SHA1 Message Date
Maximilian Hils
d0a35dcf9b
introduce new contentview API (#7623) 2025-04-21 14:56:58 +02:00
Matteo Luppi
3ed7a63336
Local mode UX enhancement in mitmweb (#7643)
* improve local mode UI/UX

* update tests
2025-04-11 11:37:01 +02:00
Matteo Luppi
f33f4dd1d6
Fix mitmweb crash when searching/highlighting by ~h/~hq/~hs (#7652)
* check for undefined headers

* update changelog
2025-04-10 22:05:18 +02:00
Matteo Luppi
5f28814482
Adjust popover anchor positioning (#7642)
* adjust popover position

* update changelog
2025-04-09 23:34:03 +02:00
Mark Kiami
d33090b4f3
Log streamed bodies (#7637)
* Add new feature: storing of request and response streaming bodies

* Fix unit test by regenerating the options file with options_js.py

* Add test cases with store_streamed_bodies True and False

* Update Changelog

* Update Changelog with pull request ID

* [autofix.ci] apply automated fixes

* Update test with a dedicated test case for store_streamed_bodies

* Remove unnecessary option store_streamed_bodies from options.py

* Update docstrings for store_streamed_bodies and stream_large_bodies.

* Update docstring for store_streamed_bodies since it is not used anywhere in practice here.

* Fix typo in test_http.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-04-07 20:09:53 +02:00
Emanuele Micheletti
f373ccf45b
Preventing mitmweb crash when viewing flows with undefined headers (#7595)
* fix: check on msg.header

fix #7557

* changelog

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-11 22:23:24 +01:00
Maximilian Hils
395e641573
Ensure that all mitmweb options have help text. (#7563)
docs++
2025-02-16 21:46:30 +00:00
Maximilian Hils
3915c5af78
Revise Proxy Mode Docs (#7545)
* revise proxy mode documentation

* docs++

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-09 12:27:07 +01:00
Maximilian Hils
0bd573a599 web: add password-based authentication 2025-02-05 23:37:33 +01:00
Matteo Luppi
385800f07f
web: copy request/response data to clipboard (#7352)
* create ui component for copying content

* write function to copy viewcontentdata to clipboard

* add type string to url

* call the endpoint to fetch the full content

* update snapshots

* disable button after copying text

* update changelog

* remove disable on copy button

* [autofix.ci] apply automated fixes

* disable copy button while fetching

* [autofix.ci] apply automated fixes

* adjust isFetching and isCopied position

* hide copy button if there is no content

* update snapshot

* Delete web/src/templates/index.html

* adjust naming convention

* update test

* update snapshots

* nits

* add async/await

* [autofix.ci] apply automated fixes

* improve test coverage

* improve even more test coverage

* test coverage final improvement

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-02-03 23:37:40 +00:00
Maximilian Hils
b761cb46c4
Web: harden xsrf_token usage (#7491)
web: harden `xsrf_token` usage
2025-01-19 20:40:55 +05:30
Maximilian Hils
e78ab0ffd9
web: remove unnecessary template copying build step (#7490) 2025-01-17 18:09:45 +01:00
Matteo Luppi
18a29df7d0
Improve typing FilterInput component (#7426)
improve typing FilterInput component
2025-01-01 13:00:39 +01:00
Matteo Luppi
2181669f1f
Update options ui duck to rtk (#7368)
* use rtk in modal duck

* adapt flow duck to rtk

* export HIDE_MODAL event type

* change object to string in selectTab

* [autofix.ci] apply automated fixes

* update options ui duck to rtk

* [autofix.ci] apply automated fixes

* add explaining comment

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-31 14:55:03 +01:00
Matteo Luppi
e0434726f3
Exposing 'localModeUnavailable' to the frontend (#7390)
* expose localModeUnavailable

* adapt frontend

* update gen file

* [autofix.ci] apply automated fixes

* add default description

* style

* use 'localModeUnavailable' to check

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-11 16:57:19 +01:00
Matteo Luppi
0045c1f31b
allow single click to edit URL request (#7385)
* allow single click to edit URL request

* update changelog

* [autofix.ci] apply automated fixes

* update changelog

* use 'selectAllOnClick' instead of 'setCursorOnClick'

* remove 'selectAllOnClick' from capture tab page

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-10 21:19:06 +01:00
Maximilian Hils
016f311944
Implement Cache-Busting for mitmweb (#7386)
* cache-bust front end artifacts

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-10 08:07:35 +01:00
Matteo Luppi
6dce751e62
update commandBar duck to RTK (#7370) 2024-12-04 09:42:48 +01:00
Matteo Luppi
34df78c7f3
Update flow.ts and modal.ts ducks to RTK (#7311)
* use rtk in modal duck

* adapt flow duck to rtk

* export HIDE_MODAL event type

* change object to string in selectTab

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-28 19:11:07 +01:00
Matteo Luppi
006f8c97c4
Invert check for unsupported platforms in local mode (mitmweb) (#7349)
invert the check for unsupported platform in local mode
2024-11-28 19:10:05 +01:00
Maximilian Hils
999562a6e2
Align web/gen and ruff format (#7342)
align web/gen and ruff format
2024-11-23 06:20:26 +01:00
Maximilian Hils
69f455b962
Add tun proxy mode on Linux (#7278)
* simplify stream handling callback

* add `tun` proxy mode from mitmproxy_rs

* tun mode: tests++

* [autofix.ci] apply automated fixes

* bump mitmproxy_rs

* fix bugs

* ci: use macOS 13 for builds as 12 is being phased out

* test debugging

* bump mitmproxy_rs

* bump python version in ci, 3.13 is stable now

* nits

* is unshare to blame?

* how about this?

* coverage++

* [autofix.ci] apply automated fixes

* debüg

* debüüg

* debüüüg

* bump mitmproxy_rs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-29 02:34:39 +05:30
Matteo Luppi
c346f038f8
web: arbitrary strings in local mode (#7257)
* add regex to handle commas

* add arbitrary strings in local mode

* adjust no result string
2024-10-18 18:29:44 +02:00
Matteo Luppi
96a1b934be
Display Grayed-Out Mode for Unsupported Platforms (#7244)
add missing mode component
2024-10-14 23:11:33 +02:00
Nicolai Søborg
a44191a9b1
Add --show-ignored-hosts (#6720)
* Add `--show-ignored-hosts`

Maybe a bit counterintuitive, but mitmproxy is very nice even without
the MITM part.  When doing `--ignore-hosts '.*'` it is not possible to
see SNI's, so add new flag to show the raw TCP/UDP streams.

Fixes #6421

* Add tests for `--show-ignored-hosts`

* Changelog for `--show-ignored-hosts`

* [autofix.ci] apply automated fixes

* fixups

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2024-10-01 15:28:28 +00:00
Matteo Luppi
e1ea491ad7
expose available web columns to Python (#7205)
* add script to generate all possible web columns

* remove test for now

* Make web_columns.py executable

* [autofix.ci] apply automated fixes

* add back tests

* [autofix.ci] apply automated fixes

* update changelog

* update changelog and add coauthor

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Abhishek-Bohora <abhishek.bohora16@gmail.com>
2024-09-22 19:21:41 +02:00
Maximilian Hils
f8b742753b
Enable HTTP/3 in transparent mode by default (#7202)
* fixup raw quic handling

* enable HTTP/3 in transparent mode by default

* fix nits
2024-09-21 14:29:31 +00:00
Maximilian Hils
358fca3e72
tls_version: QUIC -> QUICv1 (#7201)
* tls_version: QUIC -> QUICv1

this aligns us with what OpenSSL is returning

* tests: add quic dumpfile
2024-09-21 16:22:09 +02:00
Thomas Kriechbaumer
2c1802692d
options: add request_client_cert to enable mutual TLS (#7175)
* options: add request_client_cert to enable mutual TLS

This capability was already built-in but hard-coded to be disabled. Making it configurable as option (defaulting to off) enables mTLS connections between clients and mitmproxy. If true, mitmproxy will send a TLS `CertificateRequest` message to the client during the TLS handshake, upon which a client needs to present a client certificate to mitmproxy to successfully establish an mTLS connection.

This option can be used together with the `client_certs` option to also establish an mTLS connection between mitmproxy and the upstream server. In this case, mitmproxy needs to have a full client cert, including matching private key, that is trusted and accepted by the upstream server. This is a common scenario with MQTT or IoT connections.

Example usage:
$ mitmproxy --set request_client_cert=True --set client_certs=some_directory/

With `some_directory/` containing a `mqtt.example.com.pem` x509 certificate file (including private key).

This allows a client connecting using mTLS, to be intercepted by mitmproxy, which is itself establishing an mTLS connection to the `mqtt.example.com` upstream server. Restricting the client_certs using a directory and PEM files named after the upstream domain, narrows down the mTLS requirement to this single domain, while leaving all other traffic through mitmproxy untouched (normal TLS without client certs).

* add CHANGELOG entry

* docs++

* swap section order, re-add example

---------

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2024-09-18 19:48:41 +02:00
Matteo Luppi
9740477e8b
Feature/local applications selector (#7141)
* add refresh icon

* first draft drop down

* create logic to store and display current applications + fix old tests

* [autofix.ci] apply automated fixes

* filter applications based on the input

* add classname prop to popover

* add icon classname to popover

* change design local dropdown and applications list

* adjust focus popover and dropdown

* fetch all current processes

* [autofix.ci] apply automated fixes

* add icon while fetching

* adjust icon rendering

* remove icon from interface

* add possibility to remove application

* remove checkmarks popover

* fix icon application

* [autofix.ci] apply automated fixes

* move popover to the bottom

* fix clasname test

* loading lazy img

* move processes to a redux state

* change naming variables

* [autofix.ci] apply automated fixes

* leftover

* adjust naming style

* update snapshot

* move the current processes in a dedicated redux state

* not use display_name anymore for spec

* [autofix.ci] apply automated fixes

* add comments

* add tests local dropdown

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-09 13:38:35 +02:00
Matteo Luppi
8195d686ce
improve UX reverse dropdown (#7164)
* use select

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-06 11:00:44 +02:00
Matteo Luppi
59129de1fb
Improve design capture page (#7160)
* improve style capture page

* use left-border

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-04 16:23:06 +02:00
Matteo Luppi
401b5c0198
add popover to reverse mode (#7161) 2024-09-04 15:23:37 +02:00
Matteo Luppi
d18e21fb76
Click on mode's label to activate it (#7153)
* add click event on label to activate mode

* use <label> tag instead of <span>
2024-09-04 15:01:09 +02:00
Matteo Luppi
92faf3959f
Feature/dns and upstream (#7110)
* move reverse row into reverse component

* add upstream mode

* update test state

* add dns mode

* add tests

* [autofix.ci] apply automated fixes

* review changes

* [autofix.ci] apply automated fixes

* wording nits

* nit

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-08-28 19:20:49 +02:00
Gaurav Jain
6bb536e0ff
add addon to update the ports in alt-svc header in reverse mode (#7093)
* Add addon to update the ports in alt-svc header to the port that we're listening on

* [autofix.ci] apply automated fixes

* Add suggested changes

* Add tests

* [autofix.ci] apply automated fixes

* mypy

* style

* [autofix.ci] apply automated fixes

* Add CHANGELOG entry

* [autofix.ci] apply automated fixes

* nits

* [autofix.ci] apply automated fixes

* nit: improve option wording

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-08-17 16:20:31 +00:00
Matteo Luppi
be4ba1153c
add popover to socks and transparent (#7108)
add popover
2024-08-15 19:35:24 +02:00
Matteo Luppi
aa7a912d89
Feature/popover modes (#7078)
* create UI popover for mode configurations

* add listen_host support to regular mode

* add listen_host, port and path to wireguard mode

* leftover

* [autofix.ci] apply automated fixes

* adapt popover to new rtk logic

* update snapshots

* use popover api

* [autofix.ci] apply automated fixes

* popovers: simplify css, make popover render ok on browsers without anchor support

* fix tests

* [autofix.ci] apply automated fixes

* coverage++

* doc++

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2024-08-15 11:30:41 +02:00
Matteo Luppi
c8cbb71f56
Feature/socks and transparent modes (#7100)
* add transparent mode

* add tests transparent

* add socks mode

* update tests socks

* [autofix.ci] apply automated fixes

* review changes

* adapt socks and transparent to new server status logic

* review changes

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-15 11:18:23 +02:00
Maximilian Hils
30e7590ba3
Capture tab nits (#7102)
* capture tab: style 'add' button

* capture tab: improve message during mode startup

* capture tab: make first reverse proxy irremovable

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-14 16:54:25 +02:00
Matteo Luppi
51b45b8599
Display current status for each mode (#7097)
* display current status for each mode

* review changes

* update snapshots

* update tests

* [autofix.ci] apply automated fixes

* fix bug

* use type

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-14 15:48:36 +02:00
Matteo Luppi
0f42f00baa
hide local mode on linux in mitmweb (#7094)
* hide local mode on linux

* expose platform from the server

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-12 18:14:38 +02:00
Maximilian Hils
04cd12b742
Mode Reducer: port to redux toolkit api (#7089)
* wip

* change backend state to spec -> ServerInfo mapping, add types

* migrate regular and reverse proxy modes to redux toolkit

* fixups

* move spec getter out of ducks

* move default reverse server config

* adapt tests for regular mode

* [autofix.ci] apply automated fixes

* update tests reverse

* getSpec test into utils

* update wireguard mode using rtk

* update tests wireguard

* leftover

* [autofix.ci] apply automated fixes

* adapt local mode to rtk

* update last tests

* [autofix.ci] apply automated fixes

* add tests error handling

* unify state update logic for modes with a single server

* review changes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
2024-08-08 22:11:57 +02:00
Matteo Luppi
f32509da8b
Feature/multiple reverse servers (#7029)
* add button to add new server (just design)

* adjust font weight

* defining interfaces for handling multiple servers

* [autofix.ci] apply automated fixes

* use index to access single reverse server

* handle single errors

* [autofix.ci] apply automated fixes

* first prototype: still not working as expected when changing the order of the servers

* almost found a solution using the map

* remove the map, using a different approach

* extract listen address helper

* move off includeModeState

* simplify reverse proxy updates

* add deletion single reverse config

* update tests

* [autofix.ci] apply automated fixes

* update tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-08-06 21:18:23 +02:00
Matteo Luppi
66806740f3
Add listen_host and listen_port to wireguard and listen_host to regular (#7086)
* create functions to set listen host and port to wireguard mode

* update tests wireguard

* add listen host to regular
2024-08-06 17:42:26 +02:00
Maximilian Hils
091399f811
Add experimental option for HTTP/3 in transparent mode (#7037)
* add experimental option for HTTP/3 in transparent mode

* fix test

* fix next layer selection for raw quic

* tests++

* remove leftover constant
2024-07-25 17:29:04 +05:30
Maximilian Hils
fa1633842a
web: add index column (#7039)
* web: add index column

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-25 12:07:34 +02:00
Gaurav Jain
317f5b9dce
Support all query types in DNS mode (#6975)
* Use mitmproxy_rust's getaddrinfo to resolve domain names

* Use mitmproxy.DnsResolver for A/AAAA queries and forward other queries to dns server

* [autofix.ci] apply automated fixes

* Add suggested changes

* [autofix.ci] apply automated fixes

* nits

* lazy-load resolver

* fix lookup of non A/AAAA records

* bump required mitmproxy_rs version

* [autofix.ci] apply automated fixes

* Add tests

* Update CHANGELOG

* [autofix.ci] apply automated fixes

* Fix tests

* [autofix.ci] apply automated fixes

* Fixup

* Fixup

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-07-16 17:31:11 +02:00
Pet Sneakers
71d7b3d6e7
Include Host header with CONNECT requests. Fixes #7019. (#7021)
* Include Host header with CONNECT requests. Fixes #7019.

* [autofix.ci] apply automated fixes

* Update CHANGELOG

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-16 15:43:11 +02:00
Matteo Luppi
9c99bf4485
Feature/single reverse mode (#7012)
* add reverse mode (UI)

* make dropdown functional and add input field for port

* finally make reverse mode functional

* adjust placeholders

* fix eslint

* [autofix.ci] apply automated fixes

* change host to destination

* create specific function for partition

* generate protocols

* [autofix.ci] apply automated fixes

* update protocols using BACKEND_CONSTS

* change name partition function

* move to enum for protocols

* [autofix.ci] apply automated fixes

* adapt protocols to enum

* write test for reverse mode

* [autofix.ci] apply automated fixes

* update changelog

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-16 15:42:21 +02:00