mitmproxy/web
Maximilian Hils 7fdf111feb
mitmweb: Add Capture Tab (#6999)
* Squashed commit of the following:

commit 5ca998dd9ece4292407e42d6b2989703b5b0e562
Author: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
Date:   Wed Jun 26 17:27:47 2024 +0200

    Sync capture tab to main (#6963)

    * Update CHANGELOG.md

    * Autofix generated JS files and do not patch them in tests (#6910)

    * autofix generated JS files and do not patch them in tests

    * autofix: setup python

    * [autofix.ci] apply automated fixes

    * autofix: setup node

    * add missing newline

    * fixup

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * Update package-lock.json, bump esbuild (#6915)

    update node version, bump esbuild

    * Fix clipboard handling in safari (#6917)

    * fix clipboard handling in safari

    closes #6911, #6909

    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>

    * [autofix.ci] apply automated fixes

    * update dependencies

    ---------

    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * mitmproxy 10.3.1

    * reopen main for development

    * release script: add one less newline

    * fix zstd decompression (#6921)

    * fix zstd decompression (issue #6914)

    * add our fix to CHANGELOG

    * add explicit read_across_frames=True + move zstd test to test_encoding.py

    ---------

    Co-authored-by: Maximilian Hils <git@maximilianhils.com>

    * Update CHANGELOG.md

    * web: Upgrade Redux (#6926)

    * update redux and fix resulting test and type failures
    * update prettier

    * Use upstream urwid again (#6929)

    use upstream urwid again

    * Add `HttpConnectedHook` and `HttpConnectErrorHook` (#6930)

    * Add HttpConnectedHook and HttpConnectErrorHook

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * make DNS mode listen for both UDP and TCP (#6912)

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * release ci: strip "v" prefix from sigstore file

    * fix: OSError raised when ipv6 is disabled (#6942)

    the function should return None in this case

    * Update autofix action (#6946)

    update autofix action

    * Fix issue #6944: Optimize response/request_body_buf by using list of byte chunks to avoid concatenation overhead (#6952)

    * Fix the issue #6944: non-linear growth in processing time with mitmproxy regarding packet size. Replace the string (bytes) concatenation implementation of request_body_buf and response_body_buf to a list of chunk of bytes.

    * Update the CHANGELOG.md regarding issue #6944

    * [autofix.ci] apply automated fixes

    * Update CHANGELOG.md

    * [autofix.ci] apply automated fixes

    * move receivebuffer into dedicated class

    * [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>

    * Use existing API to unpack/pack domain names in HTTPS records (#6949)

    * Use existing API to unpack/pack domain names in HTTPS records

    * [autofix.ci] apply automated fixes

    * tangentially related grammar fix

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Maximilian Hils <github@maximilianhils.com>

    * Add support for DNS over TCP (#6935)

    * Parse DNS over TCP messages

    * [autofix.ci] apply automated fixes

    * Update _next_layer to detect DNS over TCP messages

    * [autofix.ci] apply automated fixes

    * Fixup

    * allow query pipelining

    * [autofix.ci] apply automated fixes

    * Restructure pack/unpack mechanism and update tests

    * Add tests

    * [autofix.ci] apply automated fixes

    * [autofix.ci] apply automated fixes (attempt 2/3)

    * [autofix.ci] apply automated fixes

    * [autofix.ci] apply automated fixes

    * Update next_layer test

    * Add suggested changes

    * [autofix.ci] apply automated fixes

    * bump minimum hypothesis version

    * bump hypothesis for good

    * Update CHANGELOG.md

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Maximilian Hils <git@maximilianhils.com>

    * web: fix "show more" button (#6958)

    fix #6951

    ---------

    Co-authored-by: Maximilian Hils <git@maximilianhils.com>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>
    Co-authored-by: mitmproxy release bot <noreply@mitmproxy.org>
    Co-authored-by: Andras Spitzer <sendai@swordsaint.net>
    Co-authored-by: Gaurav Jain <64748057+errorxyz@users.noreply.github.com>
    Co-authored-by: Walt Chen <godsarmycy@gmail.com>
    Co-authored-by: jackfromeast <thisiszhengyu@gmail.com>
    Co-authored-by: Maximilian Hils <github@maximilianhils.com>
    Co-authored-by: Alexander Prinzhorn <alexander@prinzhorn.it>

commit e047e76b226b335698ac1f56527558e5c9841114
Author: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
Date:   Wed Jun 26 13:07:27 2024 +0200

    Feature/wireguard mode (#6959)

    * define first components

    * Update CHANGELOG.md

    * Autofix generated JS files and do not patch them in tests (#6910)

    * autofix generated JS files and do not patch them in tests

    * autofix: setup python

    * [autofix.ci] apply automated fixes

    * autofix: setup node

    * add missing newline

    * fixup

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * Update package-lock.json, bump esbuild (#6915)

    update node version, bump esbuild

    * Fix clipboard handling in safari (#6917)

    * fix clipboard handling in safari

    closes #6911, #6909

    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>

    * [autofix.ci] apply automated fixes

    * update dependencies

    ---------

    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * define first modes components

    * adapt code to reuse checkbox component

    * mitmproxy 10.3.1

    * reopen main for development

    * [autofix.ci] apply automated fixes

    * improve mode toggle design

    * remove inline style

    * release script: add one less newline

    * fix zstd decompression (#6921)

    * fix zstd decompression (issue #6914)

    * add our fix to CHANGELOG

    * add explicit read_across_frames=True + move zstd test to test_encoding.py

    ---------

    Co-authored-by: Maximilian Hils <git@maximilianhils.com>

    * first attempt to make the modes functional

    * [autofix.ci] apply automated fixes

    * Update CHANGELOG.md

    * web: Upgrade Redux (#6926)

    * update redux and fix resulting test and type failures
    * update prettier

    * refactor code according to review

    * [autofix.ci] apply automated fixes

    * first prototype regular mode

    * [autofix.ci] apply automated fixes

    * Use upstream urwid again (#6929)

    use upstream urwid again

    * change name regular duck

    * Add `HttpConnectedHook` and `HttpConnectErrorHook` (#6930)

    * Add HttpConnectedHook and HttpConnectErrorHook

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * rewrite updateMode function and error handling regular mode

    * remove label component

    * add input field to local mode and fix onKeyDown issue

    * add dropdown to reverse mode

    * [autofix.ci] apply automated fixes

    * change defualt string reverse dropdown

    * add new logic to handle modes in the duck

    * add local mode with no applications

    * [autofix.ci] apply automated fixes

    * regular mode is now persistent

    * forgot recieve event in regular mode

    * join receive and update event

    * make local mode functional

    * make wireguard mode functional

    * [autofix.ci] apply automated fixes

    * make reverse mode functional

    * [autofix.ci] apply automated fixes

    * fix bug reverse mode when refreshing

    * fix bug local mode

    * [autofix.ci] apply automated fixes

    * fix old test

    * implement first tests

    * [autofix.ci] apply automated fixes

    * make DNS mode listen for both UDP and TCP (#6912)

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * remove wireguard and reverse modes

    * change name function to set local applications

    * remove error handling

    * remove left over

    * add some other review changes

    * [autofix.ci] apply automated fixes

    * release ci: strip "v" prefix from sigstore file

    * fix addListen Addr function

    * adjust reverse protocol attribute

    * create proper method to parse the mode

    * adjust passing applications to local mode

    * fix onKeyDown listener and add new input field to local mode

    * [autofix.ci] apply automated fixes

    * remove leftover

    * update tests

    * [autofix.ci] apply automated fixes

    * remove wireguard and reverse files

    * remove additional state local mode

    * adjust tests local mode

    * update tests local mode

    * update last tests modes

    * [autofix.ci] apply automated fixes

    * fix: OSError raised when ipv6 is disabled (#6942)

    the function should return None in this case

    * use fetchMock instead of jest.mock

    this is slightly nicer because we are testing at the application boundary

    * duck tests should use action creators and not manually construct actions

    * move toggleLocal to fetchMock

    * move updateMode and ModeState into utils

    this avoids circular imports. utils may not be the perfect place, but much better than the circular imports

    * nits

    * [autofix.ci] apply automated fixes

    * update tests regular and local mode

    * [autofix.ci] apply automated fixes

    * review changes tests

    * [autofix.ci] apply automated fixes

    * adjust parseMode issue

    * [autofix.ci] apply automated fixes

    * add first components for wireguard mode

    * fix CI

    * fix typo

    * add tests to wireguard mode

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: Maximilian Hils <git@maximilianhils.com>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>
    Co-authored-by: mitmproxy release bot <noreply@mitmproxy.org>
    Co-authored-by: Andras Spitzer <sendai@swordsaint.net>
    Co-authored-by: Gaurav Jain <64748057+errorxyz@users.noreply.github.com>
    Co-authored-by: Walt Chen <godsarmycy@gmail.com>

commit d9770ad2b1c41737119cbcea9b8dd938d9dcc421
Author: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
Date:   Mon Jun 24 19:40:47 2024 +0200

    Feature/implement mvp new tab page (#6923)

commit afb22c210500a320fef8bc1bb16094a2b36c5b21
Author: Maximilian Hils <git@maximilianhils.com>
Date:   Fri Jun 21 23:09:31 2024 +0200

    Sync `capture-tab` with `main` (#6943)

    * Update CHANGELOG.md

    * Autofix generated JS files and do not patch them in tests (#6910)

    * autofix generated JS files and do not patch them in tests

    * autofix: setup python

    * [autofix.ci] apply automated fixes

    * autofix: setup node

    * add missing newline

    * fixup

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * Update package-lock.json, bump esbuild (#6915)

    update node version, bump esbuild

    * Fix clipboard handling in safari (#6917)

    * fix clipboard handling in safari

    closes #6911, #6909

    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>

    * [autofix.ci] apply automated fixes

    * update dependencies

    ---------

    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * mitmproxy 10.3.1

    * reopen main for development

    * release script: add one less newline

    * fix zstd decompression (#6921)

    * fix zstd decompression (issue #6914)

    * add our fix to CHANGELOG

    * add explicit read_across_frames=True + move zstd test to test_encoding.py

    ---------

    Co-authored-by: Maximilian Hils <git@maximilianhils.com>

    * Update CHANGELOG.md

    * web: Upgrade Redux (#6926)

    * update redux and fix resulting test and type failures
    * update prettier

    * Use upstream urwid again (#6929)

    use upstream urwid again

    * Add `HttpConnectedHook` and `HttpConnectErrorHook` (#6930)

    * Add HttpConnectedHook and HttpConnectErrorHook

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * make DNS mode listen for both UDP and TCP (#6912)

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * release ci: strip "v" prefix from sigstore file

    * fix: OSError raised when ipv6 is disabled (#6942)

    the function should return None in this case

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Can Yesilyurt <36952967+canyesilyurt@users.noreply.github.com>
    Co-authored-by: mitmproxy release bot <noreply@mitmproxy.org>
    Co-authored-by: Andras Spitzer <sendai@swordsaint.net>
    Co-authored-by: Gaurav Jain <64748057+errorxyz@users.noreply.github.com>
    Co-authored-by: Walt Chen <godsarmycy@gmail.com>

commit d0867f66d65c0b85340518712d6ce75147be8aad
Author: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
Date:   Mon Jun 10 11:27:54 2024 +0200

    Feature/add new capture tab (#6887)

    * add just the new tab to the header

    * remove header menu from capture tab

    * create context to handle the current active menu tab

    * update tests

    * remove useless comments

    * update tests to reach higher coverage

    * remove context, use props to achieve same result

    * update tests

    * [autofix.ci] apply automated fixes

    * add test for capture menu component

    * adjust changelog format

    * [autofix.ci] apply automated fixes

    * fix CHANGELOG

    ---------

    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>

* Feature/regular mode port (#6965)

* add input field with default port to regular mode

* remove useless code

* make port functional

* fix tests

* add tests regular mode

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* Feature/error handling regular mode (#6972)

* first prototype error handling

* update tests , but failing

* [autofix.ci] apply automated fixes

* fix tests

* change error names

* [autofix.ci] apply automated fixes

* listen fro state updates instead of options ones

* forgot error state

* change backend config

* [autofix.ci] apply automated fixes

* Update mitmproxy/addons/proxyserver.py

* [autofix.ci] apply automated fixes

* fix tests

* change logic backend error

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Feature/error handling wireguard local (#6995)

* add error handling wireguard mode

* update tests wireguard mode

* add errror handling local mode and tests

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* add remianing modes message

* getMode returns if there aren't errors + update tests

* [autofix.ci] apply automated fixes

* move check inside includeModeState + tests

* remove useless checks

* modify toggle method for wireguard mode (test fails)

* fixups

* [autofix.ci] apply automated fixes

* add fetch tests

* add snapshot tests for regular mode ui

we want more of those once we have changed the structure of backendState.servers

* [autofix.ci] apply automated fixes

* nits

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>

* Web: Switch to flow list upon arrival of the first flow. (#7000)

* move active menu into redux state

this is necessary so that we can incorporate it into url state

* switch to flow list upon arrival of the first flow

* [autofix.ci] apply automated fixes

* simplify test

* update header.less

---------

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>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-05 20:53:14 +00:00
..
gen Update ruff requirement from <=0.4.7,>=0.4.1 to <=0.5.0,>=0.5.0 (#6990) 2024-07-02 12:07:47 +02:00
src mitmweb: Add Capture Tab (#6999) 2024-07-05 20:53:14 +00:00
.editorconfig
.prettierignore Add prettier to mitmweb (#5985) 2023-03-12 17:50:15 +01:00
gulpfile.js web: Upgrade Redux (#6926) 2024-06-14 00:27:33 +02:00
jest.config.js Add prettier to mitmweb (#5985) 2023-03-12 17:50:15 +01:00
package-lock.json web: Upgrade Redux (#6926) 2024-06-14 00:27:33 +02:00
package.json web: Upgrade Redux (#6926) 2024-06-14 00:27:33 +02:00
README.md Update package-lock.json, bump esbuild (#6915) 2024-06-12 11:44:25 +00:00
tsconfig.json web: Upgrade Redux (#6926) 2024-06-14 00:27:33 +02:00

Quick Start

  • Install mitmproxy as described in ../CONTRIBUTING.md
  • Run node --version to make sure that you have at least Node.js 18 or above. If you are on Ubuntu <= 22.04, you need to upgrade.
  • Run cd mitmproxy/web to change to the directory with package.json
  • Run npm install to install dependencies
  • Run npm start to start live-compilation
  • Run mitmweb after activating your Python virtualenv (see ../CONTRIBUTING.md).

Testing

  • Run npm test to run the test suite.

Code formatting

Architecture

There are two components:

Contributing

We very much appreciate any (small) improvements to mitmweb. Please do not include the compiled assets in mitmproxy/tools/web/static in your pull request. Refreshing them on every commit would massively increase repository size. We will update these files before every release.

Developer Tools