Commit Graph

9167 Commits

Author SHA1 Message Date
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
Denis Kasak
856a35af6d
Use original flow host instead of IP when exporting to curl/httpie. (#4307)
Use original flow host instead of IP when exporting to curl/httpie.

Unless this is done, the SNI server name will not be sent, often making
the curl/httpie command have different behaviour than the original
request (most often in the form of failing to establish a TLS
connection).

With this change, we always use the original host, fixing this failure.
However, if the original host is a domain, it may sometimes resolve to
a different IP address later on. In curl, we solve this problem by
forcing it to connect to the original IP using `--resolve`. For httpie
there is currently no easy solution (see:
https://github.com/httpie/httpie/issues/414).
2021-02-09 18:44:46 +00:00
Alexander Prinzhorn
4212a56f25
Collect all flow filter matches before modifying headers, fixes #4245 (#4246) 2021-02-09 19:37:46 +01:00
Siddharth Balyan
2e3d481544
Merge pull request #4435 from alt-glitch/master
Issue 4390: Using xdg-open to open default browser
2021-02-09 12:39:14 +01:00
Maximilian Hils
08d1f67e5b
[requires.io] dependency update on master branch (#4431)
Co-authored-by: requires.io <support@requires.io>
2021-02-08 16:46:57 +00:00
Maximilian Hils
bc3f39a202
Merge pull request #4427 from mhils/reorg
Improve module structure
2021-02-05 08:59:34 +01:00
Maximilian Hils
ca578181e3 adjust tests, increase coverage 2021-02-05 08:44:17 +01:00
Maximilian Hils
afd00785c8 docs: flow.Error 2021-02-05 08:44:17 +01:00
Maximilian Hils
dc6c5f55cd move Connections to mitmproxy.connection 2021-02-05 08:44:17 +01:00
Maximilian Hils
d68c364b35 inline/move http.make_* functions 2021-02-05 08:43:15 +01:00
Maximilian Hils
9409bf0368 move Headers/Message/Request/Response into mitmproxy.http 2021-02-05 08:43:15 +01:00
Maximilian Hils
a69ef1ec95
Merge pull request #4428 from sanlengjingvv/develop
Imporove document, pip install -e .[dev] error in mac zsh
2021-02-05 08:42:08 +01:00
sanlengjingvv
76d4c80df1 Imporove document, pip install -e .[dev] error in mac zsh 2021-02-05 11:11:23 +08:00
Maximilian Hils
c5bd7b1ae1
Merge pull request #4426 from mhils/mypy
update mypy
2021-02-04 03:36:25 +01:00
Maximilian Hils
990116b44a update mypy 2021-02-03 23:03:49 +01:00
Maximilian Hils
50ae75aedf
Merge pull request #4413 from r00t-/compat_convert_fix
fix conversion of old flows failing due to missing array keys
2021-02-03 19:54:24 +01:00
Maximilian Hils
bd0e5989e2 add websocket flow conversion test 2021-02-03 19:27:15 +01:00
Maximilian Hils
faeb9678f1 test dumpfiles: .bin -> .mitm 2021-02-03 19:27:15 +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
Anatoli Babenia
578514d4f2
Use ? to exit from help if already there (#4420)
* Use `?` to exit from help if already there

* Add `?` help exit shortcut to CHANGELOG
2021-02-03 00:15:42 +01:00
Maximilian Hils
fccc153fdb
api docs++ (#4421) 2021-02-03 00:14:54 +01:00
r00t
9af41b7f72 fix conversion of old flows failing due to missing array keys 2021-01-25 16:27:33 +01:00
zivillian
a793a6256a
fix --certs argument (#4412)
the help output claims that --certs is correct
2021-01-24 22:12:16 +01:00
Graham Robbins
2694b05fe9
Extract port number from authority before IDNA decode (#4410)
* Extract port from authority before IDNA decode

A UnicodeError exception may be raised if the port is present

* Update Changelog

* Test for badly formed byte input
2021-01-24 20:45:01 +01:00
Thomas Kriechbaumer
9e09b58e78
Merge pull request #4399 from mhils/no-dev-scripts
Make development setup instructions more clear
2021-01-24 11:50:49 +01:00
Maximilian Hils
ea624ae6e3
clean doc folder before building, fixes #4405 (#4406) 2021-01-22 01:40:08 +01:00
Thomas B Homburg
4be69a5fc7
GraphQL content-view (#4396)
* Add GraphQL contentview

* Simpler graphql formatting

* Do not prompt for exit

* Give graphql priority over json

* Revert "Do not prompt for exit"

This reverts commit 386b38f9eb4601ae41365ace5b9689c30761a412.

* Handle batched queries

* Fix flake issues

* typing fix

* Typing fixes

* Add graphql content view test

* Fix reference

* Fixed tests

* flake

* Implement GraphQLView.render_priority

* Show query key stub value

* Code coverage

* Import PARSE_ERROR

* Test for invalid json
2021-01-22 00:29:09 +01:00
Maximilian Hils
0a4e2c9b59
Merge branch 'master' into no-dev-scripts 2021-01-21 11:05:05 +01:00
Maximilian Hils
494ccb5a22 remove requirements.txt 2021-01-20 15:06:02 +01:00
Maximilian Hils
179fe42ff7
fix race condition in NextLayer addon (#4403) 2021-01-20 15:03:55 +01:00
Maximilian Hils
05a43572c8 make development setup instructions more clear
Our dev.sh/dev.ps1 scripts feel like an unnecessary layer of abstraction.
The revised docs make the install process transparent to experienced users,
and can also be easily reused for other projects (hi, pdoc!).
2021-01-18 13:56:27 +01:00
Thomas Kriechbaumer
e5ca412fbf
Merge pull request #4386 from Kriechi/gh-bug-report
deep-link to GitHub issues page on crashes
2021-01-17 11:40:33 +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
a11cfd45c4
[requires.io] dependency update on master branch (#4391)
Co-authored-by: requires.io <support@requires.io>
2021-01-17 10:38:47 +00:00
Thomas Kriechbaumer
dd93e63fd4 deep-link to GitHub issues page on crashes 2021-01-17 11:27:50 +01:00
Maximilian Hils
a92279e69f
Merge pull request #4398 from mhils/pdoc
duplicate hooks: warn instead of raise
2021-01-16 20:37:52 +01:00
Maximilian Hils
8dda8fc0f7 duplicate hooks: warn instead of raise
raising causes issues when using pdoc's live reloading, this should fix it.
2021-01-16 20:31:50 +01:00
Maximilian Hils
f6df2be863
Merge pull request #4395 from nomeata/master
Upon --replace, suggest --modify-body / --modify-headers
2021-01-15 11:41:27 +01:00
Joachim Breitner
b290594d93 Upon --replace, suggest --modify-body / --modify-headers
Else the user sees
```
--replace is deprecated.
Please use `--replacements` instead.
mitmdump: error: unrecognized arguments: --replace
```
and then
```
mitmdump: error: unrecognized arguments: --replacements
--replacements is deprecated.
Please use `--modify-body` or `--modify-headers` instead.
```
and feels silly
2021-01-15 10:53:16 +01:00
Maximilian Hils
ad3995f4f0
remove outdated tox env 2021-01-13 17:35:15 +01:00
Maximilian Hils
ff624d0b87 fix #4387 2021-01-06 10:47:37 +01:00
Maximilian Hils
4909198da7
Merge pull request #4377 from mhils/events
Add mitmproxy.Events
2021-01-05 22:08:19 +01:00
Maximilian Hils
ec9bc455c0 remove ci credential check
it turns out pull requests from trusted contributors do have access to secrets,
so we can't do that check. Checking for the repo only doesn't make much sense.
2021-01-05 22:00:54 +01:00
Maximilian Hils
81f8f06a11 converge on hooks, events, and commands 2021-01-05 22:00:54 +01:00
Maximilian Hils
6c0e4f1cb7 streamline event/hook/command naming conventions 2021-01-05 21:54:44 +01:00
Maximilian Hils
90df4168f8 coverage++ 2021-01-05 21:54:44 +01:00
Maximilian Hils
667cacba3f generate event documentation from source 2021-01-05 21:54:44 +01:00
Maximilian Hils
f9d18745c9 add MitmproxyEvent for addon events
We previously defined the list of all allowed events in mitmproxy.eventsequence,
without specifying the expected arguments at all. This commit changes our addon
event dispatch to subclasses of MitmproxyEvent, which have well-defined attributes.
2021-01-05 21:54:44 +01:00
Maximilian Hils
9186c1aeb5 add Client/Server.__str__ 2021-01-05 21:54:44 +01:00
Maximilian Hils
cca242a581 Windows: build pyinstaller onedir and use it for installer
This greatly improves startup time as pyinstaller doesn't have to
unpack everything on startup. The same also applies to macOS and Linux,
but there we 1) don't have installers to hide all the files and
2) have a filesystem that deals much better with lots of small files.

Additionally, simplify cibuild to be a bit more reasonable.
2021-01-05 15:56:33 +01:00