Commit Graph

7197 Commits

Author SHA1 Message Date
Aldo Cortesi
4d358c49fb WIP: autocompletion 2017-12-15 10:07:47 +13:00
Aldo Cortesi
0cd4a77268 commands: add a parser for partial commands
We only return Cmd and str types for the moment.
2017-12-15 10:07:47 +13:00
Aldo Cortesi
e64d5c6bb9 commands: add a Cmd argument type
This represents a command passed as an argument. Also split arguments from
command values themselves, making the command help for meta-commands much
clearer.
2017-12-15 10:07:47 +13:00
Aldo Cortesi
04e19f9171 Introduce a custom widget for command editing
The builtin urwid.Edit widget is not sufficiently flexible for what we want to
do.
2017-12-15 10:07:47 +13:00
Aldo Cortesi
21324086c3
Merge pull request #2674 from mhils/issue-2620
Fix #2620
2017-12-15 10:05:40 +13:00
Aldo Cortesi
dfcf62ff2b
Merge pull request #2545 from mitmproxy/wsproto
Replace our WebSocket stack with wsproto
2017-12-15 09:49:24 +13:00
Aldo Cortesi
d9848a8bc1
Merge pull request #2675 from mhils/issue-2673
Fix #2673
2017-12-15 09:48:41 +13:00
Maximilian Hils
9f3806e27a fix #2673 2017-12-14 18:05:36 +01:00
Maximilian Hils
842c9f72f7
Merge pull request #2671 from mhils/command-argtypes
Introduce @command.argument
2017-12-14 17:34:25 +01:00
Maximilian Hils
b9973bfbcf simplify path type
the previous implementation crashed the typechecker, as typing.NewType
does not return a proper type that can be used for isinstance() checks.
2017-12-14 15:44:49 +01:00
Maximilian Hils
0af6e2e97f adjust tests 2017-12-14 15:44:47 +01:00
Maximilian Hils
079507e4b6 fix #2620
We previously had the problem that overriding keypress() skipped
the proper calculation of the top widget's size, leading to broken
scrolling behavior in the flowlist. We now always use urwid.Frame's
keypress method, but we make sure that urwid.Pile and urwid.Columns
delegate to the currently focused component.
2017-12-14 14:59:07 +01:00
Maximilian Hils
b725e40b12 fix keybinding help strings 2017-12-14 14:41:43 +01:00
Maximilian Hils
20372b5b0b introduce @command.argument
This makes it possible to specify more specific type annotations at runtime,
so that both mypy and our command system are happy. The .argument(name, type=)
syntax is similar to click's, so it should be fairly extensible if we need it.
2017-12-14 14:15:36 +01:00
Aldo Cortesi
62561ed428
Merge pull request #2669 from cortesi/path
commands: add a Path argument type
2017-12-14 07:42:12 +13:00
Maximilian Hils
5e0e08a4d6
Merge pull request #2670 from Kriechi/fix-2664
fix #2664
2017-12-13 13:50:43 +01:00
Thomas Kriechbaumer
488ec6f3f1 fix #2664 2017-12-13 09:45:40 +01:00
Aldo Cortesi
79cf6d2a5d
Merge pull request #2668 from cortesi/commandopts
Command improvements
2017-12-13 14:42:56 +13:00
Aldo Cortesi
e63bb8cde5 commands: add a Path argument type
This is just an alias for str, and in this patch is used mostly to give an
appropriate type in help strings. More to come.

Fixes #2198
2017-12-13 14:41:46 +13:00
Aldo Cortesi
4cee1a4f96 commands: formalise a Choice type
This resolves as a string during MyPy checks, but at runtime has an additional
attribute that is a command that returns valid options.

This is very ugly and clumsy, basically because MyPy is super restrictive about
what it accepts as a type. Almost any attempt to construct these types in a
more sophisticated way fails in one way or another. I'm open to suggestions.
2017-12-13 11:08:14 +13:00
Maximilian Hils
1a45cf17b3
Merge pull request #2643 from Ga-ryo/master
Fix #2594
2017-12-12 22:40:47 +01:00
Thomas Kriechbaumer
f5fafbfcb5 vendoring of wsproto
https://github.com/python-hyper/wsproto.git
commit 5ea2da61266796666f5de6461aaae22e6b00deba
2017-12-12 22:09:46 +01:00
Thomas Kriechbaumer
70e1409261 docs++: add websocket PING/PONG 2017-12-12 22:09:46 +01:00
Thomas Kriechbaumer
3cb459d56d docs++: add individual protocol pages 2017-12-12 22:09:46 +01:00
Ujjwal Verma
5214f544e7 Use wsproto for websockets 2017-12-12 22:09:46 +01:00
Thomas Kriechbaumer
130021b76d prepare WebSocket stack to move to wsproto 2017-12-12 22:09:46 +01:00
Maximilian Hils
8e9194c2b4 fix #2529 2017-12-12 16:46:35 +01:00
Maximilian Hils
4d924dcfe2 fix #2651 2017-12-12 15:56:16 +01:00
Maximilian Hils
0fb48bc6a7 minor improvements, add tests for ipv4-mapped addresses 2017-12-12 14:00:12 +01:00
@Ga_ryo_
d181b4643f Fix #2594 2017-12-12 14:00:09 +01:00
Aldo Cortesi
472d122c12
Merge pull request #2662 from mhils/pathod-connect-host
Add host header to pathoc's CONNECT requests
2017-12-12 21:54:27 +13:00
Aldo Cortesi
25cf3db658
Merge pull request #2661 from mhils/browser-win
Fix browser addon on Windows
2017-12-12 09:10:05 +13:00
Aldo Cortesi
91a2979694 console: refactor console.flowview.mode
We now have:

console.flowview.mode           gets the current mode
console.flowview.mode.options   gets the possible options for the mode
console.flowview.mode.set       sets the flowview mode

This is quite a common pattern in our commands, to the point where we should
formalise it.

Fixes #2655
2017-12-12 09:08:57 +13:00
Aldo Cortesi
322af02eb2 minor: clarify docs for command.edit.focus*
Fixes #2653
2017-12-12 08:50:44 +13:00
Maximilian Hils
7f8a598097 add host header to pathoc's CONNECT requests
This is required by the new HTTP RFCs.
2017-12-11 20:20:03 +01:00
Aldo Cortesi
4912920573
Merge branch 'master' into browser-win 2017-12-12 08:03:09 +13:00
Thomas Kriechbaumer
b09c28d8a6
[requires.io] dependency update on master branch (#2637) 2017-12-11 17:04:33 +01:00
Maximilian Hils
7654ad2d31 fix browser addon on Windows 2017-12-11 10:46:55 +01:00
Aldo Cortesi
b8cbb4dce8 commands: verify command function signatures before call (#2659)
Fixes #2652, and many other possible crashes on user input.
2017-12-11 10:03:07 +01:00
Aldo Cortesi
472a740440
Merge pull request #2656 from cortesi/browseraddon
browser addon: start an isolated browser attached to the proxy
2017-12-11 09:13:30 +13:00
Aldo Cortesi
aeefcd08a4 browser addon: start an isolated browser attached to the proxy
A simple addon that starts an instance of Chrome attached to the current
proxy. The instance is isolated in its own user data directory, and addons are
turned off.

Future work:

- I wasn't able to test the Windows executable path - a Windows dev should
confirm this for us.
- In future it would be nice to support other browsers like Firefox.
2017-12-10 18:26:24 +13:00
Suraj Tripathi
5067438ec1 Bug in expected_http_body_size fix (#2642)
fixes #2618
2017-11-27 19:01:32 +01:00
Matthew Shao
46901d1d55 Fix #2635, mitmdump does not apply filter to saved data. (#2636) 2017-11-22 14:26:20 +11:00
Maximilian Hils
168c72a55f
Merge pull request #2621 from mhils/clientreplay
Improve Clientreplay
2017-11-16 18:33:08 +11:00
Thomas Kriechbaumer
59af6af0f7
[requires.io] dependency update on master branch (#2629) 2017-11-15 12:56:38 +01:00
Thomas Kriechbaumer
58c330e7f1
Merge pull request #2626 from mitmproxy/requires-io-master
[requires.io] dependency update on master branch
2017-11-11 11:47:02 +01:00
requires.io
d00804656d [requires.io] dependency update 2017-11-10 21:44:26 +01:00
Thomas Kriechbaumer
68c259293e
[requires.io] dependency update on master branch (#2623) 2017-11-10 11:14:41 +01:00
Maximilian Hils
4a2a718bc2 improve clientreplay addon
- always refresh UI after flow is finished (refs #2616)
 - count currently active replay
 - make replay thread daemonic so that users can exit mitmproxy
   if replay hangs. This is not perfect yet, but vastly better
   than how it has been.
2017-11-07 11:49:12 +01:00
Maximilian Hils
e6e28c2ac3 fix revert of duplicated flows 2017-11-06 15:24:54 +01:00