Compare commits

...

1128 Commits

Author SHA1 Message Date
Thomas Kriechbaumer
5654b6b82d Update certinstall.rst 2017-05-05 14:26:19 +02:00
Zhigang Fang
6c90d1361b Update style 2017-05-05 17:12:17 +08:00
Zhigang Fang
5962da4bbe Update spacing 2017-05-05 17:11:02 +08:00
Zhigang Fang
f946ed109b Add note for iOS version 10.3 or up 2017-05-05 17:10:14 +08:00
Maximilian Hils
d734f6bbd6 Merge pull request #2286 from charlesdhdt/master
Added LDAP Auth
2017-05-04 16:24:57 +02:00
Charles d'Hondt
154e8ac0fc fixed lint 2017-05-04 13:39:48 +02:00
Charles d'Hondt
f67d9adc31 Added ldap mock test 2017-05-04 13:25:15 +02:00
Maximilian Hils
40f387eb48 Merge pull request #2311 from mhils/issue-2310
fix #2310
2017-05-03 18:41:07 +02:00
Maximilian Hils
315daa042a fix #2310 2017-05-03 17:38:17 +02:00
Aldo Cortesi
822797c7e0 Merge pull request #2307 from cortesi/layouts
console: add a two-pane layout
2017-05-03 15:46:56 +12:00
Aldo Cortesi
2659b52209 console: add a two-pane layout
- Replace options.console_eventlog with options.console_layout
- This can be "single", "vertical" and "horizontal"
- At the base of the primary pane is the flowlist. At the base of the secondary
pane is the event log.
- Any of the other primary windows can be opened in each of the panes.

For now, I've bound "-" to the flow layout switch, "shift tab" to the layout
pane switch, and "P" to open the currently focused flow in whichever pane
you're in. These are just temporary  - we'll reassess the default bindings
carefully once the keybindings work is complete.
2017-05-03 14:55:02 +12:00
Maximilian Hils
e24ff261e7 Merge pull request #2306 from mhils/web-cov
Honest JS Coverage
2017-05-02 12:44:02 +02:00
Aldo Cortesi
0f4d94b31c console: Make EventLog its own control, bind to "E" 2017-05-02 22:42:04 +12:00
Maximilian Hils
63ffd9a3a9 honest js coverage 2017-05-02 11:34:42 +02:00
Charles d'Hondt
a68808294d lint checks 2017-05-02 10:35:56 +02:00
Charles d'Hondt
3f094a54ce added ldap3 to setup.py 2017-05-02 10:18:49 +02:00
Aldo Cortesi
9d2350b670 Merge pull request #2305 from cortesi/consolebugs
console: various bugfixes
2017-05-02 13:09:27 +12:00
Aldo Cortesi
dcae79e017 console: various bugs
- Action bar now correctly gets the palette background
- Viewing connection details for a killed flow no longer crashes
- Editing options with selections no longer crashes
2017-05-02 12:56:27 +12:00
Aldo Cortesi
4e39d387d3 commands: options control
Use the new commands to bind the Options view in console.
2017-05-02 12:18:24 +12:00
Aldo Cortesi
9e58c36639 console: globally respected nav commands
Use this to bind nav keys with commands throughout.
2017-05-02 12:18:24 +12:00
Aldo Cortesi
8d29492960 Merge pull request #2299 from iharsh234/mypy-pathod
Mypy Checking to pathod
2017-05-02 12:17:57 +12:00
harsh vijay
e24b4cc1b6 Extend Mypy checking to pathod
* mypy checking pathod

* initial commit , fixed errors

* tox: mypy checking to pathod

* Fixed mypy test failed

* issue was with args in custom_contentview.py

* tox: mypy checking to #2221

* follow-import=skip since we cant provide args to custom_contentview.py during mypy testing

* Lint , Typo Fixed

* code style: module import
2017-05-02 05:19:25 +05:30
Aldo Cortesi
53ad658e9f Merge pull request #2302 from cortesi/flowview
commands: view.setval, view.getval, view.setval.toggle
2017-05-01 20:17:24 +12:00
Aldo Cortesi
2f52d8b9ad commands: view.setval, view.getval, view.setval.toggle
Use these to bind the last of the key for flowview. Flow views are now 100%
keybound.
2017-05-01 19:52:24 +12:00
Aldo Cortesi
143872b574 Merge pull request #2301 from cortesi/encoding
commands: flow.encode, flow.decode, flow.encode.toggle
2017-05-01 19:52:00 +12:00
Aldo Cortesi
7d56ec9d49 commands: flow.encode, flow.decode, flow.encode.toggle
Use this to bind "z" in flowview.
2017-05-01 18:31:22 +12:00
Aldo Cortesi
06c99bffc3 Merge pull request #2300 from cortesi/consolerevamp
Console revamp
2017-05-01 18:29:44 +12:00
Aldo Cortesi
542a998174 commands: console.bodyview, console.choose
Use this to replace the "v" for view shortcut key in flowview.
2017-05-01 17:56:21 +12:00
Aldo Cortesi
1ea4a5a48e keymap: keys can now bind to multiple contexts
Use this to map the majority of the keys in flowview.
2017-05-01 16:52:58 +12:00
Aldo Cortesi
670d1e408b command: flow.set
Use this to replace the flow edit components of flowview entirely.
2017-05-01 14:56:57 +12:00
Aldo Cortesi
46373977e2 Refactor console
- All top-level window objects are now persistent. It turns out that urwid
keeps a reference to these even after they're no longer used, so they were
leaking before.
- Revamp editors to work with console commands, and start reworking bindings
for flowview.
2017-05-01 14:12:22 +12:00
Maximilian Hils
288448c575 Merge pull request #2285 from MatthewShao/jest-dev
[web] Add coverage for js/urlState.js
2017-04-30 18:26:41 +02:00
Matthew Shao
365677006c [web] Export updateUrlFromStore and updateStoreFromUrl 2017-04-30 22:40:58 +08:00
Maximilian Hils
fccc9bc45e Merge pull request #2271 from mhils/mitmweb-connection-indicator
[web] add connection indicator [WIP]
2017-04-30 15:23:20 +02:00
Aldo Cortesi
29ce5a83d2 Merge pull request #2297 from cortesi/flowcmd
commands: view.order.options, view.marked.toggle, view.create
2017-05-01 00:02:15 +12:00
Matthew Shao
a7feced5de [web] Introduce redux-mock-store and minor fix. 2017-04-30 20:00:36 +08:00
Aldo Cortesi
685487d33c commands: view.order.options, view.marked.toggle, view.create
And use these commands to remove the last hard-coded keybindings from flow
list. This means the flow list is now 100% command-driven, which is very
exciting.
2017-04-30 22:45:31 +12:00
Aldo Cortesi
b10a3992d8 Merge pull request #2296 from cortesi/viewload
commands: view.load
2017-04-30 22:30:29 +12:00
Aldo Cortesi
a570caccbd commands: view.load
Plus replace the flow list keybinding.
2017-04-30 22:02:29 +12:00
Aldo Cortesi
3cd93567f5 commands: support *args for commands
Use this to simplify meta-commands in console, and to create a console_choose
command that prompts the user for a choice, and then executes a command with
variable substitution.
2017-04-30 21:24:00 +12:00
Thomas Kriechbaumer
82f87919e2 fix markdown 2017-04-30 11:21:28 +02:00
Thomas Kriechbaumer
8a4a46e7d3 update docker-release tags during release 2017-04-30 11:19:55 +02:00
Aldo Cortesi
bcbe87bb09 Move export to addon, kill Python and Locust export
Also add a "raw" export format.

The Python and Locust exports are hard to maintain, their tests are extremely
brittle, they didn't have full test coverage, and are by my guess very rarely
used. I feel the Locust export should certainly be an externally maintained
addon. The Python/requests export can come back if someone cares enough, and it
can be structured in a way we can maintain.
2017-04-30 17:53:30 +12:00
Aldo Cortesi
50cfededce Merge pull request #2293 from cortesi/clip
commands: cut.clip copies cuts to system clipboard
2017-04-30 17:37:45 +12:00
Aldo Cortesi
befbe88d96 commands: cut.clip copies cuts to system clipboard 2017-04-30 14:42:37 +12:00
Aldo Cortesi
51b50737e7 Merge pull request #2291 from cortesi/cuts
Introduce cuts: a flow dissector
2017-04-30 14:35:06 +12:00
Aldo Cortesi
ed62bbad1d Add help text to --commands output 2017-04-30 14:20:21 +12:00
Aldo Cortesi
075d452a6d cut: more flexible cut specification based on attribute paths
Also support certificate types, which are converted to ASCII-encoded PEM format.
2017-04-30 14:05:45 +12:00
Aldo Cortesi
7ffb2c7981 cut: use csv module to encode multi-values for saving
Also add q.text, q.raw_content, s.text, s.raw_content selectors
2017-04-30 11:48:32 +12:00
Maximilian Hils
97a00728a8 [web] add connection tests 2017-04-29 19:43:59 +02:00
Maximilian Hils
8f1b763082 [web] add connection indicator 2017-04-29 19:34:51 +02:00
Maximilian Hils
aa0e134041 Merge pull request #2276 from mitmproxy/add-examples-to-script-docs
Prominently link to examples in script docs
2017-04-29 19:23:21 +02:00
Aldo Cortesi
4b568f99d6 Introduce cuts: a flow dissector
This PR introduces the cuts addon, a flow dissector that  allows you to select
and operate on specific components of flows. It also adds the first consumer
for cuts - the cuts.save command.

Save the content of the focus to /tmp/foo:

    cuts.save s.content|@focus /tmp/foo

Save the URL and response content-type headers for all flows currently shown to
file, comma-separated, one flow per line:

    cuts.save s.url,q.header[content-type]|@focus /tmp/foo

We also use this to replace the body save shortcut in the console flowlist.
2017-04-29 23:32:31 +12:00
Aldo Cortesi
83f8760703 Merge pull request #2221 from iharsh234/mypy-master-example/simple
Extend mypy example/simple (#2194)
2017-04-29 23:19:11 +12:00
Aldo Cortesi
25fb0cc019 Merge pull request #2290 from cortesi/scriptrun
command: script.run
2017-04-29 13:48:17 +12:00
Aldo Cortesi
d439b34511 command: script.run
Plus the flowlist binding adjustments.
2017-04-29 13:24:19 +12:00
Aldo Cortesi
915bc7647d Merge pull request #2289 from cortesi/flowrevert
command: flow.revert
2017-04-29 12:30:23 +12:00
Aldo Cortesi
a32f87fef9 Merge pull request #2288 from cortesi/replayfiles
commands: "replay.client.file" and "replay.server.file"
2017-04-29 11:52:38 +12:00
Aldo Cortesi
1d5eedcc9c command: flow.revert
Plus matching binding in flowlist.
2017-04-29 11:48:25 +12:00
Aldo Cortesi
f908ea220f commands: "replay.client.file" and "replay.server.file" 2017-04-29 11:34:50 +12:00
Aldo Cortesi
c7247e026d Merge pull request #2287 from cortesi/cmdmark
commands: marking
2017-04-29 11:23:19 +12:00
Aldo Cortesi
a92017a6c1 Rework client and server replay
- Add client.replay [flows], client.replay.stop
- Add server.replay [flows], server.replay.stop
- The corresponding options for file loading are only read on startup, further
changes are ignored. In interactive contexts, replay is started with the
commands, not through option changes.
- Deprecate flow.replay, use replay.client instead
2017-04-29 11:02:36 +12:00
harsh vijay
789fbd00d2 Fixed lint error 2017-04-29 03:54:00 +05:30
harsh vijay
6e03231d25 lint error fixed 2017-04-29 03:49:08 +05:30
Aldo Cortesi
7317ea134e command: flow.kill, flow.replay
Plus the matching bindings in the flow list.
2017-04-29 09:58:32 +12:00
harsh vijay
36118973d9 extend mypy example/simple 2017-04-29 03:26:14 +05:30
Aldo Cortesi
f21a970f29 commands: marking
Add "view.mark [flows] bool" and "view.mark.toggle [flows]". Use this to rebind
marking keys in flowlist.
2017-04-29 09:14:44 +12:00
Aldo Cortesi
139c4e6db3 Merge pull request #2283 from cortesi/cmdall
Commands, core update event
2017-04-29 09:14:22 +12:00
Aldo Cortesi
217addbf31 commands: view.go
bind G to "view.go -1"
bind g to "view.go 0"
2017-04-29 08:40:38 +12:00
Aldo Cortesi
0b090f7ae1 Commands, core update event
This patch:

- Introduces a core update() event that should be invoked whenever flows are
changed outside of the normal lifecycle.
- Extend view.resolve to know about @all, which matches all flows in the view.
- Add a core flow.resume comand, which resumes flows and broadcasts an update event.
- Define flow list bindings for:

A -> flow.resume @all
a -> flow.resume @focus
d -> view.remove @focus
z -> view.remove @all
2017-04-29 08:01:00 +12:00
Charles d'Hondt
65202f5f1c Added ldapsss vef 2017-04-28 17:00:21 +02:00
Charles d'Hondt
6d3837fd54 fix 2017-04-28 16:44:50 +02:00
Charles d'Hondt
f91ed91bf1 fix 2017-04-28 16:40:34 +02:00
Charles d'Hondt
29c1f303d6 Fixed typo 2017-04-28 16:23:32 +02:00
Charles d'Hondt
5fb18ad275 Added LDAP Auth 2017-04-28 16:19:27 +02:00
Matthew Shao
f8b76a62ff [web] Add coverage for js/urlState.js 2017-04-28 22:06:17 +08:00
Maximilian Hils
b537997f4f Update README.md 2017-04-28 14:43:49 +02:00
Maximilian Hils
05e1f22143 Update README.md 2017-04-28 14:24:57 +02:00
Maximilian Hils
bd88733a0a update CHANGELOG 2017-04-28 14:22:56 +02:00
Maximilian Hils
769123498c fix mitmweb's content security policy 2017-04-28 14:14:56 +02:00
Aldo Cortesi
a781bab7db Merge pull request #2282 from cortesi/cmddec
Add a command.command decorator
2017-04-28 15:33:00 +12:00
Aldo Cortesi
6af1a49464 commands: add a command.command decorator
Use this for our built-ins and the console commands.
2017-04-28 15:07:52 +12:00
Aldo Cortesi
7ff84673fd Support unary flow command arguments
Use this to add a console.view.flow command and bind "enter" in flowlist.
2017-04-28 14:05:35 +12:00
Aldo Cortesi
0ff0253b3e console: save flows to command 2017-04-28 12:15:28 +12:00
Aldo Cortesi
cfae95f5c3 console: start migrating hotkeys to keymap
This shifts a set of flow list keys to keymaps. Much more to come.
2017-04-28 12:10:48 +12:00
Aldo Cortesi
cbb35cee51 Merge pull request #2280 from cortesi/coreset
commands: add the core command addon, and the command "set"
2017-04-28 12:10:02 +12:00
Aldo Cortesi
ce01cb9c09 command: partials
Support partial commands in console.command, use it to keybind "i" for
intercept, which prompts the user with ":set intercept=".
2017-04-28 11:24:28 +12:00
Aldo Cortesi
29b3e787ca Merge pull request #2279 from cortesi/keymap
console: keymap
2017-04-28 10:43:05 +12:00
Aldo Cortesi
8a07059cf4 commands: add the core command addon, and the command "set"
The set command sets an option using the same syntax as commandline --set.
2017-04-28 10:41:44 +12:00
Aldo Cortesi
be1b76b975 console: add a keymap
This sketches out a keymap system for consone, and adds the first few top-level
commands and mappings.
2017-04-28 10:21:15 +12:00
Aldo Cortesi
18edc11145 console: interactive command browser
Simple browser that lets users view and select commands interactively.
Key binding for this is still to be sorted out.
2017-04-28 07:43:58 +12:00
Aldo Cortesi
b73b06b364 Merge pull request #2274 from cortesi/alerts
Add an "alert" log level.
2017-04-28 06:53:51 +12:00
Aldo Cortesi
aab6bf747c Merge pull request #2273 from cortesi/commands
Commands
2017-04-28 06:53:41 +12:00
Thomas Kriechbaumer
adce1a8235 Merge pull request #2277 from Kriechi/bump-cryptography
bump cryptography min-version
2017-04-27 20:11:15 +02:00
Thomas Kriechbaumer
3e82f4d6c4 bump cryptography min-version
This removes OpenSSL v0.9.8 support.
2017-04-27 19:39:56 +02:00
Maximilian Hils
5f91b7a45d Merge pull request #2275 from mitmproxy/mitmweb-change-react-prop-types
change import of prop-types
2017-04-27 18:29:57 +02:00
Maximilian Hils
75d952c46c prominently link to examples in script docs 2017-04-27 18:23:36 +02:00
cle1000
115a31c9ba change import of prop-types 2017-04-27 10:54:21 +02:00
Aldo Cortesi
218e127e74 Add an "alert" log level.
This has the same urgency as "info", but also signals to interactive tools that
the user's attention should be drawn to the output, even if they're not looking
at the event log. In the console app, this means the message appears in the
status bar with a timeout.
2017-04-27 19:08:01 +12:00
Aldo Cortesi
fde1159ae3 Test coverage ++ 2017-04-27 18:43:44 +12:00
Aldo Cortesi
97000aa85c command: save.file flowspec path -> None
Our first user-facing command. The following commands do the obvious things:

save.file @marked /tmp/flows
save.file @focus /tmp/flows
save.file @hidden /tmp/flows
save.file "~m get" /tmp/flows
2017-04-27 17:05:00 +12:00
Aldo Cortesi
b7afcb5dc2 addons.streamfile -> addons.save
Options:

    streamfile -> save_stream_file
    streamfile_filter -> save_stream_filter
2017-04-27 15:58:54 +12:00
Aldo Cortesi
8c4810f606 console: flow resolution command
This is our first built-in command, which will be used by very many other
commands.

Also add a --commands option to dump all commands, analogous to --options.
2017-04-27 15:27:51 +12:00
Aldo Cortesi
ee3dd3f3c5 console: very basic interactive command executor 2017-04-27 12:00:41 +12:00
Aldo Cortesi
169baabcab Basic outline of the command subsystem
- Add a command manager
- Sketch out the type system with a few simple supported types
2017-04-27 11:09:40 +12:00
Aldo Cortesi
2a46f3851a Merge pull request #2265 from cortesi/addons
Addons and addon testing
2017-04-27 07:40:14 +12:00
Maximilian Hils
ab07b79138 Merge pull request #2270 from F1ashhimself/master
Update readme for complex examples
2017-04-26 17:15:34 +02:00
Maksim Beloborodko
90a5b90b0d Update readme for complex examples 2017-04-26 17:14:41 +03:00
Maximilian Hils
0f9081b18d Merge pull request #2269 from mhils/issue-2250
fix #2250, add type info to cookie module
2017-04-26 14:42:48 +02:00
Maximilian Hils
87610cc8b2 fix #2250, add type info to cookie module 2017-04-26 14:17:14 +02:00
Maximilian Hils
d5ea08db62 Merge pull request #2258 from mhils/readfile
Integrate readstdin into readfile
2017-04-26 13:40:51 +02:00
Maximilian Hils
0a8e54edea Merge pull request #2268 from mhils/issue-2257
fix #2257
2017-04-26 13:39:19 +02:00
Maximilian Hils
cef01ac164 Merge pull request #2267 from MatthewShao/jest-dev
[web] Add coverage for js/utils.js, js/flow/utils.js
2017-04-26 13:38:54 +02:00
Maximilian Hils
1aa6d9d324 fix #2257 2017-04-26 12:26:49 +02:00
Maximilian Hils
ca2827886a separate reading from stdin into its own addon 2017-04-26 12:11:37 +02:00
Maximilian Hils
7607240c30 Merge pull request #2259 from mhils/2228
fix #2228
2017-04-26 12:10:39 +02:00
Maximilian Hils
df7701bb6d fix #2228 2017-04-26 11:32:24 +02:00
Maximilian Hils
07cb83597b clarify that --cert expects a leaf certificate
refs #2254
2017-04-26 11:18:27 +02:00
Matthew Shao
ec7d90f9be [web] Add coverage for js/utils.js, js/flow/utils.js 2017-04-26 17:06:50 +08:00
Maximilian Hils
b3a1143338 integrate readstdin into readfile addon 2017-04-26 10:56:32 +02:00
Maximilian Hils
2b500f234f typecheck: add support for typing.Any 2017-04-26 10:54:36 +02:00
Aldo Cortesi
5327756377 Addons and addon testing
- Fix some loading sequence bugs affecting command-line script invocation
- Allow addons to over-ride existing options (with a warning). We need this for
reloading.
- Convert har_dump to new-style arguments, fix and re-instate its test suite.
- Covnert miscelaneous other exmples to new-style args.
2017-04-26 19:56:33 +12:00
Aldo Cortesi
e32efcae49 Merge pull request #2262 from Kriechi/reduced-coverage++
improve tests (extracted from #2011)
2017-04-26 19:52:33 +12:00
Aldo Cortesi
1daf0b3f0a Merge pull request #2264 from cortesi/options
Change the way addons handle options
2017-04-26 11:23:48 +12:00
Aldo Cortesi
b72f139093 configure(options, updated) -> configure(updated)
Options are now available globally on ctx, so the first argument of configure
is redundant.
2017-04-26 11:01:27 +12:00
Aldo Cortesi
f90b4c2ff0 Move options into ctx
Many addons currently save options on configure(), either as individual options
or sometimes by saving the entire options object. The current options should
simply be available on the ctx object, simplifying state management for addons
considerably.
2017-04-26 10:25:56 +12:00
Aldo Cortesi
02c82b1b60 Merge pull request #2261 from cortesi/addonrevamp
Revamp how addons work
2017-04-26 09:03:03 +12:00
Aldo Cortesi
7aa2081894 Remove watchdog, solidify script testing
- Remove the watchdog dependency. We now just stat the script file every 2
seconds to check for an updated mtime.
- Further solidify our script testing, and in particular make the example tests
nicer. These should exemplify how we want users to test their own addon
scripts. More work on addon testing to follow.
2017-04-26 09:01:40 +12:00
Thomas Kriechbaumer
a35a377cbb improve tests 2017-04-25 20:49:49 +02:00
Maximilian Hils
7ee0abbe0c Merge pull request #2219 from MatthewShao/jest-dev
[web] Coverage++ for ducks/flows.js
2017-04-25 20:26:45 +02:00
Matthew Shao
6962a2c3f2 Fix the tests for flows actions. 2017-04-25 19:29:52 +08:00
Matthew Shao
dcac976a47 Merge branch 'jest-dev' of https://github.com/MatthewShao/mitmproxy into jest-dev 2017-04-25 19:27:53 +08:00
Aldo Cortesi
e6eeab6094 Revamp how addons work
- Addons now nest, which means that addons can manage addons. This has a number
of salutary effects - the scripts addon no longer has to poke into the global
addons list, we no longer have to replace/remove/boot-outof parent addons when
we load scripts, and this paves the way for making our top-level tools into
addons themselves.
- All addon calls are now wrapped in a safe execution environment where
exceptions are caught, and output to stdout/stderr are intercepted and turned
into logs.
- We no longer support script arguments in sys.argv - creating an option
properly is the only way to pass arguments. This means that all scripts are
always directly controllable from interctive tooling, and that arguments are
type-checked.

For now, I've disabled testing of the har dump example - it needs to be moved
to the new argument handling, and become a class addon. I'll address that in a
separate patch.
2017-04-25 22:13:44 +12:00
Maximilian Hils
161cdff25e simplify selectRelative, add example for action testing 2017-04-24 15:13:45 +02:00
Matthew Shao
ae71ec1d30 [web] Coverage++ for ducks/flows.js 2017-04-24 14:18:12 +02:00
Thomas Kriechbaumer
90c425bd14 Merge pull request #2256 from ujjwal96/ip-formatting
Fixed formatting in mitmdump
2017-04-22 10:33:07 +02:00
Ujjwal Verma
73692b909b Fixed formatting in mitmdump 2017-04-22 11:24:22 +05:30
Maximilian Hils
6af72160bf [requires.io] dependency update on master branch (#2252) 2017-04-20 15:29:42 +02:00
Maximilian Hils
3d7cde058b [requires.io] dependency update on master branch (#2241) 2017-04-17 10:49:17 +02:00
Thomas Kriechbaumer
9c18f0ba09 Merge pull request #2240 from mitmproxy/requires-io-master
[requires.io] dependency update on master branch
2017-04-16 22:12:04 +02:00
Maximilian Hils
3aa7f24992 Update setup.py 2017-04-16 19:44:26 +02:00
requires.io
3afeb7c7e9 [requires.io] dependency update 2017-04-16 19:42:32 +02:00
Maximilian Hils
be5e276d45 Merge pull request #2239 from Kriechi/update-kaitai
update kaitai and recompile formats
2017-04-16 19:42:19 +02:00
Thomas Kriechbaumer
83a428e0b7 manually fix imports 2017-04-16 15:51:12 +02:00
Thomas Kriechbaumer
dadb50946e update kaitai and recompile formats 2017-04-16 15:51:11 +02:00
Maximilian Hils
ec6be96f2a Merge pull request #2234 from ujjwal96/ip-formatting
Fixes IP address formatting #2109
2017-04-10 20:24:15 +02:00
Ujjwal Verma
742127ef7b Fixes #2109 2017-04-09 18:55:20 +05:30
Maximilian Hils
c7b5012752 Merge pull request #2232 from r1b/master
fixes ipv6 authority form parsing in CONNECT
2017-04-09 01:15:50 +02:00
Robert C Jensen
7365f18542 fixes ipv6 authority form parsing in CONNECT 2017-04-07 15:46:21 -04:00
Maximilian Hils
c76620c19f Merge pull request #2227 from vinaydargar/grammarphrasing
Replace phrase 'the the' in 2 places
2017-04-04 02:26:10 +02:00
Vinay Dargar
55ba6ed14d Replace phrase 'the the' in 2 places
Replaced with the appropriate "in the" and "to the".
There are multiple other occurences of this but they are in upstream python modules.
2017-04-02 21:37:38 +05:30
Thomas Kriechbaumer
8567300dd6 Merge pull request #2224 from jonathanrfisher1/patch-1
Replace phrase "an TLS" with "a TLS"
2017-03-29 20:43:14 +02:00
jonathanrfisher1
677b9186ae Replace phrase "an TLS" with "a TLS"
Updating usage of 'a' or 'an' to be more consistent with general English grammatical rules. TLS is pronounced with a consonant sound for both the expanded and abbreviated versions.
2017-03-29 14:12:33 -04:00
Thomas Kriechbaumer
9e3edd16c2 Merge pull request #2223 from krsoninikhil/empty-logbuffer
Add tests for set_focus
2017-03-29 16:57:37 +02:00
Nikhil Soni
442999c75c Add tests for set_focus 2017-03-29 18:34:17 +05:30
Thomas Kriechbaumer
98957673f0 Merge pull request #2222 from BasThomas/patch-1
Add syntax highlighting to Readme
2017-03-29 13:53:06 +02:00
Bas Broek
dc37f7fd00 Add syntax highlighting to Readme 2017-03-29 13:36:51 +02:00
Thomas Kriechbaumer
034ca20d3c Merge pull request #2220 from krsoninikhil/empty-logbuffer
eventlog: Override set_focus to check for index error
2017-03-28 21:35:43 +02:00
Nikhil Soni
70a0f87570 Override set_focus to check for index error 2017-03-29 00:14:37 +05:30
Matthew Shao
15c19d2bc6 [web] Coverage++ for ducks/flows.js 2017-03-28 20:44:49 +08:00
Maximilian Hils
9c686ca14c Merge pull request #2212 from MatthewShao/jest-dev
[web] Update Jest config and coverage ++
2017-03-27 17:04:13 +02:00
Maximilian Hils
1909778e3d Merge pull request #2215 from mitmproxy/proxapp.local-1
proxapp -> proxapp.local
2017-03-26 16:09:26 +02:00
Matthew Shao
9a604b5cfe [web] Minor fixes for the test. 2017-03-26 21:58:47 +08:00
Matthew Shao
17ac1ff6cb [web] Exclude src/js/filt/filt.js from coverage report. 2017-03-26 21:38:00 +08:00
Maximilian Hils
482c1579f2 proxapp -> proxapp.local
Chrome doesn't like it if there's no TLD.
2017-03-26 15:02:47 +02:00
Matthew Shao
de9ecb7c30 [web] Add JS coverage to codecov. 2017-03-26 09:36:18 +08:00
Matthew Shao
31a45ddaaa [web] Reach 100% coverage for ducks/settings.js 2017-03-26 09:34:45 +08:00
Maximilian Hils
6f00c1bc5d Merge pull request #2213 from Kriechi/concurrent-coverage
fix #2201
2017-03-25 17:16:31 +01:00
Thomas Kriechbaumer
20776cf2fa fix #2201 2017-03-25 16:41:53 +01:00
Aldo Cortesi
c6a16e95e8 Merge pull request #2206 from cortesi/addonload
addon refactoring
2017-03-25 11:42:43 +13:00
Aldo Cortesi
65f0885bd6 addon loader: add boot_into, which replaces returning from start()
While we're here, expand test coverage for addonmanager to 100%, and promote to
individual coverage.
2017-03-25 10:48:12 +13:00
Aldo Cortesi
d69a411303 addons: an addonmanager.Loader is now passed to the load() event 2017-03-25 10:48:12 +13:00
Aldo Cortesi
541c1e8b9f addons: start -> load throughout 2017-03-25 10:48:12 +13:00
Maximilian Hils
b531353ee0 Merge pull request #2208 from Kriechi/bump-h2
bump h2
2017-03-24 21:43:14 +01:00
Thomas Kriechbaumer
ef9f0e22ea bump h2 2017-03-24 21:27:14 +01:00
Aldo Cortesi
335861f490 Merge pull request #2207 from nikofil/scripts-redirect-stdout
scripts: redirect stdout to ctx.log.warn
2017-03-24 14:58:33 +13:00
Nikos Filippakis
abf291b0f9 scripts: redirect stdout to ctx.log.warn
Redirect messages written to stdout in scripts to ctx.log.warn.
(closes #1530)

Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>
2017-03-24 02:35:02 +01:00
Aldo Cortesi
439c113989 Merge pull request #2204 from cortesi/consoleopts
console options: load and save options to and from file
2017-03-24 10:05:37 +13:00
Aldo Cortesi
0d3e2c6adf optmanager: make serialization and loading more robust
Also handle errors in console options manager.
2017-03-24 09:37:17 +13:00
Aldo Cortesi
3a35c69986 Merge pull request #2203 from cortesi/malformedreq
Don't pass malformed request objects to our error handler
2017-03-24 09:30:09 +13:00
Aldo Cortesi
eb66456d16 console: read and write options to and from file 2017-03-23 11:28:08 +13:00
Aldo Cortesi
44c3a24f8e Don't pass malformed request objects to our error handler 2017-03-23 10:48:20 +13:00
Maximilian Hils
1e81747a2a Merge pull request #2200 from MatthewShao/jest-dev
Add coverage for eventLog.js and update Jest config.
2017-03-22 15:12:07 +01:00
Thomas Kriechbaumer
907825714b move examples tests (#2199) 2017-03-22 12:02:18 +01:00
Matthew Shao
82ecc5448d [web] Update configuration of jest to avoid deprecation warning 2017-03-22 18:42:46 +08:00
Matthew Shao
20d3ae98e0 [web] Reach 100% coverage for ducks/eventLog.js 2017-03-22 18:32:28 +08:00
Matthew Shao
ab2fcbef8d Fix#2184, mitmweb -n dispalys incorrect message. (#2187)
* Fixes #2184, python code.

* Fixes #2184, JavaScript code.

* [web] Update Footer.jsx (#2184)
2017-03-22 01:26:04 +01:00
Aldo Cortesi
00902e6feb Merge pull request #2190 from cortesi/mypy
mypy for all of ./mitmproxy
2017-03-22 11:16:02 +13:00
Aldo Cortesi
95d9ec88ac tox: mypy checking for entire codebase
Also fix a few linting errors.
2017-03-22 10:29:46 +13:00
Maximilian Hils
26d0254203 [requires.io] dependency update on master branch (#2193) 2017-03-21 18:43:56 +01:00
Aldo Cortesi
cacad8373b Make tnetstrings pass mypy
Mypy doesn't support recursive types yet, so we can't properly express
TSerializable nested structures. For now, we just disable type checking in the
appropriate locations.

https://github.com/python/mypy/issues/731
2017-03-20 13:09:24 +13:00
Aldo Cortesi
4ca78604af Factor out an io module
Include tnetstring - we've made enough changes that this no longer belongs in
contrib.
2017-03-20 12:50:09 +13:00
Aldo Cortesi
0c0c0d38cc Merge pull request #2186 from cortesi/tighten
Tighten some options-related functionality
2017-03-20 12:39:49 +13:00
Aldo Cortesi
3a8da31835 mypy all of the codebase bar tnetstring
In some places, this involved removing type declarations where our types were
terminally confused. The grideditor specifically needs a cleanup and
restructure.
2017-03-20 12:38:08 +13:00
Aldo Cortesi
b98ce71770 Fix sliding window type specs 2017-03-20 12:21:50 +13:00
Aldo Cortesi
2153c337e0 addons.view: we no longer have a None order state
This bumps coverage back to 100% for addons
2017-03-20 09:12:09 +13:00
Maximilian Hils
92e3358915 Merge pull request #2182 from syahn/fix-#2134
Fix #2134
2017-03-19 14:47:50 +01:00
Aldo Cortesi
b19fefd173 options: default_contentview uses lowercase 2017-03-19 14:39:16 +13:00
Aldo Cortesi
04f1a4443d options: reraise when there's an error with a partial update
Fixes #2174
2017-03-19 14:36:23 +13:00
Aldo Cortesi
8d68196fd0 console: use overlay chooser to pick flow view mode
More consistent, and fixes status prompt overflow issue.
2017-03-19 14:13:54 +13:00
Aldo Cortesi
1b6bc874b5 console options: "d" to reset this option to default 2017-03-19 14:01:32 +13:00
Aldo Cortesi
43e7b9d68c options: choices for content views and tighten console order spec
Also clean up some leftovers from filter option name change.
2017-03-19 13:39:28 +13:00
Aldo Cortesi
22d7c31ea8 dumper, mitmdump: kill filtstr
Dumper now also uses view_filter. Passing arguments to mitmdump is now
precisely equivalent to setting both filestream_filter and view_filter.
2017-03-19 13:21:46 +13:00
Aldo Cortesi
475a4e3eb0 streamfile: add streamfile_filter and use it instead of filtstr 2017-03-19 13:08:26 +13:00
Aldo Cortesi
6f745b90a8 console options: fix bug that caused keys to be handled by wrong component 2017-03-19 13:05:27 +13:00
Aldo Cortesi
b1ef4bce30 options: filter -> view_filter 2017-03-19 13:02:51 +13:00
Aldo Cortesi
1b330ba453 Merge pull request #2173 from cortesi/coptions
Console options editor
2017-03-19 12:27:41 +13:00
Aldo Cortesi
cb18c91f13 console options: help for overlays, improved layout for overlay grid editor 2017-03-19 12:14:42 +13:00
Aldo Cortesi
21794c7bbe optmanager: test coverage 2017-03-19 11:29:41 +13:00
Aldo Cortesi
49b0a67eb9 console options: add an overlay grid editor for sequence options 2017-03-19 10:32:22 +13:00
Aldo Cortesi
4e24c95a61 optmanager: cope with bound methods in .subscribe
Fixes #2122
2017-03-19 10:32:22 +13:00
Aldo Cortesi
3f50d5fdbb console options: handle choices settings
This implements a generic chooser overlay, and uses it to handle setting
options that have fixed choices. We'll use this overlay elsewhere too.
2017-03-19 10:32:22 +13:00
Aldo Cortesi
fea08ef919 console options: in-place editor for simple strings and ints 2017-03-19 10:32:22 +13:00
Aldo Cortesi
3a949f35f8 console options: better defaults display, g/G/D keyboard shortcuts 2017-03-19 10:32:22 +13:00
Aldo Cortesi
d759150734 console: options/help pane switching, toggle bools with enter 2017-03-19 10:32:22 +13:00
Aldo Cortesi
8130b9880a options cleanups
- Move default client ciphers - no need to have a 10-line string default.
- Add some style guidance on options help
- Be consistent about reflowing options help
2017-03-19 10:32:22 +13:00
Aldo Cortesi
bc67cee687 console: sketch out look and feel of the new Options editor 2017-03-19 10:32:22 +13:00
Aldo Cortesi
39659c7528 Make mypy succeed with imports on master.py
We get little benefit from our mypy QA checks at the moment, because we skip
imports. This patch is what's needed to make mypy succeed with imports on a
single file: master.py

It also updates mypy to the current version, and enables a QA check.

Mypy bugs I encountered:

dict.update with kwargs not supported:

https://github.com/python/mypy/issues/1031

property setters and getters must be adjacent:

https://github.com/python/mypy/issues/1465
2017-03-19 10:32:22 +13:00
Frank Ahn
125ae2d8f9 Fix #2134 2017-03-18 09:51:05 +09:00
Maximilian Hils
c0882496e3 Merge pull request #2176 from MatthewShao/jest-dev
[web] Reach 100% coverage for ducks/utils/store.js
2017-03-17 15:15:55 +01:00
Matthew Shao
6c338c84a6 [web] Reach 100% coverage for ducks/utils/store.js 2017-03-17 17:17:11 +08:00
Aldo Cortesi
253fa95018 Merge pull request #2169 from cortesi/mypy
mypy without skipping imports
2017-03-17 09:43:29 +13:00
Aldo Cortesi
5192810ff6 Make mypy succeed with imports on master.py
We get little benefit from our mypy QA checks at the moment, because we skip
imports. This patch is what's needed to make mypy succeed with imports on a
single file: master.py

It also updates mypy to the current version, and enables a QA check.

Mypy bugs I encountered:

dict.update with kwargs not supported:

https://github.com/python/mypy/issues/1031

property setters and getters must be adjacent:

https://github.com/python/mypy/issues/1465
2017-03-17 08:13:47 +13:00
Aldo Cortesi
eac210829e Rip out master handler mechanism
All events are now handled by addons, and we no longer support any events on
master.
2017-03-17 07:56:32 +13:00
Maximilian Hils
7a8b362df6 Merge pull request #2156 from syahn/pretty-popup
[web] Adjust pop-up docs position
2017-03-16 18:36:39 +01:00
Maximilian Hils
6d66184eba Merge pull request #2168 from cortesi/handlers
Rip out old handlers mechanism - all events are now handled in addons
2017-03-16 14:57:26 +01:00
Maximilian Hils
50eeac482f Merge pull request #2153 from MatthewShao/jest-dev
[web] Reach 100% coverage for ducks/ui/flow.js
2017-03-16 14:51:33 +01:00
Maximilian Hils
6c0bbcc9ee Merge pull request #2170 from felixonmars/patch-1
Fix test_format_xml with dot in path
2017-03-16 12:34:01 +01:00
Thomas Kriechbaumer
4a354ffb83 Merge pull request #2172 from Kriechi/bump-h2
bump h2 and hyperframe
2017-03-16 11:21:31 +01:00
Thomas Kriechbaumer
2a934ed323 bump h2 and hyperframe 2017-03-16 10:33:36 +01:00
Felix Yan
b352557092 Fix test_format_xml with dot in path
When the path contains dot ".", replacing all dots will generate a non-exist result and raises a FileNotFoundError. Replacing only the last dot fixes this.
2017-03-16 16:48:21 +08:00
Aldo Cortesi
c5e0dc64b9 Rip out master handler mechanism
All events are now handled by addons, and we no longer support any events on
master.
2017-03-16 18:33:24 +13:00
Aldo Cortesi
3de9829003 Remove last handlers in test suite
While we're here, make checking that there are NO logs on the proxy more
efficient by setting a short timeout. This reduces total test suite running
time by 15% on my system.
2017-03-16 18:05:57 +13:00
Aldo Cortesi
1410cbb4b6 Remove test handlers by using taddons.RecordingMaster
This also means expanding and tweaking the recording master API, which we
reflect through the current test suite
2017-03-16 18:05:57 +13:00
Aldo Cortesi
85ddc5056b Move mitmproxy console handlers to addon 2017-03-16 18:05:57 +13:00
Aldo Cortesi
b6abe96202 Move dump handlers to addon 2017-03-16 18:05:57 +13:00
Aldo Cortesi
b275257553 Merge pull request #2167 from mhils/update-dependencies
update mypy
2017-03-16 18:05:35 +13:00
Aldo Cortesi
fefbff4164 Merge pull request #2166 from Kriechi/bump-sphinx
bump sphinx
2017-03-16 15:56:11 +13:00
Aldo Cortesi
1e6c51c698 Merge pull request #2152 from cortesi/readfile
Extract flow reading into addons
2017-03-16 15:51:21 +13:00
Maximilian Hils
112233891d update mypy 2017-03-15 23:10:21 +01:00
Aldo Cortesi
228a22b3c0 Add a light-weight custom event system, use it for keepserving
This patch implements the lightweight event system I propose in #2144, adds a
custom event "processing_complete" that is triggered after file read, client
replay and server replay, and introduces a KeepServing addon to handle this for
mitmdump.
2017-03-16 11:07:00 +13:00
Thomas Kriechbaumer
bbf4629906 bump sphinx 2017-03-15 23:05:06 +01:00
Thomas Kriechbaumer
dadefaecdb update release instructions 2017-03-15 22:36:58 +01:00
Aldo Cortesi
169068c7ec Clean up addonmanager interface
Clarify the plethora of invocation methods we've sprouted, correct some usages
in the codebase.
2017-03-16 08:50:29 +13:00
Thomas Kriechbaumer
e755399d1e update release instructions 2017-03-15 20:06:39 +01:00
Thomas Kriechbaumer
cd93dabd75 Merge pull request #2161 from mhils/make-request
Add Request.make
2017-03-15 14:40:42 +01:00
Maximilian Hils
65c4a3cf1d add Request.make 2017-03-15 14:06:00 +01:00
Thomas Kriechbaumer
ec5d9cbd2b Merge pull request #2159 from Kriechi/bump-pyparsing
bump pyparsing
2017-03-15 11:45:47 +01:00
Thomas Kriechbaumer
56b087278a Merge pull request #2155 from Kriechi/bump-cryptography
bump cryptography
2017-03-15 10:43:48 +01:00
Thomas Kriechbaumer
aa4ab88459 bump pyparsing 2017-03-15 10:14:16 +01:00
Thomas Kriechbaumer
0316a13f7e bump cryptography 2017-03-15 10:03:18 +01:00
Frank Ahn
9f8004ed62 Adjust pop-up docs position
- Shift pop-up docs to the right position according to responsiveness
2017-03-15 17:44:52 +09:00
Aldo Cortesi
ef582333ff Extract flow reading into addons
This patch moves the final pieces of master functionality into addons.

- Add a ReadFile addon to read from file
- Add a separate ReadStdin addon to read from stdin, only used by mitmdump
- Remove all methods that know about io and serialization from master.Master
2017-03-15 13:44:48 +13:00
Matthew Shao
48fe32766c [web] Reach 100% coverage for ducks/ui/flow.js 2017-03-15 08:27:42 +08:00
Aldo Cortesi
eba6d4359c Merge pull request #2098 from iharsh234/bug-2086-2
Fix crash when duplicating flow
2017-03-15 09:20:33 +13:00
Aldo Cortesi
6e7ba84017 Merge pull request #2147 from mhils/connection-ids
Add client/server connection ids
2017-03-15 09:20:16 +13:00
Maximilian Hils
30797755fb stateobject: automatically change id when copying 2017-03-14 17:08:40 +01:00
Maximilian Hils
375680a3be add connection ids 2017-03-14 17:08:40 +01:00
Maximilian Hils
e29cd7f5b7 Merge pull request #2151 from MatthewShao/jest-dev
Update .travis.yml to fix the failure about yarn
2017-03-14 17:07:11 +01:00
Matthew Shao
b37d935d3c Update .travis.yml to fix the failure about yarn 2017-03-14 23:09:25 +08:00
Maximilian Hils
2d016775fe Merge pull request #2149 from mhils/multidictview-copy
Add MultiDictView.copy()
2017-03-14 14:38:38 +01:00
Maximilian Hils
0de8f46c6e Merge pull request #2145 from mhils/ne
py3: __ne__ delegates to __eq__ by default
2017-03-14 14:38:00 +01:00
Maximilian Hils
6bd2eb4ec6 Merge pull request #2150 from dequis/pretty-host-filter
Match ~d and ~u filters against pretty_host too
2017-03-14 14:31:12 +01:00
dequis
f351d0a307 Match ~d and ~u filters against pretty_host too
Changed the ~u filter in the console UI to match the behavior of
mitmweb, which only matches against pretty_url, never against url.
2017-03-14 01:57:22 -03:00
Aldo Cortesi
1f37743549 Merge pull request #2142 from mhils/2140
Fix #2140
2017-03-14 14:24:53 +13:00
Maximilian Hils
961747c4bc Merge pull request #2120 from ujjwal96/replace-from-file
Replace from file through replacement editor #1458
2017-03-14 02:23:31 +01:00
Maximilian Hils
30fd285ec7 multidictviews should not be serializable 2017-03-14 02:20:24 +01:00
Maximilian Hils
de1de3f626 add MultiDictView.copy 2017-03-14 02:18:02 +01:00
Aldo Cortesi
124a6c9e5a Merge pull request #2129 from cortesi/addonopts
Custom options for addons
2017-03-14 13:02:58 +13:00
Maximilian Hils
875ce8c9c1 py3: __ne__ delegates to __eq__ by default 2017-03-14 00:40:15 +01:00
Aldo Cortesi
1b301ad5bb Move running() in to .tick() method to make sure it's called consistently 2017-03-14 11:41:20 +13:00
Aldo Cortesi
b745428b5c Enable custom options in config files
We also now ignore unknown options in config files by default, and print a
warning if verbosity is incremented.
2017-03-14 09:40:33 +13:00
Aldo Cortesi
2832e790fd Move serialization methods out of Options
Attributes on options share a namespace with options themselves. It's getting
too crowded on our Options object, so let's shift some obvious stuff into the
module.
2017-03-14 08:34:25 +13:00
Aldo Cortesi
c24f7d8e12 Optmanager: handle unknown options in value sets 2017-03-14 08:32:19 +13:00
Aldo Cortesi
75f83ba380 Show custom addon options in --options output 2017-03-14 08:32:19 +13:00
Aldo Cortesi
0c6663d0d5 Enable custom options for addons
- Add an options parameter to the start() event. This is to be used by addons
on startup to add custom options.
- Add a running() event that is called once the proxy is up and running.
- With the new paradigm we can't log during master __init__, so add a tiny
termstatus addon to print proxy status to terminal once we're running.
2017-03-14 08:32:19 +13:00
Maximilian Hils
2c6dcac97f fix #2140 2017-03-13 18:37:11 +01:00
Maximilian Hils
ee65894d40 Merge pull request #2141 from mhils/decouple-file-format-version
Decouple mitmproxy and file format version
2017-03-13 18:32:48 +01:00
Maximilian Hils
c853091a85 Merge pull request #2137 from MatthewShao/jest-dev
[web] Add tests for ducks/utils/store.js
2017-03-13 16:55:57 +01:00
Maximilian Hils
517aef1557 decouple mitmproxy and file format version 2017-03-13 16:46:07 +01:00
Matthew Shao
9ce92b1f43 [web] Improve the code style on tests 2017-03-13 22:47:44 +08:00
Maximilian Hils
647d7601b2 Merge pull request #2138 from MatthewShao/fix#2133
[web] Fixes the flaw in #2133
2017-03-13 14:58:15 +01:00
Matthew Shao
8a734a2613 [web] Fixes the flaw in #2133 2017-03-13 19:34:25 +08:00
Matthew Shao
6d37812928 [web] Add tests for ducks/utils/store.js 2017-03-13 15:56:14 +08:00
Maximilian Hils
05e11547f5 Merge remote-tracking branch 'origin/master' into pr-2120
Conflicts:
	test/mitmproxy/addons/test_replace.py
2017-03-12 23:33:49 +01:00
Maximilian Hils
0f4b523868 replacements: error right away when file does not exist 2017-03-12 23:28:49 +01:00
Thomas Kriechbaumer
7d5ab70ce3 Merge pull request #2136 from Kriechi/nuke-custom-tmpdir
nuke tutils.tmpdir, use pytest tmpdir
2017-03-12 23:27:27 +01:00
Thomas Kriechbaumer
1b045d24bc nuke tutils.tmpdir, use pytest tmpdir 2017-03-12 22:55:22 +01:00
harsh vijay
a8f7c30aa0 Fix crash when duplicating flow 2017-03-13 02:23:52 +05:30
harsh vijay
9a88594684 Fix crash when duplicating flow (#2) 2017-03-13 01:55:50 +05:30
Maximilian Hils
4684617d2c minor fixes 2017-03-12 20:24:50 +01:00
Ujjwal Verma
7f5fc0fdbd Removed ReplaceBase 2017-03-12 22:10:49 +05:30
Maximilian Hils
d069ba9da5 Merge pull request #2133 from MatthewShao/jest-dev
[web] Fixes all existed tests
2017-03-11 14:48:25 +01:00
Maximilian Hils
74f2a28e41 minor fixes 2017-03-11 14:46:33 +01:00
Matthew Shao
abcfac3c19 [web] remove node tests on travis 2017-03-11 20:21:03 +08:00
Matthew Shao
523cbb02aa [web] Fixes all existed tests 2017-03-11 18:57:32 +08:00
Matthew Shao
c4e0ea27a1 [web] Fixes stopEdit action in ducks/ui/flow.js 2017-03-11 17:43:55 +08:00
Ujjwal Verma
e0382fde2f Changed docs 2017-03-11 11:14:22 +05:30
Maximilian Hils
39154e628e Merge pull request #2118 from lymanZerga11/patch-3
Update proxyauth.py to add proxyauth metadata
2017-03-11 03:04:38 +01:00
Thomas Kriechbaumer
e9746c5182 Merge pull request #2114 from mitmproxy/fix-websocket-serialization
make websocket flows serializable
2017-03-10 21:15:46 +01:00
Thomas Kriechbaumer
49e0f23848 use flow.id to link websocket + handshake flows 2017-03-10 19:38:50 +01:00
Thomas Kriechbaumer
c39b65c06b Merge pull request #2128 from Kriechi/disable-more-h2c
disable h2c prior knowledge connections
2017-03-10 19:30:13 +01:00
Maximilian Hils
f3df4855af fix type hints 2017-03-10 19:15:44 +01:00
Maximilian Hils
db40bdca15 Merge pull request #2131 from MatthewShao/jest-dev
[web] remove the tests for abandoned files.
2017-03-10 18:21:55 +01:00
Thomas Kriechbaumer
45bf1ff64d disable h2c prior knowledge connections 2017-03-10 11:37:25 +01:00
Matthew Shao
da93525d2e [web] remove the tests for abandoned files. 2017-03-10 08:52:11 +08:00
Thomas Kriechbaumer
b1dd86d7ae make websocket flows serializable
fixes #2113
2017-03-09 19:08:59 +01:00
Ujjwal Verma
25703f8c53 Fixed Replacement test 2017-03-09 23:33:11 +05:30
Ujjwal Verma
07a8c4987a Removed replace-from-file option.Made requested changes 2017-03-09 23:20:35 +05:30
lymanZerga11
8e67c6f512 add tests 2017-03-09 09:01:37 +08:00
lymanZerga11
6d53d08b6c Add tests 2017-03-09 09:01:04 +08:00
Aldo Cortesi
98b5893855 Merge pull request #2100 from cortesi/options
Options revamp
2017-03-09 12:27:36 +13:00
Aldo Cortesi
53178f35be Send change event when options are reset 2017-03-09 08:53:36 +13:00
Aldo Cortesi
7ea171de4e Merge remote-tracking branch 'upstream/master' into options 2017-03-09 08:33:25 +13:00
Maximilian Hils
44c3c3ed86 Merge pull request #2124 from mitmproxy/opensuse-docs
Add install docs for openSUSE
2017-03-08 20:06:35 +01:00
Maximilian Hils
7bec0c73cf Merge pull request #2121 from mitmproxy/address-leftovers
fix tcp.Address leftovers
2017-03-08 20:06:11 +01:00
Thomas Kriechbaumer
69f7ad21fe Merge pull request #2090 from mitmproxy/fix-pathod-header-doc
pathoc: fix documentation for headers
2017-03-08 18:21:56 +01:00
Maximilian Hils
ca819fb923 add install docs for openSUSE 2017-03-08 17:42:19 +01:00
Maximilian Hils
ebedd2875f Merge pull request #2117 from MatthewShao/jest-dev
Add Javascript tests to Travis CI. (#2093)
2017-03-08 16:54:02 +01:00
Maximilian Hils
927b5707fe fix tcp.Address leftovers
this fixes the issue described in https://github.com/mitmproxy/mitmproxy/issues/2119#issuecomment-285067292
2017-03-08 16:18:34 +01:00
Maximilian Hils
b345f5d432 typing.Type -> type
`typing.Type` should have been `typing.Type[Any]`,
which in turn is equivalent to `type`
2017-03-08 15:17:45 +01:00
Maximilian Hils
63179d9751 core -> core_option_validation
longer, but much clearer for devs who are unfamiliar with the codebase.
2017-03-08 15:17:07 +01:00
Maximilian Hils
618e0c6265 add type hints 2017-03-08 15:10:06 +01:00
lymanZerga11
716306538f Update proxyauth.py 2017-03-08 13:59:43 +08:00
Matthew Shao
dae7435135 Update .travis.yml 2017-03-08 13:00:09 +08:00
lymanZerga11
cf83cbf2df Update proxyauth.py 2017-03-08 11:34:59 +08:00
Matthew Shao
7ff48b8bec Add javascript tests to Travis CI. (#2093) 2017-03-08 09:57:38 +08:00
Maximilian Hils
f276c7a80d change add_option parameter order
name, type, value matches natural language ($x is a bool with a default value of $y)
and also matches the python type annotation order of name: type = value
2017-03-08 00:52:37 +01:00
Maximilian Hils
8707928b16 unify server spec parsing 2017-03-08 00:18:34 +01:00
Aldo Cortesi
f0d6237a96 Merge remote-tracking branch 'upstream/master' into options 2017-03-08 08:22:49 +13:00
Maximilian Hils
cb6240974d Merge pull request #2108 from ayamamori/patch-1
Update tcpproxy.rst
2017-03-07 14:53:27 +01:00
Maximilian Hils
88d48e38af Revert "clearly indentify git-checkout as dev version"
This temporarily reverts commit 3b4d8d6eca,
which broke the snapshot builds.
2017-03-07 14:49:52 +01:00
Maximilian Hils
bda39335b0 fix other occurences of options shortcut 2017-03-07 12:16:23 +01:00
Maximilian Hils
96b798615c Merge pull request #2106 from davidpshaw/python_3_to_master
Updated for python 3
2017-03-07 12:12:47 +01:00
Aldo Cortesi
98ec3b77fe Carefully re-add a small number of short flags
The mechanism for booleans attaches the short flag to whatever the opposite of
the default is.
2017-03-07 21:01:21 +13:00
Aldo Cortesi
aed780bf48 Change the way proxy authetication is specified
We now have one option "proxyauth". If this is "any", we accept any
credentials, if it starts with an @ it's treated as a path to an htpasswd file,
if it is of the form username:password it's a single-user credential.
2017-03-07 20:18:30 +13:00
Aldo Cortesi
b0ba765598 Add type and choices to options dump commets. 2017-03-07 19:29:08 +13:00
Yamamori Akihiro
7ca2913c1a Update tcpproxy.rst
Correction in key short cut for TCP Proxy
2017-03-07 14:15:29 +09:00
Aldo Cortesi
320d8848ab Options tweaks
- Regularise presentation and wording
- Help is mandatory for all options
- Auto-generate wording to say that sequence options can be passed multiple
times on the command-line
2017-03-07 15:23:46 +13:00
Aldo Cortesi
10db254791 Remove less commonly used command-line options
We now have --set, so only options that really deserve it get a dedicated flag.
I'm inclined to strip this back even more. Feel free to argue that YOUR
favourite option deserves special treatment here.
2017-03-07 14:46:28 +13:00
Aldo Cortesi
ac3b0d69cc Add the --set option to set options directly
The --set option is a universal flag for setting options. Some examples:

Turn on a boolean:

mitmdump --set onboarding=false

Add a value to a sequence:

mitumdupm --set setheaders=/foo/bar/voing

Zero a sequence:

mitumdupm --set setheaders
2017-03-07 14:27:50 +13:00
Aldo Cortesi
79f5883c2f Option spacing and coverage 2017-03-07 13:47:39 +13:00
Aldo Cortesi
99a6b0dbc1 Add --options that dumps annotated option defaults 2017-03-07 13:16:28 +13:00
Maximilian Hils
6a4ca68a1c Merge pull request #2101 from s4chin/add-websocket-filter-to-web
web: Add websocket filter
2017-03-06 23:34:13 +01:00
Maximilian Hils
193c707061 Merge pull request #2104 from lymanZerga11/patch-2
Fixes #2102
2017-03-06 23:33:33 +01:00
Maximilian Hils
8b79892246 Merge pull request #2105 from Kriechi/dev-version
clearly indentify git-checkout as dev version
2017-03-06 23:32:59 +01:00
David Shaw
5d82068218 Updated for python 3 2017-03-06 17:30:40 -05:00
Aldo Cortesi
d13df40753 Fix lint 2017-03-07 10:52:28 +13:00
Aldo Cortesi
3d9c2233be Flatten commandline arg structure, extract common run func for tools 2017-03-07 10:51:24 +13:00
Aldo Cortesi
b51df9a0b1 Cleanups and test coverage 2017-03-07 10:28:15 +13:00
Aldo Cortesi
2312cf6fb0 Automate slurping up command-line options
Now that options are completely regular, we can automate reading them out of
arguments, rather than listing them out by hand like savages.
2017-03-07 08:49:19 +13:00
Thomas Kriechbaumer
3b4d8d6eca clearly indentify git-checkout as dev version 2017-03-06 18:40:43 +01:00
lymanZerga11
fd5079b8a6 Update flowlist.py 2017-03-06 23:19:39 +08:00
Aldo Cortesi
edfd62e42a Replacements and setheaders are always strings
Instead of having two representations we have one canonical specification.
Fixing the editor in console is left ot a further patch.
2017-03-06 20:58:51 +13:00
Aldo Cortesi
82163a1e68 Unify mode specification
We now have:

    --mode regular (the default)
    --mode transparent
    --mode socks5
    --mode reverse:SPEC
    --mode upstream:SPEC

Where SPEC is a host specification.
2017-03-06 20:30:49 +13:00
Sachin Kelkar
fa96a1d1ef web: Add websocket filter 2017-03-06 10:20:11 +05:30
Aldo Cortesi
f5fb6972aa Options unification: certs
- Regularise to Sequence[str]
- Move conversion and checking into proxy config object
2017-03-06 15:36:52 +13:00
Aldo Cortesi
9b1f40da37 Options unification: streamfile
We now have one option to control this. If the path is prefixed with a "+" we
append, otherwise we overwrite.
2017-03-06 13:48:37 +13:00
Aldo Cortesi
71a830c836 Options unification: string choices 2017-03-06 13:20:17 +13:00
Aldo Cortesi
e70b46672c Options unification: simple string sequences 2017-03-06 11:56:11 +13:00
Aldo Cortesi
18a6b66ba4 Options unification: simple strings
Move all simple string options to the new scheme. Also regularise some names.
2017-03-06 11:39:19 +13:00
Aldo Cortesi
201c65960e Options unification: sizes
Start dealing with corner cases:

- Sizes are always stored in options as strings
- Add a new core addon that's responsible for verifying settings that don't
belong to an addon
- Add a _processed scratch space on the Options object for processed core
values to be stored in. This is pretty dirty, but less dirty than re-parsing
values every time. We'll come up with something better down the track.
2017-03-06 09:07:16 +13:00
Maximilian Hils
22154dee5c Merge pull request #2085 from MatthewShao/dev
[web] Add mouse support for FilterInput popover.
2017-03-05 13:07:54 +01:00
Aldo Cortesi
45d18ac8cb Start unifying options and the command-line: ints
Moves all integer options apart from a few tricky ones like verbosity over to
auto generation. Also add a metavar argument to parser generation to support
this.
2017-03-05 20:45:55 +13:00
Aldo Cortesi
f15a628561 Start unifying options and the command-line: booleans
This commit:

- Adds a help field to options
- Adds a function to generate parser definitions from options
- Uses this to migrate all boolean flags over to the new system
- Makes all booleans consistently follow the --foo/--not-foo convention

There are a number of things left to be done here:

- Argparse doesn't give us a nice way to format --foo --not-foo help. Click
does, and moving to click is a goal down the track.
- For now, we remove all short aliases. I want to re-evaluate these
systematically once we have the new structure in place.
2017-03-05 20:16:33 +13:00
Aldo Cortesi
67381ae550 Revamp options
- Options are now explicitly initialized with an add_option method
- We have one canonical Options class - ditch dump.Options
2017-03-05 15:10:03 +13:00
Clemens Brunner
e0644398b6 Merge pull request #2095 from MatthewShao/fix-#2083
[web] fix scroll bug in flow detail. (#2083)
2017-03-04 17:04:44 +01:00
Matthew Shao
6a3497f09c [web] Retain focus on input field after selecting. (#2085) 2017-03-04 22:44:13 +08:00
Maximilian Hils
2a1ed7f3eb Merge pull request #2082 from tarnacious/master
Call error handler and mark flow on HTTPException
2017-03-04 15:12:29 +01:00
Matthew Shao
9f348122ec [web] fix scroll bug in flow detail. (#2083) 2017-03-04 21:14:46 +08:00
Maximilian Hils
1bafe73a94 update release docs 2017-03-04 11:50:40 +01:00
Maximilian Hils
f71c11559c Merge pull request #2081 from s4chin/add-pretty-host
web: Fix #1888
2017-03-04 11:48:05 +01:00
Maximilian Hils
78fd5a9dad Merge pull request #2053 from krsoninikhil/on-issues
Adds --keep-host-header option (#2039)
2017-03-04 11:42:44 +01:00
Maximilian Hils
50ebdf3081 update docs wording 2017-03-04 11:42:30 +01:00
Sachin Kelkar
40943f5618 web: Fix #1888 2017-03-03 16:14:20 +05:30
Nikhil Soni
0081d9b828 Merge branch 'master' into on-issues 2017-03-03 12:58:44 +05:30
Nikhil Soni
3da8532bed Adds test for --keep-host-header 2017-03-03 12:34:36 +05:30
Nikhil Soni
317d183ba4 Changes dns_spoofing example to use --keep-host-header 2017-03-03 12:34:36 +05:30
Nikhil Soni
2e90373e4b Updates help msg and docs for --keep-host-header 2017-03-03 12:34:20 +05:30
Matthew Shao
6479bd4e76 [web] Simplify the code. (#2085) 2017-03-03 09:16:26 +08:00
Maximilian Hils
f1417dd859 pathoc: fix documentation for headers 2017-03-02 19:24:48 +01:00
Maximilian Hils
bae4cdf8d5 docs: fix cert install link 2017-03-02 19:10:11 +01:00
Maximilian Hils
b6eda9ed0a docs: http -> https where possible 2017-03-02 19:09:14 +01:00
Maximilian Hils
182c1adf7d Merge pull request #2087 from TomTasche/patch-1
link to stackoverflow for chrome certificate management
2017-03-02 19:04:36 +01:00
Thomas Taschauer
fc9b152d06 link to stackoverflow for chrome certificate management 2017-03-02 14:31:41 +01:00
Matthew Shao
c397a21980 [web] Add mouse support for FilterInput popover. 2017-03-02 11:09:13 +08:00
tarnacious
fc3848345b Call error handler and mark flow on HTTPException
This allows scripts to handle HTTPExceptions such as "HTTP Body too
large" raised in mitmproxy/net/http/http1/read.py:131
2017-03-01 16:35:54 +01:00
Thomas Kriechbaumer
a505221e1a http2: fix h2 header normalization test (#2080) 2017-03-01 12:46:42 +01:00
David Dworken
99b584ad7d added XSS scanner example (#1907) 2017-02-27 18:22:39 +01:00
Thomas Kriechbaumer
8f13f357ad Merge pull request #2072 from MatthewShao/dev
[web] Fix #2071, remove client_connect.mitmcert when dumping flow into json.
2017-02-27 17:10:17 +01:00
Matthew Shao
7b4e60a2e7 Fix #2071, remove client_connect.mitmcert when dumping flow into json. 2017-02-27 21:45:26 +08:00
Maximilian Hils
2b3093fa1c Merge pull request #2069 from JordanLoehr/iss2068
Added console_ prefix to options in palettepicker to resolve issue #2068
2017-02-27 05:37:26 +01:00
Jordan Loehr
6fd9146d0d Added console_ prefix to options in palettepicket to resolve issue #2068 2017-02-26 17:08:00 -07:00
Maximilian Hils
0fdf2c0f4b Merge pull request #2067 from whackashoe/fix-2065
fix #2065 by setting correct content encoding for brotli
2017-02-26 22:10:12 +01:00
Jett
18a8834209 fix #2065 by setting correct content encoding for brotli 2017-02-26 14:49:50 -06:00
Thomas Kriechbaumer
19b2208c27 Merge pull request #2066 from Kriechi/certs-tests
certs: coverage++
2017-02-26 20:55:56 +01:00
Thomas Kriechbaumer
e0bc1109c0 do not return IP addresses in SSLCert.altnames 2017-02-26 20:54:06 +01:00
Thomas Kriechbaumer
6d228dfb9f certs: coverage++ 2017-02-26 20:54:04 +01:00
Thomas Kriechbaumer
9b6986ea87 connections: coverage++ (#2064) 2017-02-26 20:50:52 +01:00
Maximilian Hils
b33d568e04 Merge pull request #2063 from ujjwal96/hardump-support
Remove pytz in hardump
2017-02-26 20:00:02 +01:00
Ujjwal Verma
e723a58af5 Remove pytz in hardump 2017-02-25 23:07:47 +05:30
Thomas Kriechbaumer
2aecffd39a optmanager: coverage++ (#2062) 2017-02-25 12:12:43 +01:00
Thomas Kriechbaumer
ccd8e1e617 http: coverage++ (#2060) 2017-02-24 22:39:16 +01:00
Thomas Kriechbaumer
3c66eb5b4b move tests around (#2059) 2017-02-24 22:00:41 +01:00
Thomas Kriechbaumer
e89c785719 move tests around (#2058) 2017-02-24 21:39:13 +01:00
Thomas Kriechbaumer
6d9560df1d Merge pull request #2057 from Kriechi/flowfilter-coverage
flowfilter: coverage++
2017-02-24 20:57:54 +01:00
Thomas Kriechbaumer
d17309eda8 flowfilter: coverage++ 2017-02-24 18:47:56 +01:00
Thomas Kriechbaumer
83f1e2eec0 Merge pull request #2050 from Kriechi/create_connection
nuke tcp.Address and add proper IPv6 support
2017-02-24 15:42:52 +01:00
Maximilian Hils
fab3a8dcf4 fix constant definition 2017-02-24 13:39:03 +01:00
Thomas Kriechbaumer
3e9125a3c1 nuke tcp.Address and add proper IPv6 support 2017-02-24 13:39:02 +01:00
Thomas Kriechbaumer
d0d11cec7b Merge pull request #2055 from Kriechi/http2-normalize-headers
http2: normalize headers before sending
2017-02-23 16:04:11 +01:00
Thomas Kriechbaumer
bbe08bb8d9 http2: normalize headers before sending 2017-02-23 12:53:40 +01:00
Nikhil Soni
14d8c91250 Adds --keep-host-header option (#2039) 2017-02-22 21:49:31 +05:30
Maximilian Hils
ba76dbc672 Merge pull request #2048 from ujjwal96/ipv6-addresses
Absolute IPv6 addresses supported
2017-02-22 13:17:53 +01:00
Thomas Kriechbaumer
391f28f78c Merge pull request #2018 from dlenski/save_mitm_cert 2017-02-21 21:08:28 +01:00
Thomas Kriechbaumer
786cd214d6 update compat 2017-02-21 20:57:54 +01:00
Maximilian Hils
6b2383a9d8 minor adjustments 2017-02-21 20:57:29 +01:00
Daniel Lenski
48b3d1af2f store generated cert for each flow
fixes #1935
2017-02-21 20:57:29 +01:00
Thomas Kriechbaumer
cf0bce77a9 lint! 2017-02-21 19:40:06 +01:00
Thomas Kriechbaumer
0b1cdc382c bump dev version 2017-02-21 19:17:33 +01:00
Thomas Kriechbaumer
91c3a99d48 update CHANGELOG with 2.0.0 release 2017-02-21 18:55:31 +01:00
Maximilian Hils
b87b69be7e Update README.md 2017-02-21 18:38:30 +01:00
Maximilian Hils
dc7a7ad697 Update README.md 2017-02-21 18:37:56 +01:00
Maximilian Hils
02a563dff1 [web] yarn? yarn. 2017-02-21 16:05:09 +01:00
Maximilian Hils
2df2fc1f38 Merge pull request #2051 from MatthewShao/fix-#1928-@concurrent-in-OOP
Fix #1928, @concurrent decorator in class
2017-02-21 15:38:34 +01:00
Maximilian Hils
29c4a43e50 docs++ 2017-02-21 15:38:20 +01:00
Maximilian Hils
96256579e6 update mitmweb resources 2017-02-21 15:33:13 +01:00
Maximilian Hils
aa6b0f299e minor changes 2017-02-21 13:00:04 +01:00
Matthew Shao
5fc4fc28b6 Add test for @concurrent decorator in class. 2017-02-21 16:56:48 +08:00
Matthew Shao
f9714fbf3e Fix #1928, @concurrent decorator now works for class methods. 2017-02-21 11:59:50 +08:00
Ujjwal Verma
11134b669e Absolute IPv6 addresses supported 2017-02-20 21:02:43 +05:30
Thomas Kriechbaumer
18401dda8f Merge pull request #2047 from Kriechi/lymanZerga11-patch-1
improve tests
2017-02-20 13:01:33 +01:00
Thomas Kriechbaumer
0de277c18b improve test 2017-02-20 11:48:57 +01:00
Thomas Kriechbaumer
050245e842 Merge pull request #2017 from lymanZerga11/patch-1
Catch ValueErrors from url.parse()
2017-02-20 11:48:40 +01:00
Thomas Kriechbaumer
48cfaf8c39 Merge pull request #2046 from Kriechi/krsoninikhil-debug
improve tests
2017-02-20 11:46:12 +01:00
Thomas Kriechbaumer
ac6915c002 improve tests 2017-02-20 11:11:10 +01:00
Thomas Kriechbaumer
51e08a5b85 Merge pull request #2041 from krsoninikhil/debug
Adds PyInstaller build indicator to --version argument
2017-02-20 10:29:15 +01:00
Thomas Kriechbaumer
927a1ebab4 Merge pull request #2045 from Kriechi/protobuf
protobuf: coverage++
2017-02-20 10:14:18 +01:00
Nikhil Soni
ed084f5413 Adds test for pyinstaller indicator 2017-02-19 19:15:36 +05:30
Thomas Kriechbaumer
36352c9539 protobuf: coverage++ 2017-02-19 14:29:09 +01:00
Maximilian Hils
3ee5227cca Merge pull request #2043 from Kriechi/http2
http2: disable priority forwarding
2017-02-18 19:27:43 +01:00
Thomas Kriechbaumer
83c2de8849 http2: disable priority forwarding 2017-02-18 14:30:08 +01:00
Maximilian Hils
4158a1ae55 Merge pull request #2040 from mhils/request-host-header
Add "Request.host_header"
2017-02-18 12:08:54 +01:00
Thomas Kriechbaumer
6ef4f094b3 Merge pull request #2038 from Kriechi/improve-http2-cov
test forbidden HTTP/2 headers in reponses
2017-02-18 11:50:57 +01:00
Thomas Kriechbaumer
8cbd6dca9f Merge pull request #2035 from Kriechi/fix-1916
fix #1916
2017-02-18 11:40:56 +01:00
Thomas Kriechbaumer
47e6f977de test forbidden HTTP/2 headers in reponses 2017-02-18 11:26:54 +01:00
Nikhil Soni
2a461d6b39 Adds PyInstaller build indicator to --version argument 2017-02-18 06:27:06 +05:30
Maximilian Hils
b9e31f213f .headers["host"] -> .host_header 2017-02-18 00:13:14 +01:00
Maximilian Hils
49c8e19f80 add request.host_header, fix #2036 2017-02-17 23:31:53 +01:00
Maximilian Hils
6a1e03ac6f tests: make full cov plugin cwd-independent 2017-02-17 23:29:10 +01:00
Maximilian Hils
33acb48c71 Merge pull request #2032 from Kriechi/individual-coverage
add individual-coverage check
2017-02-17 22:56:13 +01:00
Thomas Kriechbaumer
c04d14e53c fix #1916 2017-02-17 22:45:31 +01:00
Thomas Kriechbaumer
4cec88fc7f remove unneeded test module 2017-02-17 20:41:10 +01:00
mame82
ffdbccd571 Use existing urlencoding conventions when re-encoding edited form #1946 (#2022) 2017-02-16 15:03:27 +01:00
Thomas Kriechbaumer
6b22ca7a32 add individual-coverage check 2017-02-16 11:43:45 +01:00
Thomas Kriechbaumer
337b1c9399 fix wrong filename 2017-02-15 18:45:49 +01:00
Maximilian Hils
d1186eea18 Merge pull request #2029 from mhils/proxyauth
Improve ProxyAuth
2017-02-15 16:52:20 +01:00
Thomas Kriechbaumer
9cf00cbc70 ignore compiled mitmweb JS code 2017-02-15 16:24:53 +01:00
Maximilian Hils
2955e3d566 improve make_error_response 2017-02-15 15:55:08 +01:00
Thomas Kriechbaumer
94a7e99fda Merge pull request #2028 from Kriechi/nuke-pillow
nuke Pillow
2017-02-15 15:29:57 +01:00
Maximilian Hils
4bac850bb1 fix #1722, fix #1734, refs #2019 2017-02-15 14:20:46 +01:00
Thomas Kriechbaumer
80113a9d6e remove zlib1g dependency from install instructions 2017-02-15 14:08:36 +01:00
Maximilian Hils
0d9c7ce50c image view: add fallback, catch all images but svgs 2017-02-15 14:04:24 +01:00
Thomas Kriechbaumer
4aa656f2a6 Merge pull request #2027 from Kriechi/pytest-plugin
extract full-coverage pytest plugin
2017-02-15 12:14:19 +01:00
Thomas Kriechbaumer
8a6f8bd461 nuke Pillow 2017-02-15 00:54:14 +01:00
Thomas Kriechbaumer
24a51df9cb extract full-coverage pytest plugin 2017-02-15 00:29:43 +01:00
Thomas Kriechbaumer
bb2fa6dc7d Merge pull request #2026 from Kriechi/filename-matching
add filename-matching linter
2017-02-15 00:24:05 +01:00
Thomas Kriechbaumer
4d973e8295 fix imports 2017-02-14 23:47:33 +01:00
Thomas Kriechbaumer
a12c3d3f8e restructure and move test files
add empty test files to satisfy linter
2017-02-14 23:31:37 +01:00
Thomas Kriechbaumer
04748e6f3f add filename-matching linter 2017-02-14 22:48:24 +01:00
Thomas Kriechbaumer
cd9cd8a195 update lint options 2017-02-14 22:44:55 +01:00
Maximilian Hils
a3436897ad Merge pull request #2024 from MatthewShao/fix_websocket_msg_in_console
fix websocket message display crash in console.
2017-02-14 18:02:09 +01:00
Maximilian Hils
5acdd78b15 fix typo 2017-02-14 17:45:54 +01:00
Matthew Shao
9b9d72594c fix websocket message display crash in console. 2017-02-14 21:21:39 +08:00
lymanZerga11
d30ef7ee3e Update test_flowlist.py 2017-02-14 21:17:18 +08:00
lymanZerga11
a52d8c1dab Update test_flowlist.py 2017-02-14 21:01:01 +08:00
Maximilian Hils
75a0a4c092 Merge pull request #2016 from Kriechi/pathod-refactor
remove treq from pathoc
2017-02-13 11:16:15 +01:00
Maximilian Hils
9c29f3b96d Merge pull request #2015 from Kriechi/nuke-pypy
nuke pypy
2017-02-13 11:16:02 +01:00
lymanZerga11
26a17a3d82 Update test_flowlist.py 2017-02-13 15:05:29 +08:00
lymanZerga11
a912d67c06 Update test_flowlist.py 2017-02-13 10:47:50 +08:00
lymanZerga11
577fb818b9 Update test_flowlist.py 2017-02-13 10:39:48 +08:00
lymanZerga11
f5b30b8872 Update test_flowlist.py 2017-02-12 23:36:26 +08:00
lymanZerga11
df8a5aa9be Update test_flowlist.py 2017-02-12 23:23:23 +08:00
lymanZerga11
c622e4a649 Create test_flowlist.py 2017-02-12 23:10:49 +08:00
lymanZerga11
55e471af40 Catch ValueErrors from url.parse() 2017-02-12 23:06:11 +08:00
Thomas Kriechbaumer
4771c9599e remove treq from pathoc
Using a function intended only for tests in active live code is ugly.
However, this whole portion of pathoc could benefit from some further improvements.
2017-02-12 13:10:51 +01:00
Thomas Kriechbaumer
63cfb4e480 nuke pypy 2017-02-12 12:32:30 +01:00
Alireza Mosajjal
f77cf03543 add version info to web footer (#2010)
fixes #1893
2017-02-12 10:06:44 +01:00
Maximilian Hils
3067a971f9 Merge pull request #2000 from s4chin/add-jpeg-parser
Add jpeg parser
2017-02-11 23:00:14 +01:00
Sachin Kelkar
245e24dcf3 Add sources of images, remove copyrighted image 2017-02-12 01:19:36 +05:30
Maximilian Hils
51f6d279a7 Merge pull request #2008 from yjh0502/master
Add transparent proxy support for OpenBSD
2017-02-11 12:00:02 +01:00
Maximilian Hils
e4cb96f84d consolidate readme shields 2017-02-11 11:54:59 +01:00
Sachin Kelkar
ccca04b450 Fix coverage 2017-02-11 15:01:54 +05:30
Jihyun Yu
4adc575bad Add transparent proxy support for OpenBSD
Add transparent proxy support for OpenBSD with pf divert-to.
2017-02-11 14:05:22 +09:00
Maximilian Hils
71742654e3 Merge pull request #2005 from ujjwal96/script-reload
Closes #1828 script reloads on py file changes
2017-02-11 01:45:14 +01:00
Maximilian Hils
d4593bc333 Merge pull request #2007 from mitmproxy/update-dependencies
Update mypy
2017-02-11 01:43:44 +01:00
Maximilian Hils
85542bd12b Merge pull request #2006 from Kriechi/coverage++
coverage++
2017-02-11 01:43:27 +01:00
Maximilian Hils
705ffd6d06 update mypy
The pypi package name has changed.
2017-02-11 00:14:49 +01:00
Thomas Kriechbaumer
c8c79cc291 coverage++ 2017-02-10 22:55:15 +01:00
Sachin Kelkar
8eb1d34644 Add app1 marker and tests 2017-02-10 22:40:19 +05:30
Ujjwal Verma
809207195d closes #1828 script reloads on py file changes 2017-02-10 22:21:12 +05:30
Thomas Kriechbaumer
d4264cb719 Update .travis.yml
otherwise `mitmproxy --version` fails because `git describe` might fail fetching the distance to the last release tag
2017-02-10 16:37:22 +01:00
Maximilian Hils
d70f7cd8cc Merge pull request #2004 from mhils/update-dependencies
update dependencies
2017-02-10 15:28:10 +01:00
Maximilian Hils
43867dbd98 fix flaky coverage 2017-02-10 15:28:02 +01:00
Maximilian Hils
1c8836a8d6 update dependencies 2017-02-10 14:38:05 +01:00
Sachin Kelkar
c4e141a000 Add jpeg app0 sof0 com parsing 2017-02-10 11:16:23 +05:30
Maximilian Hils
74c991d70b Merge pull request #2002 from mitmproxy/content_views_edit
Content views edit
2017-02-09 23:21:44 +01:00
Ujjwal Verma
d6465b907f Closes #1580 Gives warning when explicit proxy configured in transparent mode (#1996) 2017-02-09 20:56:06 +01:00
Maximilian Hils
380ff50e57 Merge pull request #2003 from Kriechi/coverage++
test refactoring and coverage++
2017-02-09 17:45:50 +01:00
Maximilian Hils
da8444b11f flow_count() -> len(flows) 2017-02-09 16:44:27 +01:00
Maximilian Hils
1084588103 Merge pull request #1998 from mhils/fix-change-upstream
Fix change_upstream_proxy_server
2017-02-09 16:39:20 +01:00
Thomas Kriechbaumer
d10560d54c improve coverage report 2017-02-09 16:08:36 +01:00
Thomas Kriechbaumer
2ff5d72236 minor changes 2017-02-09 16:08:36 +01:00
Thomas Kriechbaumer
0299bb5b2e eventsequence: coverage++ 2017-02-09 16:08:36 +01:00
Thomas Kriechbaumer
5a3976c43e coverage whitelist -> blacklist 2017-02-09 16:08:36 +01:00
Thomas Kriechbaumer
f6cea09d5a stateobject: coverage++ 2017-02-09 16:08:36 +01:00
Thomas Kriechbaumer
1847cf175c websockets, tcp, version: coverage++ 2017-02-09 16:08:35 +01:00
Thomas Kriechbaumer
2134b5b06a remove FIXME 2017-02-09 16:08:35 +01:00
Thomas Kriechbaumer
b5f0342664 remove verified remark 2017-02-09 16:08:35 +01:00
Thomas Kriechbaumer
ae94ca6fa9 remove deprecated flow_count function 2017-02-09 16:08:35 +01:00
Maximilian Hils
d6d1ff0170 simplify state copy 2017-02-09 16:08:24 +01:00
Maximilian Hils
9b97b63891 fix change_upstream_proxy_server 2017-02-09 15:24:31 +01:00
Maximilian Hils
7a205e80aa improve stateobject tests 2017-02-09 14:21:25 +01:00
Maximilian Hils
fa661217c1 Merge pull request #2001 from mitmproxy/issue#40_response_body_edit
fix response body edit issue
2017-02-09 13:29:41 +01:00
Maximilian Hils
4cf6047a4e Merge pull request #1999 from Kriechi/coverage++
pytest.raises: shim new API
2017-02-09 10:42:55 +01:00
cle1000
fb06c66437 remove contentview selector and view description if edit mode is on 2017-02-08 21:09:03 +01:00
cle1000
b4bed57d4c fix show_lines button visible in edit mode if you change tabs 2017-02-08 21:07:40 +01:00
Thomas Kriechbaumer
7a9d40817c pytest.raises: shim new API 2017-02-08 20:04:07 +01:00
cle1000
dae0c23ec8 fix response body edit issue 2017-02-08 19:57:57 +01:00
Sachin Kelkar
5dd54ef012 Update kaitaistruct version to 0.6 2017-02-08 21:16:17 +05:30
Maximilian Hils
28c0596742 Merge pull request #1997 from s4chin/add-gif-parser
Add gif parser and tests
2017-02-08 12:09:48 +01:00
Maximilian Hils
79354c0b43 Merge pull request #1984 from ujjwal96/har_dump-fix
Fixes #1978
2017-02-08 12:01:32 +01:00
Sachin Kelkar
66ad95c330 Fix gif parsing error on some gifs and add test 2017-02-08 00:03:07 +05:30
Sachin Kelkar
4ef5de2cce Add gif parser and tests 2017-02-06 17:57:59 +05:30
Ujjwal Verma
c622622c59 Encoding fixes and tests 2017-02-05 18:59:01 +05:30
Thomas Kriechbaumer
2316c0fb74 Merge pull request #1993 from Kriechi/coverage++
fix flaky test
2017-02-05 11:29:27 +01:00
Thomas Kriechbaumer
288f9a3857 fix flaky test 2017-02-05 10:42:47 +01:00
Maximilian Hils
d133b8baee Merge pull request #1989 from Kriechi/coverage++
coverage++
2017-02-04 16:05:11 +01:00
Thomas Kriechbaumer
966ffaa3d6 coverage++ 2017-02-04 13:48:55 +01:00
Maximilian Hils
155670766e Merge pull request #1988 from krsoninikhil/ordereddict
Closes #1977
2017-02-04 13:46:44 +01:00
Nikhil Soni
e6de57ccc6 Changes view._store from dict to OrderedDict 2017-02-04 17:44:22 +05:30
Maximilian Hils
53f298ac41 Merge pull request #1967 from s4chin/remove-pillow
Add png parser
2017-02-03 18:58:34 +01:00
Maximilian Hils
bbdb7300fd Merge pull request #1983 from Kriechi/coverage++
coverage++
2017-02-03 18:56:56 +01:00
Sachin Kelkar
15548ff433 Feedback 2017-02-03 18:40:50 +05:30
Maximilian Hils
85e39b86bb update installbuilder 2017-02-03 12:04:11 +01:00
Thomas Kriechbaumer
bcaaa2f40b coverage++ 2017-02-03 11:55:33 +01:00
Maximilian Hils
3f26a0b5a5 Merge pull request #1982 from ujjwal96/preserve-marked-flows
Closes #1960 'Z' removes unmarked flows
2017-02-03 11:43:57 +01:00
Sachin Kelkar
0674485e76 Fix and cleanup 2017-02-03 15:02:35 +05:30
Sachin Kelkar
88dbfd5257 Add iTXt and zTXt tests 2017-02-03 14:12:54 +05:30
Sachin Kelkar
abef020e07 Fix as per feedback and add more tests 2017-02-03 14:12:54 +05:30
Sachin Kelkar
6202958048 Add png parser 2017-02-03 14:12:54 +05:30
Ujjwal Verma
e10c36fe11 Added test 2017-02-03 02:58:02 +05:30
Ujjwal Verma
11b4b3209d Closes #1960 'Z' removes unmarked flows 2017-02-03 01:35:53 +05:30
Thomas Kriechbaumer
79aa994275 fix merge 2017-02-02 17:26:31 +01:00
Maximilian Hils
8b6e3d8bd3 Merge pull request #1979 from 0neblock/master
Fixed following on flowlist
2017-02-02 17:24:04 +01:00
Thomas Kriechbaumer
3f4d472c80 Merge pull request #1980 from Kriechi/improve-tests
improve tests
2017-02-02 17:23:11 +01:00
Thomas Kriechbaumer
4f0b2bc4de adapt coverage checks 2017-02-02 14:20:56 +01:00
Aidan Cyr
00a6551622 Fixed following on flowlist
Fixed a focus_follow was missed when options were cleaned up.
2017-02-02 23:00:47 +11:00
Thomas Kriechbaumer
ae008ed80b replace tutils.raises with pytest.raises + shim 2017-02-02 12:59:01 +01:00
Thomas Kriechbaumer
ec92d7f67e cleanup test utils 2017-02-02 12:59:01 +01:00
Thomas Kriechbaumer
c1bc1ea584 Merge pull request #1959 from Kriechi/coverage-fail
add test coverage protection
2017-02-02 12:55:33 +01:00
Thomas Kriechbaumer
6e329595ca add test coverage protection 2017-02-02 11:39:33 +01:00
Thomas Kriechbaumer
380d8ec370 increase test coverage 2017-02-02 10:15:01 +01:00
Thomas Kriechbaumer
3ae060f0d3 fix console test 2017-02-02 10:13:12 +01:00
Thomas Kriechbaumer
2606de25e4 fix linting error 2017-02-02 09:36:33 +01:00
Maximilian Hils
7b2a986cea tests++ (#1976) 2017-02-01 17:52:01 +01:00
lymanZerga11
4b10212caf Add except clause to catch script parsing errors (#1929) 2017-02-01 15:27:10 +01:00
Maximilian Hils
212d9f1b98 Merge pull request #1948 from amm0nite/fix_dns_spoofing_example
Fix for dns_spoofing.py example
2017-02-01 15:25:51 +01:00
Aldo Cortesi
cf991ba4e2 Merge pull request #1974 from cortesi/setheaders
Regularise setheaders options
2017-02-01 16:47:19 +13:00
Aldo Cortesi
f44dab5d26 Merge pull request #1973 from cortesi/replace
Revamp replacement hooks
2017-02-01 13:03:29 +13:00
Aldo Cortesi
914659e888 Regularise setheaders options
As per replacements:

- Make the option type a string/tuple union
- Localise parsing strictly within the addon
- Adapt the console editor (we'll find a more elegant solution later)
2017-02-01 12:22:05 +13:00
Ammonite
9e3f06b7f2 Better test 2017-01-31 23:23:13 +01:00
Aldo Cortesi
4cc75a9560 Revamp replacement hooks
- Replacement specifiers can be either strings or tuples. This lets us cope
gracefully with command-line parsing (and posible quick interactive
specification) without having to special-case replacement hooks, or have
knowledge of hook specification leak outside the addon. We can also now use the
same command-line spec format in config files.
- Split replacement and replacement from file into separate addons and options.
Files are now read on each replacement, so you can edit replacement files in
place without restart.
- Modernise the test suite to use addon test helpers.

TODO: editing and displaying replace-from-file in console app
2017-02-01 11:10:28 +13:00
Aldo Cortesi
02f51d043d Merge pull request #1965 from cortesi/optname
Consolidate option names
2017-02-01 08:39:35 +13:00
Thomas Kriechbaumer
ff379b7665 fully test addonmanager (#1970) 2017-01-31 10:57:22 +01:00
Maximilian Hils
1523068b03 Merge pull request #1964 from mhils/new-contribution-docs
New contribution docs
2017-01-31 09:02:00 +01:00
Ammonite
e2e15df358 Add a test for the host replacement 2017-01-30 23:44:13 +01:00
Ammonite
aaff9dfd32 Reset the host header to the correct destination 2017-01-30 23:41:47 +01:00
Markus Unterwaditzer
980b8aedd3 Update shim path (#1968) 2017-01-30 20:07:37 +01:00
Maximilian Hils
45ace793d0 🙈 2017-01-30 19:30:35 +01:00
Maximilian Hils
4746ce939f README: py.test -> pytest 2017-01-30 16:46:22 +01:00
Maximilian Hils
3fe2f9578a always use 'venv' as virtualenv folder 2017-01-30 00:40:24 +01:00
Maximilian Hils
f570c57006 add contributing section to README, remove autoenv 2017-01-30 00:33:24 +01:00
Aldo Cortesi
35aff3b783 Consolidate option names
- Onboarding app options to onboarding*
- Console-specific options to console_*
- Web-specific options to web_*
2017-01-30 11:15:12 +13:00
Maximilian Hils
a384dea62b rework README dev sections 2017-01-29 23:06:50 +01:00
Maximilian Hils
edb96f69f5 add contributing section that redirects to README 2017-01-29 22:10:37 +01:00
Maximilian Hils
e10fb22f9c remove outdated testing section from docs 2017-01-29 22:09:45 +01:00
Maximilian Hils
0919e38514 remove outdated architecture section from docs 2017-01-29 22:08:57 +01:00
Ammonite
c2c6050df3 Store original host in flow metadata 2017-01-29 14:33:53 +01:00
Aldo Cortesi
695cc23696 Merge pull request #1963 from cortesi/cover
addons: unit tests to 100%
2017-01-29 12:04:54 +13:00
Aldo Cortesi
356c4987a2 addons: unit tests to 100%
This patch pushes the coverage of ./tests/mitproxy/addons to 100% of the addons
module.
2017-01-29 11:44:49 +13:00
Thomas Kriechbaumer
d24f76c98e fix newlines on windows 2017-01-25 18:51:09 +01:00
Thomas Kriechbaumer
5549757268 fix alpn requirement in web tests 2017-01-25 18:18:18 +01:00
Thomas Kriechbaumer
3028e06fd2 simplify termlog outfile handling 2017-01-25 17:50:07 +01:00
nish21
ab45e4d183 write errors to stderr (#1952) 2017-01-25 17:49:56 +01:00
Maximilian Hils
e076c23f8d Merge pull request #1957 from s4chin/add-body-filters
web: Add body filters
2017-01-24 17:03:09 +01:00
Sachin Kelkar
15482e3242 web: Add body filters 2017-01-24 21:28:07 +05:30
Thomas Kriechbaumer
acfd548fa2 Merge pull request #1956 from Kriechi/version-string
improve version specifiers
2017-01-23 22:53:02 +01:00
Maximilian Hils
2eaac31344 Merge pull request #1945 from Kriechi/ca-expired
fix #939
2017-01-23 21:22:38 +01:00
Maximilian Hils
c512f095ae Merge pull request #1949 from s4chin/add-src-dst-filters
web: Add ~src and ~dst filters
2017-01-23 21:22:21 +01:00
Maximilian Hils
c46dd1e29d Merge pull request #1955 from Kriechi/test++
increase addon test coverage
2017-01-23 21:21:44 +01:00
Thomas Kriechbaumer
6a7eeef0ee Merge branch 'offby1-patch-1' 2017-01-23 20:42:42 +01:00
Eric Hanchrow
ccb8889342 fix link to macOS and Linux binaries 2017-01-23 20:42:03 +01:00
Thomas Kriechbaumer
63beaa18ce improve version specifiers 2017-01-23 20:33:12 +01:00
Thomas Kriechbaumer
5792e2c483 test disable_h2c_upgrade addon 2017-01-23 18:38:27 +01:00
Thomas Kriechbaumer
d674de298c test websocket addon 2017-01-23 15:45:53 +01:00
Thomas Kriechbaumer
006eb39cc5 fix #939 2017-01-23 15:14:56 +01:00
Sachin Kelkar
9813294854 Merge NullaryExpr, UnaryExpr and BooleanLiteral 2017-01-23 18:38:49 +05:30
Maximilian Hils
86174eb6ad Merge pull request #1950 from Kriechi/nuke-mock
nuke mock dependency
2017-01-23 10:19:43 +01:00
Ammonite
0ca1916f1b Fix host extraction 2017-01-22 15:28:14 +01:00
Ammonite
e8fc4af4c6 Follow PEP-8 and add comment 2017-01-22 14:59:46 +01:00
Thomas Kriechbaumer
127c69c3ac nuke mock dependency
This is already included in Python 3.3+ as unittest.mock
2017-01-22 14:11:28 +01:00
Sachin Kelkar
2b2292f432 web: Add ~src and ~dst filters 2017-01-21 21:48:49 +05:30
Ammonite
93172460aa Add blank lines for lint 2017-01-21 09:39:34 +01:00
Ammonite
8aa250d679 Change class name 2017-01-20 23:48:26 +01:00
Ammonite
a55eba3b37 Get the the original header in requestheaders instead of request 2017-01-20 23:43:53 +01:00
Thomas Kriechbaumer
0022c810e5 replace iOS install instructions for CAs
fixes #1898
2017-01-20 22:04:35 +01:00
Maximilian Hils
d1ccdf41a3 Merge pull request #1947 from s4chin/add-http-tcp-filter
web: Add ~http and ~tcp filters
2017-01-20 18:32:59 +01:00
Sachin Kelkar
bbda53c8b6 web: Add ~http and ~tcp filters 2017-01-20 22:53:37 +05:30
Maximilian Hils
2ca48e5d08 Merge pull request #1940 from s4chin/add-marked-filter
web: Add ~marked filter
2017-01-20 15:26:51 +01:00
Sachin Kelkar
bc8f5a2d71 web: Add ~marked filter 2017-01-20 09:17:09 +05:30
Thomas Kriechbaumer
9a88a2fdea Merge pull request #1941 from Kriechi/sysinfo
provide git information with --version
2017-01-19 23:25:33 +01:00
Thomas Kriechbaumer
72b753c60f provide git information with --version
fixes #1848
2017-01-19 20:27:29 +01:00
Maximilian Hils
ea20bfb233 Merge pull request #1932 from wufeifei/patch-2
update stream.py
2017-01-16 11:31:47 +01:00
Feei
95cca4ce75 update stream.py 2017-01-16 18:30:05 +08:00
Maximilian Hils
345a459720 Merge pull request #1931 from wufeifei/patch-1
update log_events.py
2017-01-16 11:17:42 +01:00
Feei
eaaec4353d update log_events.py 2017-01-16 18:11:18 +08:00
Thomas Kriechbaumer
78fe04ca9d Merge pull request #1923 from mhils/display-http-version
console: display http version in details
2017-01-14 13:11:26 +01:00
Maximilian Hils
028a98380d Merge pull request #1926 from tripleee/patch-1
reSt verbatim formatting error
2017-01-13 14:29:07 +01:00
tripleee
9cedfa7ddd reSt verbatim formatting error
The rendered code snippets would be rewrapped as if it were prose, which wreaks havoc with the code.
2017-01-13 14:26:04 +02:00
Maximilian Hils
fe43e629fd console: display http version in details 2017-01-10 15:26:11 +01:00
Maximilian Hils
6f9422dfb9 Merge pull request #1918 from s4chin/update-hacking-instructions
Update instructions in README
2017-01-10 15:14:42 +01:00
Maximilian Hils
5d0f7e5c41 clarify windows install docs 2017-01-10 11:01:51 +01:00
Maximilian Hils
48e399a285 Merge pull request #1922 from mhils/read-from-stdin
mitmdump: fix reading from stdin
2017-01-10 10:58:18 +01:00
Maximilian Hils
9c133abc79 Merge pull request #1920 from rodsenra/master
Added note about server-side replay for sessions recorded in reverse-proxy mode
2017-01-10 10:57:55 +01:00
Maximilian Hils
d953d83773 mitmdump: fix reading from stdin 2017-01-10 10:37:28 +01:00
Rodrigo Senra
d013f7ec8f Added note about server-side replay for sessions recorded in reverse-proxy mode 2017-01-07 19:58:30 -05:00
Maximilian Hils
88f3459c7d stronger tests, lint 2017-01-07 23:08:50 +01:00
Maximilian Hils
ede124a587 fix #1910 2017-01-07 23:08:50 +01:00
Maximilian Hils
c41bd3fafd minor legibility improvements 2017-01-07 23:08:50 +01:00
Maximilian Hils
b1ec7e78cd Revert "add strutils.replace_surrogates"
This reverts commit 15ae88db08dbf2725c8c9f945f2006c4b2a10d46.
2017-01-07 23:08:50 +01:00
Maximilian Hils
c21ee90deb add strutils.replace_surrogates 2017-01-07 23:08:50 +01:00
Maximilian Hils
042261266f minor encoding fixes
- native() -> always_str()
  The old function name does not make sense on Python 3 only.
- Inline utility functions in message.py.
2017-01-07 23:08:50 +01:00
Maximilian Hils
af194918cf fix HTTP reason phrase encoding
While not explicitly spelled out in the RFCs,
the reason phrase is expected to be ISO-8859-1.
2017-01-07 23:08:50 +01:00
Maximilian Hils
1e89a93801 update dependencies 2017-01-07 23:07:50 +01:00
Sachin Kelkar
38fd88b3d1 Update instructions 2017-01-06 15:33:05 +05:30
lymanZerga11
3ea76a7f3e Controls the length of URL displayed using the -d option (#1903) 2017-01-05 14:37:20 +01:00
Maximilian Hils
2335a70b79 Merge pull request #1904 from chhsiao90/edit-form-encode
Encode urlencoded_form items when editing
2016-12-31 08:01:43 +01:00
chhsiao90
af0539c526 Fixed edit form failed 2016-12-31 14:38:33 +08:00
Maximilian Hils
e83083b64e Merge pull request #1905 from chhsiao90/allow-underscore-hostname
Allow underscore in hostname
2016-12-30 21:19:25 +01:00
chhsiao90
a5f1215eb2 Allow underscore in hostname 2016-12-30 21:03:22 +08:00
Maximilian Hils
973406f327 Merge pull request #1896 from mhils/3.5.0-compat
Fix compat with Python 3.5.0
2016-12-28 15:35:07 +01:00
Maximilian Hils
eab360a02b fix IO type checking 2016-12-28 14:21:19 +01:00
Maximilian Hils
0929e74b4e fix compat with Python 3.5.0 2016-12-28 14:20:53 +01:00
Maximilian Hils
8185cf2724 update io compat for 2.0 2016-12-27 21:03:59 +01:00
Maximilian Hils
9e06c69ea3 Update README.md 2016-12-27 21:01:39 +01:00
Maximilian Hils
2a96d43602 Update README.md 2016-12-27 20:58:32 +01:00
Maximilian Hils
e531a97a8b bump version for next release cycle 2016-12-27 20:52:22 +01:00
Thomas Kriechbaumer
7221f49b25 Merge pull request #1887 from Kriechi/h2-enable
enable HTTP/2 by default
2016-12-27 20:49:09 +01:00
Maximilian Hils
843b1e17c9 add mitmweb to README 2016-12-27 20:47:47 +01:00
Maximilian Hils
6ae378aa20 bump version to 1.0.1 2016-12-27 19:26:28 +01:00
Maximilian Hils
141897c7fc turns out we need this 2016-12-27 19:14:46 +01:00
Maximilian Hils
c78ffbf16d fix url.parse tests for Python 3.6
This is a simpler version of @Kriechi's patch.
2016-12-27 19:09:56 +01:00
Thomas Kriechbaumer
51d57cfd4a py36: fix type information 2016-12-27 16:28:12 +01:00
Thomas Kriechbaumer
0bde932b78 run tests on Python 3.6 2016-12-27 16:28:12 +01:00
Maximilian Hils
38198769eb pyinstaller: use fixed bootloaders on linux 2016-12-27 03:09:43 +01:00
Thomas Kriechbaumer
cc9e70e3cc enable HTTP/2 by default 2016-12-26 21:51:10 +01:00
Maximilian Hils
2735338815 update windows dev script 2016-12-26 19:55:18 +01:00
Maximilian Hils
4b1224e592 add mitmweb explanation to introduction 2016-12-26 18:33:58 +01:00
Aldo Cortesi
cd6a4afc05 Bump changelog timestamp 2016-12-26 11:53:27 +13:00
Aldo Cortesi
37c97eeca5 Merge pull request #1865 from cortesi/admin
Release administrivia: changelog stub, contributors, bump to v1.0
2016-12-24 17:24:07 +13:00
Aldo Cortesi
5167d59d63 Merge branch 'master' into admin 2016-12-24 11:20:12 +13:00
Maximilian Hils
9f1cbe8746 add mitmweb and Windows compat to changelog 2016-12-22 02:55:07 +01:00
Thomas Kriechbaumer
24751965f9 remove output of dumper during tests 2016-12-21 23:22:14 +01:00
Thomas Kriechbaumer
a196493a7a remove output of webmaster during tests 2016-12-21 23:13:53 +01:00
Thomas Kriechbaumer
7a14a8cee5 Update CHANGELOG
update changelog
2016-12-21 22:50:53 +01:00
Maximilian Hils
0c18f7ec9e Update CHANGELOG 2016-12-21 22:47:17 +01:00
Thomas Kriechbaumer
42e9448ade reflow docs 2016-12-21 22:27:51 +01:00
Thomas Kriechbaumer
8fcf08b30f Merge pull request #1882 from mhils/docs
Docs: Add mitmweb, restructure installation
2016-12-21 22:24:16 +01:00
Thomas Kriechbaumer
7f33771b21 Merge pull request #1881 from mhils/fix-alpn-bytes
Always Decode ALPN Where Required
2016-12-20 21:27:23 +01:00
Maximilian Hils
18f2009074 update installation page
We emphasize the binary installation because that is usually the simplest
method to install mitmproxy on all major platforms.
2016-12-20 17:37:20 +01:00
Maximilian Hils
7de3507f9a docs: add mitmweb stub 2016-12-20 17:37:12 +01:00
Maximilian Hils
f997b7fe14 always decode alpn where required 2016-12-20 16:49:38 +01:00
Maximilian Hils
77cd9224f9 Merge pull request #1880 from mhils/1877
Fix #1877
2016-12-19 19:04:45 +01:00
Maximilian Hils
fc5783c20e Merge branch 'rename-log-example' 2016-12-19 16:21:29 +01:00
Maximilian Hils
98a079aa69 rename logging.py example. this conflicted with Python's stdlib 2016-12-19 16:21:17 +01:00
Maximilian Hils
4f3b50e417 fix io compat with previous releases 2016-12-19 16:19:37 +01:00
Maximilian Hils
fbce37054f fix #1877 2016-12-19 16:10:41 +01:00
Maximilian Hils
cbc0d3fd41 Merge pull request #1876 from mhils/1858
fix #1858
2016-12-19 15:19:02 +01:00
Maximilian Hils
c4e9000021 fix #1858 2016-12-19 01:15:10 +01:00
Thomas Kriechbaumer
504c289ad0 Merge pull request #1875 from Kriechi/dont-log-tracebacks
don't log full tracebacks
2016-12-17 22:53:05 +01:00
Maximilian Hils
975d1b87a3 fix #1867 (#1873) 2016-12-17 18:59:50 +01:00
Thomas Kriechbaumer
ea62521f03 Merge pull request #1874 from Kriechi/bump-h2
bump h2
2016-12-17 18:49:29 +01:00
Thomas Kriechbaumer
5cfc728d2e don't log full tracebacks 2016-12-17 18:28:34 +01:00
Thomas Kriechbaumer
c50feb6a40 bump h2
This takes care of https://github.com/python-hyper/hyper-h2/issues/422
2016-12-17 18:12:16 +01:00
Maximilian Hils
d4298cd747 Merge pull request #1871 from Kriechi/http2-gui
display ALPN information
2016-12-17 18:11:36 +01:00
Thomas Kriechbaumer
ffcf060928 display ALPN information 2016-12-17 17:40:11 +01:00
Thomas Kriechbaumer
07671440ba Merge pull request #1872 from mhils/appveyor
appveyor: don't build installer for PRs
2016-12-17 17:25:24 +01:00
Maximilian Hils
377be68cac appveyor: don't build installer for PRs 2016-12-17 16:01:44 +01:00
Thomas Kriechbaumer
39a251a988 Merge pull request #1870 from Kriechi/http2-timeouts
http2: faster timeouts
2016-12-17 10:45:34 +01:00
Thomas Kriechbaumer
3eac72f1a3 http2: faster timeouts 2016-12-17 10:34:53 +01:00
Aldo Cortesi
85e0e5da4c Compat 0.19 -> 1.0
0.19 was never released, but let's include a conversion for it anyway, since it
was the master version.
2016-12-17 11:01:40 +13:00
Aldo Cortesi
aa90fd359d Administrivia: docs for new config file, minor adjustments
For now, the config file docs basically say "it's YAML, read the source". We
should do better for the next release.
2016-12-17 10:57:13 +13:00
Aldo Cortesi
2fe7cf448d Release administrivia: changelog stub, contributors, bump to v1.0 2016-12-17 10:35:13 +13:00
Aldo Cortesi
fc724b6641 Merge pull request #1864 from cortesi/tdocs
Addon test docs, remove stray deprecated events
2016-12-17 10:29:27 +13:00
Aldo Cortesi
007aeef770 Addon test docs, remove stray deprecated events
Fixes #1572
2016-12-17 10:03:35 +13:00
Aldo Cortesi
c4929bbc19 Merge pull request #1863 from Kriechi/disable-h2c
disable h2c upgrades
2016-12-17 09:19:48 +13:00
Aldo Cortesi
cf15a3c3ef Merge pull request #1862 from mhils/remove-intercept-events
Remove intercept events, update view manually
2016-12-17 09:15:11 +13:00
Thomas Kriechbaumer
39a8d4dc22 disable h2c upgrades 2016-12-16 11:29:07 +01:00
Maximilian Hils
388fa7e716 remove intercept events, update view manually 2016-12-16 05:43:38 +01:00
Aldo Cortesi
6695ce4624 Merge pull request #1861 from cortesi/marking
console: mark view indiciator, fix empty flow list behaviour
2016-12-16 17:26:19 +13:00
Maximilian Hils
e769b1fa9a Merge pull request #1860 from cortesi/smokey
Catch occasional protocol errors in regular connect
2016-12-16 00:16:34 +01:00
Aldo Cortesi
e387c68b38 console: mark view indiciator, fix empty flow list behaviour
Fixes #1782
2016-12-16 11:57:45 +13:00
Aldo Cortesi
61e552553c Catch occasional protocol errors in regular connect
Fixes #1843 and #1847
2016-12-16 10:54:36 +13:00
Aldo Cortesi
6b5673e849 Merge pull request #1845 from mhils/mitmweb-improvements
Mitmweb Improvements
2016-12-16 10:04:12 +13:00
Thomas Kriechbaumer
78c78ce651 Merge pull request #1857 from mitmproxy/bump-cryptography
update dependencies
2016-12-14 19:38:53 +01:00
Maximilian Hils
1d846709c6 update dependencies 2016-12-14 18:19:49 +01:00
Maximilian Hils
727abdba44 Merge pull request #1852 from mhils/simplenamespace
Use types.SimpleNamespace instead of custom NS class
2016-12-13 15:06:14 +01:00
Maximilian Hils
e2c6d7ed0f Merge pull request #1851 from mhils/1850
fix #1850
2016-12-13 14:41:04 +01:00
Maximilian Hils
44f94c8844 use types.SimpleNamespace instead of custom NS class 2016-12-13 14:23:21 +01:00
Maximilian Hils
e5b3c8bed3 fix #1850 2016-12-13 14:12:18 +01:00
Doug Freed
b39380b00f console: respect follow in eventlog
Also make it possible to toggle the option when the eventlog window has focus.
2016-12-12 15:41:31 +01:00
Doug Freed
48b6964552 console: increase eventlog size limit to 10000 2016-12-12 15:41:31 +01:00
Aldo Cortesi
5cf268b012 Merge pull request #1842 from cortesi/optsave
Save options to file from console & related work
2016-12-12 12:53:26 +13:00
Aldo Cortesi
5e2a80fba1 Minor fixes 2016-12-12 12:18:33 +13:00
Maximilian Hils
d854e08653 [web] various fixes 2016-12-12 00:08:29 +01:00
Aldo Cortesi
a4ac5b158f Merge branch 'master' into optsave 2016-12-12 11:13:32 +13:00
Maximilian Hils
980a84326b InstallBuilder (#1826) 2016-12-11 23:07:47 +01:00
Aldo Cortesi
6dcd620c4a Merge pull request #1838 from mhils/http2-is-difficult
Disable HTTP/2 by default, add explicit on/off switches
2016-12-12 09:17:06 +13:00
Aldo Cortesi
a99bf0814c console: clean path prompt handling
- Don't trigger callback if no path is specified
- Expand userdir centrally
- Catch IO errors from callbacks and turn them into status messages
2016-12-12 09:13:43 +13:00
Maximilian Hils
a7d7ad2880 Merge pull request #1837 from mhils/1809
Fix #1809
2016-12-11 21:13:20 +01:00
Maximilian Hils
d1c7b203f0 [web] style flow menu 2016-12-11 19:59:54 +01:00
Aldo Cortesi
f8032bf85a Replacements and SetHeaders are both defined as text in Options
Bytes don't play well with our config serialization or command-line args.
2016-12-12 07:39:59 +13:00
Aldo Cortesi
ca33bea296 Extend type checker validate Sequence specs 2016-12-12 07:39:59 +13:00
Aldo Cortesi
c5717b17df console: add saving of config file 2016-12-12 07:39:59 +13:00
Maximilian Hils
6540aedaab [web] style start menu 2016-12-11 18:49:28 +01:00
Maximilian Hils
f16aab963e Merge pull request #1841 from mitmproxy/fix-docs-tests
pin docutils version to fix docs tests
2016-12-11 18:15:00 +01:00
Maximilian Hils
00ae4d3f6e fix version sourcing in setup.py 2016-12-11 17:50:46 +01:00
Maximilian Hils
8f04225450 fix install.rst 2016-12-11 17:49:07 +01:00
Maximilian Hils
795e76eee2 [web] style options menu
The other menus are WIP.
2016-12-11 17:37:11 +01:00
Maximilian Hils
b92980efec [web] show proxy address, add websocket toggle 2016-12-11 15:26:49 +01:00
Maximilian Hils
21eeaebc6b pin docutils version to fix docs tests 2016-12-11 14:54:12 +01:00
Maximilian Hils
b62b92eabe Merge pull request #1840 from mhils/1829
fix #1829
2016-12-11 14:50:20 +01:00
Maximilian Hils
610433f204 Merge pull request #1839 from mhils/1830
fix #1830
2016-12-11 14:50:13 +01:00
Maximilian Hils
bdba885922 fix #1829 2016-12-11 13:22:26 +01:00
Maximilian Hils
265ab7bf26 fix #1830 2016-12-11 13:11:02 +01:00
Maximilian Hils
4023327087 Merge pull request #1836 from Kriechi/wipeout-lxml
docs: update installation
2016-12-11 13:03:24 +01:00
Thomas Kriechbaumer
81b5788dfc docs: update installation 2016-12-11 11:14:00 +01:00
Maximilian Hils
9139d55293 Merge pull request #1835 from Kriechi/bump
bump dependencies
2016-12-11 00:31:35 +01:00
Maximilian Hils
b24d9654a9 disable http2 by default, add explicit on/off switches
As long as major HTTP/2 implementers fail to implement the spec correctly,
we need to disable HTTP/2 by default. We expect this to be fixed with
the next release and re-enabled by default.

https://github.com/mitmproxy/mitmproxy/issues/1745
https://github.com/mitmproxy/mitmproxy/issues/1824
2016-12-11 00:29:35 +01:00
Maximilian Hils
782c66eac2 fix #1809 2016-12-10 21:36:31 +01:00
Thomas Kriechbaumer
036130868d bump dependencies 2016-12-10 19:37:06 +01:00
Aldo Cortesi
8112bce424 Merge pull request #1831 from mhils/contentviews
Split contentviews.py into mitmproxy.contentviews
2016-12-11 07:33:27 +13:00
Maximilian Hils
b4a1bb44d9 minor fixes 2016-12-10 17:18:21 +01:00
Maximilian Hils
8df61c927e Merge pull request #1834 from Kriechi/remove_ssl_match_hostname
remove backport.ssl_match_hostname
2016-12-10 17:03:18 +01:00
Thomas Kriechbaumer
7bae941ecc remove backport.ssl_match_hostname
This is already included in Python 3.5+
2016-12-10 14:29:51 +01:00
Maximilian Hils
3e37cbd061 minor fixes 2016-12-10 12:06:33 +01:00
Maximilian Hils
123ef043dc add new xml/html pretty-printer 🎉 2016-12-10 11:40:07 +01:00
Maximilian Hils
293b79af91 remove lxml-dependent code 2016-12-10 10:19:05 +01:00
Maximilian Hils
a7ba2f7b46 update tests, increase coverage, add type info 2016-12-09 21:26:02 +01:00
Maximilian Hils
f53f079f91 split contentviews.py into mitmproxy.contentviews 2016-12-09 19:02:55 +01:00
Maximilian Hils
d1c72574d5 Merge pull request #1827 from mhils/issue-1803
Fix #1803
2016-12-09 18:32:58 +01:00
Maximilian Hils
f0e9e4bab9 fix #1803 2016-12-09 17:18:26 +01:00
Aldo Cortesi
6792cc1de9 Merge pull request #1823 from cortesi/options2
options: add a merge method to assimilate options
2016-12-08 19:23:02 +13:00
Aldo Cortesi
e943147fc3 options: add a merge method to assimilate options
Fixes #953
2016-12-08 16:12:40 +13:00
Aldo Cortesi
fdd1e23875 Merge pull request #1822 from cortesi/clog
console: use an addon to capture logs
2016-12-08 13:42:14 +13:00
Aldo Cortesi
67e9de5f7f console: use an addon to capture logs
Fix #1780
2016-12-08 10:47:45 +13:00
Aldo Cortesi
0a68613c8c Merge pull request #1806 from cortesi/options
Options
2016-12-08 10:45:23 +13:00
Aldo Cortesi
b2695dbc6a Minor tweaks 2016-12-08 10:21:06 +13:00
Aldo Cortesi
a617e3b5f7 Amalgamate all the Options objects 2016-12-08 10:21:06 +13:00
Aldo Cortesi
d742d4fb8c Replace configargparse with argparse, enable new options loading
This commit ditches configargparse and enables the new config file format. The
default location is ~/.mitmproxy/config.yaml. Unifying all of the various
Options objects will follow in the next patch.
2016-12-08 10:21:06 +13:00
Aldo Cortesi
6aacd27ab2 Add YAML serialization of options
This uses ruamel.yaml. The library seems well-supported, and can do in-place
modification of config files that retains user comments and file structure.
2016-12-08 10:21:06 +13:00
Aldo Cortesi
150372e297 options: defaults are a class attribute 2016-12-08 10:21:06 +13:00
Aldo Cortesi
2cb1f70381 Options - avoid mutation, API cleanup, has_changed
- Always return a deepcopy of options to avoid accidental mutation of options
state.
- Remove .get(opt, default). This is an inappropriate API for Options - trying
to retrieve an option that doesn't exist should always be an error.
- Add the has_changed method that checks if an option differs from the default,
use it in mitmproxy console.
2016-12-08 10:21:06 +13:00
Aldo Cortesi
00c897a185 options: save defaults, add .reset() to restore defaults
Use .reset() in console app to clear options.
2016-12-08 10:21:06 +13:00
Aldo Cortesi
d74cac265a Add YAML serialization of options
This uses ruamel.yaml. The library seems well-supported, and can do in-place
modification of config files that retains user comments and file structure.
2016-12-08 10:21:06 +13:00
Aldo Cortesi
c94cd512d1 options: defaults are a class attribute 2016-12-08 10:21:06 +13:00
Aldo Cortesi
3594faf5c4 Correct refresh_server_playback option default 2016-12-08 10:21:06 +13:00
Aldo Cortesi
c062e302e9 Add OptManager.subscribe, use it to clean up palettes in console
.subscribe lets you subscribe a function to a specified set of options.
2016-12-08 10:21:06 +13:00
Aldo Cortesi
0c091bd92b Options - avoid mutation, API cleanup, has_changed
- Always return a deepcopy of options to avoid accidental mutation of options
state.
- Remove .get(opt, default). This is an inappropriate API for Options - trying
to retrieve an option that doesn't exist should always be an error.
- Add the has_changed method that checks if an option differs from the default,
use it in mitmproxy console.
2016-12-08 10:21:06 +13:00
Aldo Cortesi
b231836c70 Get rid of tfile testing option
It's weird, it's ugly, it's getting in the way of my options refactoring, and
it must therefore die.
2016-12-08 10:21:05 +13:00
Aldo Cortesi
297493801d Clean up dump tests
- Remove tests that redundantly test addon funtionality that we've already
tested more comprehensively elsewhere.
- Extend to 100% coverage for tools/dump.py
2016-12-08 10:21:05 +13:00
Aldo Cortesi
b4d33aaebf options: save defaults, add .reset() to restore defaults
Use .reset() in console app to clear options.
2016-12-08 10:21:05 +13:00
Thomas Kriechbaumer
4771abf229 Merge pull request #1817 from Kriechi/fix-1816
tls_parser: allow optional extensions
2016-12-06 19:52:12 +01:00
Thomas Kriechbaumer
47196e8676 tls_parser: allow optional extensions
fixes #1816
2016-12-06 19:51:57 +01:00
Maximilian Hils
e44493bda5 Merge pull request #1810 from Kriechi/construct
upgrade to construct 2.8 and new API
2016-12-04 18:43:20 +01:00
Maximilian Hils
1fc1a17c61 Merge pull request #1813 from dwfreed/patch-1
release: fix dropping _main suffix
2016-12-04 18:43:02 +01:00
Doug Freed
306431f0b8 release: fix dropping _main suffix 2016-12-04 17:41:31 +00:00
Thomas Kriechbaumer
9697f5f656 Merge pull request #1801 from Kriechi/simplify-alpn-openssl
simplify ALPN and OpenSSL on macOS
2016-12-04 17:41:43 +01:00
Thomas Kriechbaumer
33689c6b2d upgrade to construct 2.8 and new API 2016-12-04 16:15:28 +01:00
Thomas Kriechbaumer
1a36efbb6a simplify ALPN and OpenSSL on macOS 2016-12-04 11:04:06 +01:00
Thomas Kriechbaumer
741c2b7b66 fix whitespace 2016-12-03 16:55:56 +01:00
Thomas Kriechbaumer
e9fa786fa9 fix indentation 2016-12-03 16:53:13 +01:00
Thomas Kriechbaumer
1fcf79fff0 fix ALPN usage 2016-12-02 11:58:20 +01:00
Maximilian Hils
d658783dec Merge pull request #1797 from Kriechi/websocket++
Pass Autobahn WebSocket Test Suite
2016-12-01 09:28:18 +01:00
Thomas Kriechbaumer
cc6aa1f542 websocket: update close handshake tests 2016-11-29 23:47:19 +01:00
Thomas Kriechbaumer
d2216801dd websocket: make flowfilter work 2016-11-29 23:01:55 +01:00
Thomas Kriechbaumer
ea6de424a3 websocket: carry over per-message compression bit 2016-11-29 22:32:55 +01:00
Thomas Kriechbaumer
073a286098 websocket: reduce connection timeout 2016-11-29 22:17:33 +01:00
Thomas Kriechbaumer
bd8ae910d2 websocket: fix message type on chunking 2016-11-29 22:13:59 +01:00
Thomas Kriechbaumer
6e15e766c5 websocket: fix close handshake and re-chunking 2016-11-29 22:01:41 +01:00
Thomas Kriechbaumer
5ee192b758 websocket: fix empty frame with fin=1 2016-11-29 21:00:42 +01:00
Maximilian Hils
34bf3a2496 fix #1783 (#1794) 2016-11-28 13:29:06 +01:00
Maximilian Hils
e64d2ce829 Merge pull request #1792 from Kriechi/mitmdump-filter-help
improve mitmdump filter help
2016-11-28 02:13:39 +01:00
Maximilian Hils
3154dc87fd fix pyinstaller
amongst other things, fix #1746
2016-11-28 00:51:52 +01:00
Thomas Kriechbaumer
b5daafb518 improve mitmdump filter help 2016-11-25 21:59:13 +01:00
Maximilian Hils
568f40c810 Fix transparent mode initialisation, refactor mitmproxy.platform (#1787) 2016-11-25 17:32:23 +01:00
Maximilian Hils
0386740404 mitmweb: include console logging 2016-11-25 17:20:14 +01:00
Maximilian Hils
1d3cb9eeb8 mitmweb: add --no-browser 2016-11-25 17:20:14 +01:00
Maximilian Hils
e3dc46a8cd fix pyinstaller (#1788) 2016-11-25 16:46:49 +01:00
Maximilian Hils
de9e724a66 update dependencies (#1789) 2016-11-25 16:46:00 +01:00
Maximilian Hils
222106916e Merge branch 'mitmweb-eventlog' 2016-11-23 22:47:50 +01:00
Maximilian Hils
d15ddfad14 fix contentview attributes 2016-11-23 22:47:36 +01:00
Maximilian Hils
5d209e5040 Merge commit '9bc5adf' 2016-11-23 22:45:21 +01:00
Maximilian Hils
45332006a3 mitmweb: 100% app test coverage, numerous fixes 2016-11-23 22:35:07 +01:00
Thomas Kriechbaumer
48d54e2d4a bump cryptography dependency 2016-11-23 11:55:11 +01:00
Thomas Kriechbaumer
9bc5adfb03 add more websocket indicators to mitmproxy and mitmdump 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
4b04566a34 add metadata info to flow detail view 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
ea97f62975 websocket: show messages in the eventlog 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
3353aa3cfd fix docs 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
d3bd04dec0 disable TCP support for now 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
5dfc199086 websocket: add tests 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
4beb693c9c websocket: change cmdline option 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
aaa4ccc284 websocket: add event documentation 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
3d8f3d4c23 add WebSocket flows and messages 2016-11-23 10:18:45 +01:00
Thomas Kriechbaumer
ffb3988dc9 rename WebSocket{s,} protocol 2016-11-23 10:18:45 +01:00
Maximilian Hils
dc75605e46 minor fixes 2016-11-23 01:27:52 +01:00
Maximilian Hils
f1662cbfd7 add eventstore tests 2016-11-23 01:27:51 +01:00
Maximilian Hils
72dcf70db2 mitmweb: fix event display 2016-11-23 01:27:51 +01:00
Maximilian Hils
fea6041cde mitmweb: cleanup, reimplement eventlog 2016-11-23 01:27:50 +01:00
Maximilian Hils
a6c608e085 make the new mypy release happy 2016-11-23 01:27:23 +01:00
Maximilian Hils
8ba5f40d76 Update README.md 2016-11-22 23:30:57 +01:00
Maximilian Hils
39b24a5bab Update README.md 2016-11-22 23:11:57 +01:00
Maximilian Hils
40f0193dda remove mitmweb auth
9b08279c7c removed the actual functionality.
we should not have a command line switch that does nothing. :)
2016-11-22 18:27:16 +01:00
Maximilian Hils
21a03d56b5 don't set an empty ALPN, refs #1772 2016-11-22 17:02:37 +01:00
Maximilian Hils
92516a3b5c Merge pull request #1769 from mhils/update-pydivert
update pydivert, fix #1749
2016-11-21 14:40:11 +01:00
Maximilian Hils
f644665cd9 update pydivert, fix #1749 2016-11-21 14:14:52 +01:00
Yoginski
ebff5f2466 Descriptive error message for SSL context initialization failure (#1767) 2016-11-21 09:40:09 +01:00
Maximilian Hils
c90405253a remove stickycookie example
The recommended way to do this is mitmproxy/addons/stickycookie.py
2016-11-21 02:46:25 +01:00
Maximilian Hils
2138be8705 Merge pull request #1768 from mhils/organize-examples
Organize Examples
2016-11-21 02:42:15 +01:00
Maximilian Hils
9af8f4bb31 organize examples
This commit is largely based on work by Thiago Arrais (@thiagoarrais)
and Shane Bradfield (@l33tLumberjack). I wasn't really able to get their
PR reasonably merged onto the latest master, so I reapplied their changes
manually here and did some further improvements on that.
2016-11-21 02:28:10 +01:00
Maximilian Hils
f74e561524 rewrite absolute-form HTTP requests to relative form, fix #1759 (#1765) 2016-11-20 17:21:21 +01:00
Thomas Kriechbaumer
79c753d8f8 Merge pull request #1766 from Kriechi/fix-test-race
tests: fix race condition
2016-11-20 17:02:49 +01:00
Thomas Kriechbaumer
f45034e8f1 tests: fix race condition 2016-11-20 17:02:26 +01:00
Edgar Boda-Majer
078f36d86a handle SIGINT with a quit prompt (#1760) 2016-11-20 16:40:04 +01:00
Thomas Kriechbaumer
b6e419d640 Merge pull request #1751 from dwfreed/patch-1
proxy/protocol/base: Allow spoofing fixed source
2016-11-19 23:00:36 +01:00
Thomas Kriechbaumer
3ea38e6aa4 Merge pull request #1757 from fotinakis/master
Remove dead run_scripthooks example reference.
2016-11-19 22:54:42 +01:00
Doug Freed
0ff1967226 proxy/protocol/base: Allow spoofing fixed source
Allow combining --spoof-source-address and --upstream-bind-address to
spoof a fixed source address.  Also update the help text for
--spoof-source-address to indicate this new possibility.
2016-11-18 14:46:32 +00:00
Thomas Kriechbaumer
d6cfd93357 Merge pull request #1753 from mitmproxy/update-dependencies
Update Dependencies
2016-11-18 13:02:58 +01:00
Maximilian Hils
5ce370e2a9 lint! 2016-11-18 12:59:59 +01:00
Maximilian Hils
e8067a2474 update dependencies 2016-11-18 12:59:59 +01:00
Mike Fotinakis
d16a3753d7 Remove dead run_scripthooks example reference. 2016-11-17 16:33:51 -08:00
Maximilian Hils
83fe8b5302 Merge pull request #1729 from mhils/mitmweb-fixes
minor fixes
2016-11-16 22:26:17 +01:00
Maximilian Hils
5601338a17 Merge pull request #1752 from dwfreed/patch-2
setup.py: adjust mypy-lang dependency for semver
2016-11-16 18:08:58 +01:00
Maximilian Hils
2ee8bc2f1a fix type checks 2016-11-16 17:19:38 +01:00
Maximilian Hils
de6bf175e2 mitmweb: start browser on startup 2016-11-16 15:09:54 +01:00
Maximilian Hils
677789a617 minor fixes 2016-11-16 15:09:53 +01:00
Doug Freed
6b6e64e09e setup.py: adjust mypy-lang dependency for semver
Looks like the previous form was a typo.
2016-11-16 13:54:10 +00:00
Maximilian Hils
47ec1c9570 Merge pull request #1742 from dwfreed/patch-2
Make the upstream bind address a separate option
2016-11-16 13:37:12 +01:00
Thomas Kriechbaumer
3d26bd4aa1 Merge pull request #1748 from Kriechi/better-onboarding
add macOS/OSX installation instructions to onboarding page
2016-11-16 13:04:07 +01:00
Thomas Kriechbaumer
d7a22d92ec add macOS/OSX installation instructions to onboarding page 2016-11-16 11:05:52 +01:00
Aldo Cortesi
92607c2109 Merge pull request #1743 from cortesi/viewsig
addons.view: clarify modification events
2016-11-15 10:42:23 +13:00
Aldo Cortesi
8065b44eed addons.view: clarify modification events
This adds a set of store modification events, and uses them for flow settings.
This addresses a bug where settings could persist even after flows were deleted.
2016-11-15 09:53:17 +13:00
Doug Freed
4cfda51c37 proxy/protocol/base: use upstream_bind_address
Use the upstream_bind_address option, instead of listen_host.
2016-11-14 12:12:48 +00:00
Doug Freed
f89671a33b tools/cmdline: add upstream bind address option
Allow specifying the upstream bind address on the command line.
2016-11-14 12:12:48 +00:00
Doug Freed
078bd532c3 options: add upstream_bind_address
Add upstream_bind_address to the options object
2016-11-14 12:12:48 +00:00
Aldo Cortesi
055a0b7198 Merge pull request #1740 from pquentin/master
docs: Fix typos
2016-11-14 19:02:03 +13:00
Quentin Pradet
eb7bcb37ec docs: Fix typos 2016-11-14 08:43:32 +04:00
Aldo Cortesi
2d0a65a3f4 Merge pull request #1738 from Kriechi/fix-1737
restrict ALPN offers if host changes
2016-11-14 08:50:29 +13:00
Aldo Cortesi
b636e4353a Merge pull request #1720 from cortesi/proxyrefactor
proxy.protocol.http-related refactoring
2016-11-14 08:03:10 +13:00
Thomas Kriechbaumer
6fb706ec15 restrict ALPN offers if host changes 2016-11-13 12:11:56 +01:00
Aldo Cortesi
9b08279c7c addons.proxyauth: out with the old, in with the new
- Strip out old auth mechanisms, and enable addon
- Disable web app auth for now - this should just use the Tornado auth stuff
2016-11-13 19:59:59 +13:00
Aldo Cortesi
dc88b7d110 addons.proxyauth: complete and test 2016-11-13 18:14:23 +13:00
Aldo Cortesi
e644d2167c stub out proxyauth addon
Stub out basic workings, add and test configure event.
2016-11-13 16:22:33 +13:00
Aldo Cortesi
fe01b1435a upstream_proxy_auth -> upstream_auth
Also clarify what this does in commandline help.
2016-11-13 11:50:28 +13:00
Aldo Cortesi
3b00bc339d Complete upstream authentication module
- Handles upstream CONNECT and regular requests, plus HTTP Basic for reverse
proxy
- Add some tests to make sure we can rely on the .via attribute on server
connections.
2016-11-13 11:43:27 +13:00
Aldo Cortesi
a9b4560187 Refine handling of HTTP CONNECT
- CONNECT requests do not generate the usual http events. Instead, they
generate the http_connect event and handlers then have the option of setting an
error response to abort the connect.
- The connect handler is called for both upstream proxy and regular proxy CONNECTs.
2016-11-12 18:28:37 +13:00
Aldo Cortesi
38f8d9e541 Add the http_connect event for HTTP CONNECT requests 2016-11-12 12:44:43 +13:00
Aldo Cortesi
bc01a146b0 Upstream proxy auth to addon 2016-11-12 11:58:04 +13:00
Aldo Cortesi
00492919e7 Add HTTPFlow.mode to record the HTTP proxy layer mode 2016-11-12 11:58:04 +13:00
Aldo Cortesi
5be35d258f Use an enum for http protocol modes 2016-11-12 11:58:04 +13:00
Aldo Cortesi
fbaade4298 Remove promotion to raw TCP based on heuristics
This seems terribly dangerous to me. Let's expand explicit control instead.
2016-11-12 11:58:04 +13:00
Aldo Cortesi
3958940420 Test failure during 100-continue
Also:

- Remove duplicate and unused code
- Tighten scope of HttpReadDisconnect handler - we only want to ignore this for
the initial read, not for the entire block that includes things like the expect
handling.
2016-11-12 11:58:04 +13:00
Aldo Cortesi
82ac7d05a6 Bug: ask requestheaders before request body is read
Also add the beginnings of a test suite to exercise issues like this.
2016-11-12 11:58:04 +13:00
Aldo Cortesi
53b77fc475 proxy.protocol.http: cleanups, extract request validation 2016-11-12 11:58:04 +13:00
Aldo Cortesi
4eea265925 Remove unused protocol attribute on connections. 2016-11-12 11:58:04 +13:00
Aldo Cortesi
a653f314ff proxy.protocol.http: flatten for refactoring
Flatten all of _process_flow, so we can see what's going on in there.
2016-11-12 11:58:04 +13:00
Maximilian Hils
afa124a9f6 Merge pull request #1723 from Kriechi/http2-conns
http2: move h2 connection object
2016-11-09 15:19:55 +01:00
Maximilian Hils
f0783a0874 Merge pull request #1725 from mhils/mitmweb
Mitmweb Improvements
2016-11-09 15:19:14 +01:00
Maximilian Hils
564e56c262 Merge pull request #1724 from phackt/master
fix SNI for transparent mode - #1638
2016-11-09 13:25:37 +01:00
Maximilian Hils
2a2387fb32 explain host=pretty_host assignment 2016-11-09 13:11:31 +01:00
Maximilian Hils
77f05178ad mitmweb: minor fixes 2016-11-09 13:01:25 +01:00
Maximilian Hils
a0ddedff6f web: update static assets 2016-11-09 10:09:00 +01:00
Maximilian Hils
d9597add76 web: fix header update 2016-11-09 10:04:51 +01:00
Maximilian Hils
c2a130dced web: simplify flow storage 2016-11-08 17:55:22 +01:00
Maximilian Hils
85476d9915 clean up mitmweb 2016-11-08 17:54:27 +01:00
Maximilian Hils
62ca896492 fix mitmweb 2016-11-08 17:43:46 +01:00
phackt
dc44465c92 fix SNI for transparent mode - #1638
In transparent mode host is set with the target server ip.
Attribute flow.request.host is used as SNI while mitmproxy is
initiating TLS handshake, so it should be set with the pretty_host.
2016-11-08 15:39:24 +01:00
Thomas Kriechbaumer
f140b1d84f http2: move h2 connection object 2016-11-05 20:39:42 +01:00
Thomas Kriechbaumer
184e29e119 http2: add push-promise metadata test 2016-11-05 05:13:36 +01:00
Aldo Cortesi
d4071d3337 Merge pull request #1716 from cortesi/deprecated2
Remove sticky[auth,cookie] from http objects
2016-11-04 16:00:50 +13:00
Aldo Cortesi
4b5ed2c84e Merge pull request #1715 from cortesi/deprecated
Remove deprecated interfaces
2016-11-04 14:58:05 +13:00
Aldo Cortesi
86b7661456 Remove sticky[auth,cookie] from http objects
- they're unused
- if we want them, they should be set by the addon in the new metadata store
2016-11-04 11:50:19 +13:00
Aldo Cortesi
067198a5dd Remove deprecated interfaces 2016-11-04 11:47:47 +13:00
Aldo Cortesi
fd56a7b3ad Merge pull request #1714 from cortesi/justno2
Test and interface improvements
2016-11-04 11:35:10 +13:00
Aldo Cortesi
4eb2b56dec Let's not over-ride __bool__ on connection objects
If I had a thousand years and every thesaurus in the world, I still couldn't
adequately express how much I dislike this piece of interface design.
2016-11-04 10:59:41 +13:00
Aldo Cortesi
6c8c4465d9 script.concurrent: tests to taddons 2016-11-04 10:59:41 +13:00
Aldo Cortesi
c2c44889bb Merge pull request #1711 from navinpai/1541
Allow pathoc to pause forever at end of message
2016-11-04 10:59:18 +13:00
Aldo Cortesi
8d9fdc416a Merge pull request #1712 from navinpai/docs
[MINOR] fix link in documentation
2016-11-04 10:57:28 +13:00
Naveen Pai
a43e2047b0 [MINOR] fix link in documentation 2016-11-04 03:04:55 +05:30
Naveen Pai
eef97555d7 Allow forever wait at end of message #1541 2016-11-04 02:12:20 +05:30
Aldo Cortesi
d51b8933b2 Merge pull request #1709 from cortesi/taddons4
addons.view: test suite to 100%
2016-11-04 09:33:48 +13:00
Aldo Cortesi
4f4db223fe addons: convert last of the test suite to taddons 2016-11-04 09:17:56 +13:00
Aldo Cortesi
deb66d3cac addons.setheaders: fix configure bug, tests to taddons 2016-11-04 09:09:39 +13:00
Aldo Cortesi
b51a96081a addons.view: test suite to 100%
This takes coverage for all of /addons to 100%
2016-11-04 08:55:01 +13:00
Aldo Cortesi
19e6af857d Merge pull request #1708 from cortesi/taddons3
Test suite improvements
2016-11-04 07:59:23 +13:00
Aldo Cortesi
17e828b243 addons.view: test improvements 2016-11-03 20:53:06 +13:00
Aldo Cortesi
c59b34bbb7 README.rst: recommend "tox -e lint" over using flake8 directly 2016-11-03 20:51:22 +13:00
Aldo Cortesi
e300f24bdc Merge pull request #1707 from cortesi/taddons2
Addon test suite improvements
2016-11-03 20:16:26 +13:00
Aldo Cortesi
5ade93f2ad addons.streambodies: 100% test coverage 2016-11-03 20:16:07 +13:00
Aldo Cortesi
d7d6edb3d1 addons.serverplayback: 100% test coverage 2016-11-03 20:05:21 +13:00
Aldo Cortesi
e1fc80937d addons.serverplayback: test suite to taddons 2016-11-03 19:43:33 +13:00
Aldo Cortesi
e9a96f4d7f addons.script: 100% test coverage 2016-11-03 19:36:34 +13:00
Aldo Cortesi
d9538637c3 addons.script: convert to test.taddons 2016-11-03 18:57:34 +13:00
Aldo Cortesi
50d393960c Merge pull request #1706 from cortesi/taddons
addons tests and bugfixes
2016-11-03 16:33:25 +13:00
Aldo Cortesi
d31f2698a5 addons.onboarding: remove duplicate code 2016-11-03 16:20:38 +13:00
Aldo Cortesi
9fc6674151 addons.intercept: 100% test coverage 2016-11-03 16:16:29 +13:00
Aldo Cortesi
77e6dfe35c streamfile: make options less crazy
Instead of a (file, mode) tuple, move to "streamfile" as the path, and
"streamfile_append" to specify if we should append or not.

Leave the command-line options intact for now.
2016-11-03 15:18:55 +13:00
Aldo Cortesi
9f77c79227 FileStreamer -> StreamFile
options.wfile -> options.streamfile
2016-11-03 15:00:18 +13:00
Aldo Cortesi
43a8221989 addons: filestreamer test cov to 100%
Also address a bug in taddons that caused options changes that raised errors to
be retained rather than rolled back.
2016-11-03 14:50:23 +13:00
Aldo Cortesi
fbdce4b629 addons filstreamer: tests and bugfixes
- Move tests to taddons
- Fix a bug where options updates caused streaming to halt
2016-11-03 12:44:19 +13:00
Aldo Cortesi
e1cea56379 Merge pull request #1705 from cortesi/tests
Fix Travis cipher-suite related breakage
2016-11-03 10:33:51 +13:00
Aldo Cortesi
5109fd8ecb Change antiquated test cipher suites
This breaks Travis, possibly due to OpenSSL version.
2016-11-03 08:23:19 +13:00
Aldo Cortesi
d4f4beb6c7 tests: add mitmdump --sysinfo to tests runs for platform info 2016-11-03 07:57:25 +13:00
Aldo Cortesi
356cf0f36e Merge pull request #1704 from cortesi/addontest4
addons: dumper spit and polish
2016-11-03 07:40:30 +13:00
Aldo Cortesi
b867fb35a3 addons: dumper spit and polish
- 100% test coverage
- Cleanups
- Add test/mitmproxy/addons/dumperview.py, a small utility for viewing dumper
output variations
2016-11-02 22:47:49 +13:00
Aldo Cortesi
93fd7a8265 Merge pull request #1702 from cortesi/addontest3
tests: convert test_dumper to use taddons
2016-11-02 11:32:45 +13:00
Aldo Cortesi
a75b3474a4 tests: convert test_dumper to use taddons 2016-11-02 11:17:08 +13:00
Aldo Cortesi
490872ebef Merge pull request #1701 from cortesi/addontest2
Test suite cleanups
2016-11-02 11:15:27 +13:00
Aldo Cortesi
59b269425f tests: client_playback coverage 2016-11-02 10:59:33 +13:00
Aldo Cortesi
ee67797c7e test coverage: complete branch coverage is NOT a goal
Branch coverage means lots of duplication in tests to hit all cases, and I'm
not sure it's worth it. At any rate, let's aim for statement coverage first.
2016-11-02 10:54:08 +13:00
Aldo Cortesi
7e6d014f8f tests: pathod/tutils.py -> pathod/tservers.py
And remove all aliases for mitmproxy.test.tutils
2016-11-02 10:06:25 +13:00
Aldo Cortesi
c55e8d8f62 tests: clean up test/mitmproxy/tutils.py
Remove aliases, use mitmproxy/test/tutils instead.
2016-11-02 09:44:18 +13:00
Aldo Cortesi
fc7606bd98 tests: minor cleanup for tests/mitmproxy/tutils.py 2016-11-02 08:51:26 +13:00
Aldo Cortesi
ba09b8bff3 Merge pull request #1700 from cortesi/addontests
addons anticom, anticache: expand tests, new truss
2016-11-01 17:57:16 +13:00
Aldo Cortesi
83fdd82a52 addons anticom, anticache: expand tests, new truss 2016-11-01 17:38:45 +13:00
Aldo Cortesi
1cc2195f45 Merge pull request #1698 from vhaupert/master
Wsgiapp: Only raise exception if an error occurred.
2016-11-01 12:02:01 +13:00
Aldo Cortesi
c7f6376828 Merge pull request #1697 from xorrbit/patch-1
Update for Ubuntu 16.04
2016-11-01 12:00:54 +13:00
Vincent Haupert
f9add49833 Only raise exception if an error occurred. 2016-10-31 23:53:11 +01:00
Aldo Cortesi
def0127cdd Merge pull request #1696 from cortesi/rmstate
Remove addons.State entirely
2016-11-01 11:30:07 +13:00
Andrew Orr
bff75f4ff6 Update for Ubuntu 16.04 2016-10-31 17:11:51 -05:00
Aldo Cortesi
c33557a230 Extend mypy checks to mitmproxy/addons
Fix a number of issues to do this.
2016-11-01 10:38:35 +13:00
Aldo Cortesi
2c85b262d5 Merge pull request #1695 from cortesi/term
console: Minor cleanups
2016-11-01 10:09:36 +13:00
Aldo Cortesi
50deaf56bf Remove addons.State
- Do a first-pass port of mitmweb. Some stuff still broken.
- Remove more all State tests from the test suite
2016-11-01 10:06:28 +13:00
Aldo Cortesi
9d9735dd07 Replace addons.state in test suite
Use a super-simple flow recorder instead.
2016-11-01 09:36:24 +13:00
Aldo Cortesi
ecffaab862 console: Minor cleanups 2016-11-01 09:25:32 +13:00
Aldo Cortesi
0aed002ad8 Merge pull request #1694 from cortesi/cachekey
console: add caching sort keys
2016-10-30 22:10:10 +13:00
Aldo Cortesi
daf355bb4c console: add caching sort keys
This is a tad complicated. The underlying sorted list implementation expects
the sort key to be stable for the lifetime of the object. However, if we sort
by size, for instance, the sort order changes as the flow progresses through
its lifecycle. We address this through two means:

- Let order keys cache the sort value by flow ID.
- Add a facility to refresh items in the list by removing and re-adding them
when they are updated.
2016-10-30 21:11:30 +13:00
Aldo Cortesi
9abfb1aac2 console: re-add follow focus 2016-10-30 19:47:32 +13:00
Aldo Cortesi
be6ce4f22b Merge pull request #1693 from cortesi/statusbar
console: status bar improvements
2016-10-30 18:48:03 +13:00
Aldo Cortesi
9322167eeb console: show order option in status bar 2016-10-30 18:33:51 +13:00
Aldo Cortesi
5975cc8301 console: status bar improvements
- Arrow to show flow order
- Hook statusbar up to focus change to fix some update issues
2016-10-30 18:25:33 +13:00
Aldo Cortesi
f168379c2a Merge pull request #1692 from cortesi/floworder
console: o for flow order
2016-10-30 18:10:04 +13:00
Aldo Cortesi
f08b57fb9b console: "v" to reverse flow order 2016-10-30 17:57:43 +13:00
Aldo Cortesi
a67a591893 console: o for flow order
"o" shortcut and --order cmdline option to change flow order.

Options is now bound to "O".
2016-10-30 17:42:34 +13:00
Aldo Cortesi
897d5ddc87 Merge pull request #1691 from cortesi/consoleclean1
console: various cleanups
2016-10-30 17:21:12 +13:00
Aldo Cortesi
7a6bae336b addons.view: fix tests 2016-10-30 17:03:06 +13:00
Aldo Cortesi
0b2a2ad2a6 docs: examples/logging -> examples/context_logging 2016-10-30 16:58:50 +13:00
Aldo Cortesi
a43cce504a console: various cleanups 2016-10-30 16:58:19 +13:00
Aldo Cortesi
b229d470c4 Merge pull request #1690 from cortesi/consoleview
console: Port from state to view
2016-10-30 16:27:12 +13:00
Aldo Cortesi
62ead34a94 mitmproxy.console: Complete port to view. 2016-10-30 16:15:33 +13:00
Aldo Cortesi
6b6c44551a addons.view: Add first-class support for marking
Marking now works differently - it's no longer just another filter, it's
applied in addition to the filter. This means you can apply a filter, mark some
flows, and then toggle between marked and unmarked flows matching the filter.

I'm leaving the filter for marked flows intact - it will come in handy in other
situations.
2016-10-30 15:45:36 +13:00
Aldo Cortesi
2b76db1272 console: Port from state to view
First phase of the port - basic flow list and flow view functionality working.
More to come.
2016-10-30 14:56:36 +13:00
Aldo Cortesi
83b56527d9 Merge pull request #1689 from cortesi/contentoption
Add options.default_contentview
2016-10-30 13:28:47 +13:00
Aldo Cortesi
a5857ec97a Merge pull request #1688 from cortesi/intercept
Intercept addon & nicer addon testing truss
2016-10-30 12:15:53 +13:00
Aldo Cortesi
b9eb1a3479 Add options.default_contentview
This is the first step in a longer process of revamping content views. For the
moment, the option is not exposed on the command line.
2016-10-30 12:05:37 +13:00
Aldo Cortesi
944dcbaaa0 Cleanups: remove intercept from addons.state, unused imports 2016-10-30 11:13:05 +13:00
Aldo Cortesi
81a00f6f76 Replace interception in mitmproxy and mitmweb with addon
Fixes #1674
2016-10-30 11:07:09 +13:00
Aldo Cortesi
d1f14961ed test.taddon: Add cycle() method, use it to test addons.intercept 2016-10-30 10:52:57 +13:00
Aldo Cortesi
b4904d33ba Move test flow creators to mitmproxy.test.tflow 2016-10-30 10:12:39 +13:00
Thomas Kriechbaumer
d56bbb95e2 rename logging .py to prevent import errors 2016-10-29 11:31:38 -07:00
Aldo Cortesi
2dc3284fbb Add addons.intercept
- Add an addon to handle intercept based on a filter pattern
- Start sketching out a nicer testing truss for addons in mitmproxy.test.taddon
2016-10-29 15:44:48 +13:00
Aldo Cortesi
71d2636594 Sync 2016-10-29 12:35:10 +13:00
Aldo Cortesi
a3131ac343 Merge pull request #1683 from cortesi/view
addons.View
2016-10-29 12:19:19 +13:00
Aldo Cortesi
005c22445b addons.view: focus.focusflow -> focus.flow 2016-10-29 11:55:44 +13:00
Aldo Cortesi
7ecaeb0214 addons.view.focus: next and prev methods 2016-10-29 11:50:10 +13:00
Aldo Cortesi
32a0a7b860 addons.view: flow settings
Add a flow settings mechanism, enable focus and settings unilaterally.
2016-10-29 11:37:32 +13:00
Aldo Cortesi
14df969434 addons.view.focus: Better handling of view refresh
When we refresh and our current focus goes out of scope, we set the focus to
the element nearest the old focus.
2016-10-29 11:08:35 +13:00
Aldo Cortesi
90e7142b5c addons.View: better order reversal
Deal with some subtleties in order reversal, add a toggle method that emits
refresh.
2016-10-29 10:55:57 +13:00
Aldo Cortesi
12a70d03ad addons.view: Add a focus tracker 2016-10-29 10:17:29 +13:00
Aldo Cortesi
9dcc3a3e20 addons.View: hook up signals 2016-10-29 08:25:19 +13:00
Aldo Cortesi
69bacee1d8 Sketch out addons.View
The first iteration of a replacement for addons.State
2016-10-29 08:25:19 +13:00
Aldo Cortesi
9be34baa40 Merge pull request #1687 from Kriechi/http2-type-information
http2: add more type information
2016-10-29 08:12:41 +13:00
Aldo Cortesi
715070a857 Merge pull request #1686 from Kriechi/http2-push-indicator
http2: add an indicator for pushed streams
2016-10-29 08:10:41 +13:00
Thomas Kriechbaumer
d86cb76e5b http2: add push indicator 2016-10-27 20:33:30 -07:00
Thomas Kriechbaumer
f1878eb051 http2: add more type information 2016-10-27 20:24:57 -07:00
Maximilian Hils
11d266419c Merge pull request #1685 from mhils/travis
fix travis
2016-10-27 16:44:32 -07:00
Maximilian Hils
e71b634c58 Merge pull request #1684 from mhils/1675
Fix #1675
2016-10-27 16:22:37 -07:00
Maximilian Hils
c83816ca28 fix travis 2016-10-27 16:21:31 -07:00
Maximilian Hils
4ac4fe2849 Merge pull request #1671 from mitmproxy/bump-h2
Bump h2 version
2016-10-27 16:13:30 -07:00
Maximilian Hils
62c9c3db4f fix #1675 2016-10-27 16:12:18 -07:00
Maximilian Hils
2a901b90c5 Merge pull request #1681 from mhils/issue-1676
Fix #1676
2016-10-27 15:13:32 -07:00
Thomas Kriechbaumer
44ac370f08 upgrade h2 to >=2.5.0 2016-10-27 15:10:53 -07:00
Maximilian Hils
48f51849b9 fix #1676 2016-10-27 13:10:57 -07:00
Maximilian Hils
f26a375560 fix #1678 2016-10-27 12:55:39 -07:00
Maximilian Hils
33bc526b70 bump h2 version 2016-10-27 12:48:10 -07:00
Maximilian Hils
a93baad655 Merge pull request #1680 from mhils/remove-lrucache
Remove mitmproxy.utils.lrucache
2016-10-27 11:45:35 -07:00
Maximilian Hils
4ab654748a fix pyinstaller builds 2016-10-27 11:45:03 -07:00
Maximilian Hils
97f1236c99 Merge pull request #1670 from chhsiao90/display-cipher-#582
Resolved #582: display ClientConnection select cipher of TLS
2016-10-27 11:38:22 -07:00
Maximilian Hils
6b4c705197 remove mitmproxy.utils.lrucache 2016-10-27 11:24:36 -07:00
Aldo Cortesi
2cc4e92108 Merge pull request #1677 from cortesi/mypy
Add mypy to lint
2016-10-27 11:00:18 +13:00
Aldo Cortesi
d6bdb28865 Add mypy to lint
An extremely modest beginning, but we'll roll this out over the whole codebase
in time.

Also move flake8 and mypy dependencies into setup[dev].
2016-10-27 09:40:27 +13:00
Aldo Cortesi
72ac572226 Merge pull request #1673 from mhils/issue-1620
fix #1620
2016-10-27 08:26:48 +13:00
Maximilian Hils
d096b36068 fix pyinstaller builds 2016-10-26 00:09:33 -07:00
Maximilian Hils
47b3a0e466 Update and rename README.mkd to README.md 2016-10-25 23:48:03 -07:00
chhsiao90
d52f35428c Show tls version on console 2016-10-26 14:36:14 +08:00
Maximilian Hils
bb5811beec fix the linter, knuth ftw! 2016-10-25 22:19:43 -07:00
Maximilian Hils
eda1b39a74 minor fixes 2016-10-25 22:06:52 -07:00
Maximilian Hils
f11b289c39 fix #1620 2016-10-25 21:56:13 -07:00
Maximilian Hils
a0ad0b06a0 Merge pull request #1669 from mhils/typecheck-options
Typecheck options
2016-10-25 21:00:46 -07:00
Maximilian Hils
b1bdae3d1c typecheck options, fix current inconsistencies 2016-10-25 20:45:48 -07:00
chhsiao90
960f2e8bf0 Resolved #582: display ClientConnection select cipher of TLS 2016-10-26 11:32:42 +08:00
Maximilian Hils
917c701562 make options keyword-only 2016-10-25 17:34:30 -07:00
Maximilian Hils
145c2892f7 Merge pull request #1664 from chhsiao90/sni-display-#1639
Resolved #1639: display sni on ClientConnection
2016-10-24 19:56:05 -07:00
chhsiao90
39ac29e37c Resolved #1639: display sni on ClientConnection 2016-10-25 10:46:53 +08:00
Maximilian Hils
ef4e9b2b85 Merge pull request #1656 from mhils/improve-export-2
Improve Flow Export
2016-10-24 19:19:58 -07:00
Maximilian Hils
ee8c7b31ab Merge pull request #1661 from slobo/patch-1
Include `boudary=...` in mutipart postData
2016-10-24 19:19:46 -07:00
Maximilian Hils
21f133fae9 fix FlowView._get_content_view 2016-10-24 16:03:28 -07:00
Sahil Chelaramani
7b3505336a replace mitmproxy.utils.lrucache with functools.lru_cache 2016-10-24 16:03:16 -07:00
Maximilian Hils
c14ae74d2e disable erroneous linting errors 2016-10-24 15:59:57 -07:00
Slobodan Mišković
39d7ba852c Include boudary=... in mutipart postData
While the HAR spec is not very explicit and their example shows just this one example: ```json
"postData": {
    "mimeType": "multipart/form-data"
}
```
Would it not make sense to include all the information necessary to parse out the post data `text`. Eg.
```json
"postData": {
           "text": "--xYzZY\r\nContent-Disposition: form-data; name=\"sort1\"\r\n\r\noldest date first\r\n--xYzZY--\r\n",
           "mimeType": "multipart/form-data; boundary=xYzZY"
         },
```
Currently, full mimeType is included only in `content-type` request header.

Elsewhere in HAR spec they include the 'extras', eg ```json
"content": {
    "mimeType": "text/html; charset=utf-8"
}
``` 
So one could argue that `mimeType` should include all information necessary to interpret the data. In case of `multipart/form-data`, as per RFC2046 http://www.ietf.org/rfc/rfc2046.txt
```
 The Content-Type field for multipart entities requires one parameter, "boundary".
```
I believe that earlier incarnations, eg `har_exporter.py` included it in the mimeType.
2016-10-24 14:34:04 -07:00
Maximilian Hils
5670e61a31 add version check for Python 3.4- 2016-10-24 14:26:07 -07:00
Maximilian Hils
e87daa70f3 improve flow export 2016-10-22 20:32:39 -07:00
Maximilian Hils
ea2d6474bf Merge pull request #1649 from cortesi/kill
Don't call error for flow kill
2016-10-22 19:22:50 -07:00
Maximilian Hils
c09cedd0f8 Merge pull request #1655 from mhils/fix-encoding
Encoding Fixes
2016-10-22 19:10:44 -07:00
Maximilian Hils
a1a792aeac various encoding fixes, fix #1650 2016-10-22 18:47:12 -07:00
Slobodan Mišković
0526d94f4a Handle bytes in request parameters 2016-10-22 18:28:32 -07:00
Maximilian Hils
37a05e2752 Merge pull request #1653 from mhils/issue-1651
Fix README Syntax (#1651)
2016-10-22 18:06:26 -07:00
Maximilian Hils
909ecd040a add README.rst validation to CI 2016-10-22 17:20:57 -07:00
Maximilian Hils
84555a601f fix README syntax 2016-10-22 17:20:45 -07:00
Aldo Cortesi
6170493615 Don't call error for flow kill
This is now the error handler on master, so whatever the intetion was it's now
definitely wrong.
2016-10-22 15:56:42 +13:00
Aldo Cortesi
ceb12e8628 Merge pull request #1648 from cortesi/console
console: give statusbar messages a default timeout
2016-10-22 15:56:19 +13:00
Aldo Cortesi
9fc1547053 console: give statusbar messages a default timeout 2016-10-22 15:06:24 +13:00
Aldo Cortesi
600906d182 Merge pull request #1647 from babldev/fix-flowfilter-example
Fix method call in flowfilter example
2016-10-22 13:23:08 +13:00
Brady Law
0d0a3a51df The first argument should be the filter, then the flow. 2016-10-21 16:47:19 -07:00
Aldo Cortesi
4ce828401f Adjust issue template
- Mention mitmdump --sysinfo
- Remove the "what went wrong" and "what was the expected behaviour" sections.
It's a bit officious, and 99% of the time is explicit from the problem description.
2016-10-22 10:25:34 +13:00
Aldo Cortesi
477f8868ad Merge pull request #1644 from cortesi/multidict
Clean up multidict a bit
2016-10-21 13:50:00 +13:00
Aldo Cortesi
d969bfa850 Merge pull request #1642 from cortesi/dox
docs: fix broken version
2016-10-21 11:47:23 +13:00
Aldo Cortesi
cc8b422d9d multidict: remove to_dict
We never use it, and it is dangerously ambiguous when a key is associated with
a list.
2016-10-21 11:42:21 +13:00
Aldo Cortesi
18ee6255c0 multidict: ditch ImmutableMultiDict
A contorted class we only use for cookie attributes. We don't need it.
2016-10-21 11:40:05 +13:00
Aldo Cortesi
ed9b40040b docs: fix broken version 2016-10-21 11:18:55 +13:00
Aldo Cortesi
0ebcd21eb1 dev.sh: pin to v3.5 for now
We can generalise this again when 3.6 comes out...
2016-10-21 10:46:03 +13:00
Aldo Cortesi
635c77d4ed console: correct log event handling i
Fixes #1640
2016-10-21 09:25:34 +13:00
Aldo Cortesi
711078ba3f Merge pull request #1637 from cortesi/tatanetlib
This PR merges netlib into mitmproxy
2016-10-20 12:36:26 +13:00
Aldo Cortesi
8430f857b5 The final piece: netlib -> mitproxy.net 2016-10-20 11:56:38 +13:00
Aldo Cortesi
853e03a5e7 netlib.tutils -> mitmproxy.test.tutils
There's a LOT more to be done refactoring our different conflicting test utils.
2016-10-20 11:42:55 +13:00
Aldo Cortesi
9491d8589a Improve exception hierarchy
ProxyException -> MitmproxyException
NetlibException inherits from MitmproxyException
2016-10-20 11:31:18 +13:00
Aldo Cortesi
01a449b5cb netlib.exceptions.* -> mitmproxy.exceptions 2016-10-20 11:27:05 +13:00
Aldo Cortesi
301d52d9d0 netlib.encoding -> netlib.http.encoding
Encoding is highly specific to http, and only used within this module.
2016-10-20 11:06:57 +13:00
Aldo Cortesi
f964d49853 netlib.certutils -> mitmproxy.certs 2016-10-20 11:02:52 +13:00
Aldo Cortesi
9870844b38 netlib.utils -> netlib.check
Now only contains is_valid_[host,port]

Intermediate step - this will be in mitproxy.net soon.
2016-10-20 10:46:47 +13:00
Aldo Cortesi
e0f3cce14c netlib.utils.[get,set]bit -> mitmproxy.utils.bits 2016-10-20 10:38:57 +13:00
Aldo Cortesi
9555126585 netlib.utils.BiDi -> mitmproxy.types.bidi.BiDi 2016-10-20 10:32:09 +13:00
Aldo Cortesi
a684585e7c netlib.debug -> mitmproxy.utils.debug 2016-10-20 10:25:36 +13:00
Aldo Cortesi
1ecb25cdc1 mitmproxy.types.[basethread,multidict,serializable] 2016-10-20 10:22:23 +13:00
Aldo Cortesi
f45f4e677e netlib.strutils -> mitmproxy.utils.strutils 2016-10-20 10:11:58 +13:00
Aldo Cortesi
1407830280 netlib.human -> mitmproxy.utils.human 2016-10-20 09:45:18 +13:00
Aldo Cortesi
069119364d Create mitmproxy.utils hierarchy
- Add mitproxy.utils.lrucache, mitproxy.utils.data
2016-10-20 09:35:55 +13:00
Aldo Cortesi
7440232f60 netlib.version -> mitmproxy.version 2016-10-20 09:20:44 +13:00
Aldo Cortesi
ee56d3fae0 Merge pull request #1635 from cortesi/refactor3
mitmproxy.protocol -> mitmproxy.proxy.protocol
2016-10-19 23:37:31 +13:00
Aldo Cortesi
9e7438fb18 console: fix master invocation order 2016-10-19 23:16:18 +13:00
Aldo Cortesi
e73c7fe77e mitmproxy.protocol -> mitmproxy.proxy.protocol
The protocols here are compltely proxy-specific, are only used from within the
proxy module, and are not exposed to users.
2016-10-19 23:11:56 +13:00
Thomas Kriechbaumer
e9f7cf68e9 Merge pull request #1634 from cortesi/pathoc
pathoc: handle error when selecting on read file
2016-10-19 11:27:39 +02:00
Aldo Cortesi
f4da81f749 pathoc: handle error when selecting on read file 2016-10-19 22:05:25 +13:00
Aldo Cortesi
25e866b669 debug: add missing print output file paramater 2016-10-19 21:53:58 +13:00
Aldo Cortesi
b1cf9dd5e3 Merge pull request #1633 from cortesi/refactor2
Continue module structure cleanup
2016-10-19 21:26:54 +13:00
Aldo Cortesi
24cf8da27e Move all tools into mitmproxy.tools, move models/* to top level
The primary motivation here (and for all the other moving around) is to present
a clean "front of house" to library users, and to migrate primary objects to
the top of the module hierarchy.
2016-10-19 20:26:05 +13:00
Aldo Cortesi
5a68d21e8c Remove flow module entirely, move contents to top level
mitmproxy.flow.io -> mitmproxy.io
mitmproxy.flow.export -> mitmproxy.export
2016-10-19 15:08:35 +13:00
Aldo Cortesi
49346c5248 Merge pull request #1632 from cortesi/refactor
Start rationalising our module structure bit by bit
2016-10-19 15:03:50 +13:00
Aldo Cortesi
7c32d4ea2a flow.state -> addons.state 2016-10-19 14:48:42 +13:00
Aldo Cortesi
22eebfd574 addons.Addons -> addonmanager, builtins -> addons 2016-10-19 14:39:39 +13:00
Aldo Cortesi
966418725b controller.Log -> log.Log 2016-10-19 14:14:59 +13:00
Aldo Cortesi
83dbefb224 Merge pull request #1631 from cortesi/nomaster
Kill flow.master - create master.Master
2016-10-19 13:45:19 +13:00
Aldo Cortesi
bce387a5a0 Kill flow.master - create master.Master
Also extract events into .events
2016-10-19 13:22:50 +13:00
Aldo Cortesi
12cdc1577a Merge pull request #1630 from cortesi/multiserv
Let's dispense with this fiction that we support multiple servers
2016-10-19 13:15:44 +13:00
Aldo Cortesi
8b5fb4b613 Merge pull request #1629 from cortesi/addonhalt
addons: add AddonHalt exception
2016-10-19 12:38:43 +13:00
Aldo Cortesi
264a09e778 Let's dispense with this fiction that we support multiple servers
It's simple enough to re-add if needed, and until then is just cruft.
2016-10-19 12:37:32 +13:00
Aldo Cortesi
8c888a58b9 Merge pull request #1628 from cortesi/webapp
Web apps to addons
2016-10-19 12:08:05 +13:00
Aldo Cortesi
da8dec9823 addons: add AddonHalt exception
This can be raised from an addon handler to stop further processing of a flow.

Use this to prevent further handling of web app requests.
2016-10-19 12:01:08 +13:00
Aldo Cortesi
87629586ae web app cleanups: tests and examples 2016-10-19 11:48:51 +13:00
Aldo Cortesi
85015fe561 pathoc: Guess the Host header from the path if possible 2016-10-19 11:41:42 +13:00
Aldo Cortesi
ceb8caee98 Web apps to addons
This commit removes the app registry, adds a wsgiapp addon base, and ports the
onboarding app to it.
2016-10-19 11:40:51 +13:00
Aldo Cortesi
8b51af1676 Merge pull request #1627 from cortesi/stateclean
No need for all builtins to be loaded for server tests
2016-10-18 22:46:44 +13:00
Aldo Cortesi
03cb5bb325 No need for all builtins to be loaded for server tests 2016-10-18 22:30:21 +13:00
Aldo Cortesi
a1859da390 Merge pull request #1626 from cortesi/state
Convert flow.state to an addon
2016-10-18 22:05:05 +13:00
Aldo Cortesi
466f5e56a1 Convert flow.state to an addon
A first step, and already many things are much nicer.
2016-10-18 21:51:36 +13:00
Aldo Cortesi
faa26a5d6b Merge pull request #1625 from cortesi/dupflow
master.duplicate_flow -> state.duplicate_flow
2016-10-18 12:28:47 +13:00
Aldo Cortesi
d5056c5627 accept_addon -> resume, intercept/resume events 2016-10-18 12:02:35 +13:00
Aldo Cortesi
825b02d495 master.duplicate_flow -> state.duplicate_flow
This is a pure operation on state, and doesn't belong on master.

Part of prep to move state to an addon.
2016-10-18 11:29:51 +13:00
Aldo Cortesi
323f04fbe1 Merge pull request #1624 from cortesi/streambodies
Response body streaming to addon
2016-10-18 11:14:44 +13:00
Aldo Cortesi
b25d94a6ac Response body streaming to addon 2016-10-18 10:42:05 +13:00
Aldo Cortesi
381ad898ac Remove mention of pathod.net from README
I'm just about to redirect this to mitmproxy.org
2016-10-18 09:06:32 +13:00
Maximilian Hils
c6d485bc77 dumper: limit url length 2016-10-17 12:56:11 +02:00
Maximilian Hils
beed406058 fix tests 2016-10-17 03:37:42 -07:00
Thomas Kriechbaumer
94c9dd66e6 remove empty lines at beginning of file 2016-10-17 10:32:12 +02:00
Thomas Kriechbaumer
e59a3be09d removed unused import 2016-10-17 09:55:49 +02:00
Maximilian Hils
7047531a3c Merge pull request #1619 from mhils/fix-socks-tls
Fix SOCKS5 mode with TLS
2016-10-16 23:50:25 -07:00
Maximilian Hils
02d3d61820 fix redirect_requests.py example 2016-10-16 23:49:54 -07:00
Maximilian Hils
758860531a fix socks5 mode with tls 2016-10-16 23:05:51 -07:00
Aldo Cortesi
43a83c89e7 python3: update README and setup.py trove classifiers 2016-10-17 18:42:48 +13:00
Maximilian Hils
209c73336c update protobuf, reenable for py3 (#1618) 2016-10-16 22:22:12 -07:00
Aldo Cortesi
00071238d2 Merge pull request #1617 from cortesi/object
python3
2016-10-17 18:21:23 +13:00
Aldo Cortesi
c774a9fec9 python3: clean up super and __future__ 2016-10-17 18:03:07 +13:00
Aldo Cortesi
a647b30365 python3: clean up class brackets 2016-10-17 17:37:08 +13:00
Aldo Cortesi
fb22f2ff4f Zap object base class 2016-10-17 17:37:08 +13:00
Maximilian Hils
666c59cbfb actually fix merge 🙈 2016-10-16 21:33:24 -07:00
Maximilian Hils
bdaa13d498 fix merge 2016-10-16 21:23:04 -07:00
Maximilian Hils
9389601025 Merge branch 'such-types' 2016-10-16 21:17:39 -07:00
Aldo Cortesi
ae3ff8ee1e Merge pull request #1615 from cortesi/python3a
exterminate six
2016-10-17 17:03:02 +13:00
Maximilian Hils
5a07892bfc py2--: inline type info 2016-10-16 20:56:46 -07:00
Aldo Cortesi
ce98a9219e test & examples: zap six 2016-10-17 16:45:45 +13:00
Maximilian Hils
3fbce7e981 update pydivert dependency (#1614) 2016-10-16 20:30:28 -07:00
Aldo Cortesi
839813a84c mitmproxy: zap six 2016-10-17 16:22:44 +13:00
Aldo Cortesi
d60ef617e3 pathod: remove six 2016-10-17 15:43:38 +13:00
Aldo Cortesi
421679a770 Merge pull request #1613 from cortesi/python3
First-order conversion to Python3-only
2016-10-17 15:35:09 +13:00
Aldo Cortesi
8360f70024 First-order conversion to Python3-only
- Zap various occurrences of Python2 in docs and scripts
- Remove six from netlib, and some other places where obvious project-wide
search and replace works.
2016-10-17 15:18:47 +13:00
Aldo Cortesi
4918feb725 Add stub converter for 0.19 io format 2016-10-17 08:47:03 +13:00
Aldo Cortesi
dcbb968b1b Bump version post release 2016-10-17 00:29:49 +13:00
810 changed files with 56414 additions and 41394 deletions

View File

@@ -7,8 +7,9 @@ environment:
matrix:
- PYTHON: "C:\\Python35"
TOXENV: "py35"
- PYTHON: "C:\\Python27"
TOXENV: "py27"
# TODO: ENABLE WHEN AVAILABLE
# - PYTHON: "C:\\Python36"
# TOXENV: "py36"
SNAPSHOT_HOST:
secure: NeTo57s2rJhCd/mjKHetXVxCFd3uhr8txnjnAXD1tUI=
@@ -18,6 +19,8 @@ environment:
secure: 6yBwmO5gv4vAwoFYII8qjQ==
SNAPSHOT_PASS:
secure: LPjrtFrWxYhOVGXzfPRV1GjtZE/wHoKq9m/PI6hSalfysUK5p2DxTG9uHlb4Q9qV
RTOOL_KEY:
secure: 0a+UUNbA+JjquyAbda4fd0JmiwL06AdG6torRPdCvbPDbKHnaW/BHHp1nRPytOKM
install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
@@ -25,21 +28,48 @@ install:
- "pip install -U tox"
test_script:
- ps: "tox -- --cov netlib --cov mitmproxy --cov pathod -v"
- ps: "tox -- --verbose --cov-report=term"
- ps: |
$Env:VERSION = $(python mitmproxy/version.py)
$Env:SKIP_MITMPROXY = "python -c `"print('skip mitmproxy')`""
tox -e wheel
tox -e rtool -- bdist
- ps: |
if(
($Env:TOXENV -match "py35") -and !$Env:APPVEYOR_PULL_REQUEST_NUMBER -and
(($Env:APPVEYOR_REPO_BRANCH -In ("master", "pyinstaller")) -or ($Env:APPVEYOR_REPO_TAG -match "true"))
) {
tox -e rtool -- decrypt release\installbuilder\license.xml.enc release\installbuilder\license.xml
if (!(Test-Path "C:\projects\mitmproxy\release\installbuilder-installer.exe")) {
"Download InstallBuilder..."
(New-Object System.Net.WebClient).DownloadFile(
"https://installbuilder.bitrock.com/installbuilder-enterprise-17.1.0-windows-installer.exe",
"C:\projects\mitmproxy\release\installbuilder-installer.exe"
)
}
Start-Process "C:\projects\mitmproxy\release\installbuilder-installer.exe" "--mode unattended --unattendedmodeui none" -Wait
& 'C:\Program Files (x86)\BitRock InstallBuilder Enterprise 17.1.0\bin\builder-cli.exe' `
build `
.\release\installbuilder\mitmproxy.xml `
windows `
--license .\release\installbuilder\license.xml `
--setvars project.version=$Env:VERSION `
--verbose
}
deploy_script:
# we build binaries on every run, but we only upload them for master snapshots or tags.
ps: |
if(
($Env:TOXENV -match "py35") -and
(($Env:APPVEYOR_REPO_BRANCH -match "master") -or ($Env:APPVEYOR_REPO_TAG -match "true"))
) {
pip install -U virtualenv
.\dev.ps1
cmd /c "python -u .\release\rtool.py bdist 2>&1"
python -u .\release\rtool.py upload-snapshot --bdist --wheel
(($Env:APPVEYOR_REPO_BRANCH -In ("master", "pyinstaller")) -or ($Env:APPVEYOR_REPO_TAG -match "true"))
) {
tox -e rtool -- upload-snapshot --bdist --wheel --installer
}
cache:
- C:\projects\mitmproxy\release\installbuilder-installer.exe -> .appveyor.yml
- C:\Users\appveyor\AppData\Local\pip\cache
notifications:

6
.env
View File

@@ -1,6 +0,0 @@
DIR="$( dirname "${BASH_SOURCE[0]}" )"
ACTIVATE_DIR="$(if [ -f "$DIR/venv/bin/activate" ]; then echo 'bin'; else echo 'Scripts'; fi;)"
if [ -z "$VIRTUAL_ENV" ] && [ -f "$DIR/venv/$ACTIVATE_DIR/activate" ]; then
echo "Activating mitmproxy virtualenv..."
source "$DIR/venv/$ACTIVATE_DIR/activate"
fi

2
.gitattributes vendored
View File

@@ -1,2 +1,2 @@
mitmproxy/web/static/**/* -diff
mitmproxy/tools/web/static/**/* -diff linguist-vendored
web/src/js/filt/filt.js -diff

6
.gitignore vendored
View File

@@ -1,6 +1,6 @@
.DS_Store
MANIFEST
*/tmp
**/tmp
/venv*
*.py[cdo]
*.swp
@@ -11,6 +11,7 @@ MANIFEST
.cache/
.tox*/
build/
mitmproxy/contrib/kaitaistruct/*.ksy
# UI
@@ -19,3 +20,6 @@ bower_components
*.map
sslkeylogfile.log
.tox/
.python-version
coverage.xml
web/coverage/

View File

@@ -1,19 +1,12 @@
sudo: false
language: python
addons:
apt:
sources:
# Debian sid currently holds OpenSSL 1.0.2
# change this with future releases!
- debian-sid
packages:
- libssl-dev
env:
global:
- CI_DEPS=codecov>=2.0.5
- CI_COMMANDS=codecov
git:
depth: 10000
matrix:
fast_finish: true
@@ -25,26 +18,55 @@ matrix:
language: generic
env: TOXENV=py35 BDIST=1
- python: 3.5
env: TOXENV=py35 BDIST=1
env: TOXENV=py35 OPENSSL_OLD
addons:
apt:
packages:
- libssl-dev
- python: 3.5
env: TOXENV=py35 NO_ALPN=1
- python: 2.7
env: TOXENV=py27
- python: 2.7
env: TOXENV=py27 NO_ALPN=1
env: TOXENV=py35 BDIST=1 OPENSSL_ALPN
addons:
apt:
sources:
# Debian sid currently holds OpenSSL 1.1.0
# change this with future releases!
- debian-sid
packages:
- libssl-dev
- python: 3.6
env: TOXENV=py36 OPENSSL_ALPN
addons:
apt:
sources:
# Debian sid currently holds OpenSSL 1.1.0
# change this with future releases!
- debian-sid
packages:
- libssl-dev
- python: 3.5
env: TOXENV=individual_coverage
- python: 3.5
env: TOXENV=docs
allow_failures:
- python: pypy
- language: node_js
node_js: "node"
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
install:
- cd web && yarn
- yarn global add codecov
script: npm test && codecov
cache:
yarn: true
directories:
- web/node_modules
install:
- |
if [[ $TRAVIS_OS_NAME == "osx" ]]
then
brew update || brew update # try again if it fails
brew upgrade
brew reinstall openssl
brew reinstall pyenv
brew update || brew update
brew outdated pyenv || brew upgrade pyenv
eval "$(pyenv init -)"
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install --skip-existing 3.5.2
pyenv global 3.5.2
@@ -53,18 +75,21 @@ install:
fi
- pip install tox
script: tox -- --cov netlib --cov mitmproxy --cov pathod -v
script:
- tox -- --verbose --cov-report=term
- |
if [[ $BDIST == "1" ]]
then
git fetch --unshallow --tags
tox -e rtool -- bdist
fi
after_success:
# we build binaries on every run, but we only upload them for master snapshots or tags.
- |
if [[ $BDIST == "1" && $TRAVIS_PULL_REQUEST == "false" && ($TRAVIS_BRANCH == "master" || -n $TRAVIS_TAG) ]]
if [[ $BDIST == "1" && $TRAVIS_PULL_REQUEST == "false" && ($TRAVIS_BRANCH == "pyinstaller" || $TRAVIS_BRANCH == "master" || -n $TRAVIS_TAG) ]]
then
git fetch --unshallow
./dev.sh 3.5
source venv3.5/bin/activate
pip install -e ./release
python -u ./release/rtool.py bdist
python -u ./release/rtool.py upload-snapshot --bdist
tox -e rtool -- upload-snapshot --bdist
fi
notifications:
@@ -79,3 +104,4 @@ cache:
directories:
- $HOME/.pyenv
- $HOME/.cache/pip
# - $HOME/build/mitmproxy/mitmproxy/.tox

View File

@@ -1,3 +1,72 @@
28 April 2017: mitmproxy 2.0.2
* Fix mitmweb's Content-Security-Policy to work with Chrome 58+
* HTTP/2: actually use header normalization from hyper-h2
15 March 2017: mitmproxy 2.0.1
* bump cryptography dependency
* bump pyparsing dependency
* HTTP/2: use header normalization from hyper-h2
21 February 2017: mitmproxy 2.0
* HTTP/2 is now enabled by default.
* Image ContentView: Parse images with Kaitai Struct (kaitai.io) instead of Pillow.
This simplifies installation, reduces binary size, and allows parsing in pure Python.
* Web: Add missing flow filters.
* Add transparent proxy support for OpenBSD.
* Check the mitmproxy CA for expiration and warn the user to regenerate it if necessary.
* Testing: Tremendous improvements, enforced 100% coverage for large parts of the
codebase, increased overall coverage.
* Enforce individual coverage: one source file -> one test file with 100% coverage.
* A myriad of other small improvements throughout the project.
* Numerous bugfixes.
26 December 2016: mitmproxy 1.0
* All mitmproxy tools are now Python 3 only! We plan to support Python 3.5 and higher.
* Web-Based User Interface: Mitmproxy now offically has a web-based user interface
called mitmweb. We consider it stable for all features currently exposed
in the UI, but it still misses a lot of mitmproxys options.
* Windows Compatibility: With mitmweb, mitmproxy is now useable on Windows.
We are also introducing an installer (kindly sponsored by BitRock) that
simplifies setup.
* Configuration: The config file format is now a single YAML file. In most cases,
converting to the new format should be trivial - please see the docs for
more information.
* Console: Significant UI improvements - including sorting of flows by
size, type and url, status bar improvements, much faster indentation for
HTTP views, and more.
* HTTP/2: Significant improvements, but is temporarily disabled by default
due to wide-spread protocol implementation errors on some large website
* WebSocket: The protocol implementation is now mature, and is enabled by
default. Complete UI support is coming in the next release. Hooks for
message interception and manipulation are available.
* A myriad of other small improvements throughout the project.
16 October 2016: mitmproxy 0.18
* Python 3 Compatibility for mitmproxy and pathod (Shadab Zafar, GSoC 2016)

View File

@@ -1,6 +1,6 @@
2184 Aldo Cortesi
1745 Maximilian Hils
507 Thomas Kriechbaumer
2407 Aldo Cortesi
1873 Maximilian Hils
556 Thomas Kriechbaumer
258 Shadab Zafar
97 Jason
83 Marcelo Glezer
@@ -11,85 +11,91 @@
14 Pedro Worcel
14 David Weinstein
13 Thomas Roth
11 Stephen Altamirano
11 Jake Drahos
11 Stephen Altamirano
11 arjun23496
11 Justus Wingert
10 Sandor Nemes
10 Zohar Lorberbaum
10 András Veres-Szentkirályi
10 Chris Czub
10 Zohar Lorberbaum
10 smill
10 Chris Czub
10 Sandor Nemes
10 Doug Freed
9 ikoz
9 Kyle Morton
9 Legend Tang
9 Rouli
9 Kyle Morton
8 Jason A. Novak
8 Chandler Abraham
7 Alexis Hildebrandt
7 Matthias Urlichs
7 Brad Peabody
7 dufferzafar
7 Alexis Hildebrandt
6 Felix Yan
5 Tomaz Muraus
5 elitest
5 iroiro123
5 Sam Cleveland
5 Choongwoo Han
5 Will Coster
4 root
4 Clemens Brunner
5 Sam Cleveland
5 iroiro123
5 elitest
5 Tomaz Muraus
5 Choongwoo Han
4 Schamper
4 Valtteri Virtanen
4 Wade 524
4 Youhei Sakurai
4 Bryan Bishop
4 root
4 Valtteri Virtanen
4 Clemens Brunner
4 Marc Liyanage
4 Michael J. Bazzinotti
4 Wade 524
4 chhsiao90
4 yonder
3 Eli Shvartsman
3 Chris Neasbitt
3 Guillem Anguera
3 MatthewShao
4 Michael J. Bazzinotti
3 Ryan Welton
3 smill@cuckoo.sh
3 Manish Kumar
3 Benjamin Lee
3 Ryan Laughlin
3 Zack B
3 Kyle Manna
3 Eli Shvartsman
3 Vincent Haupert
3 Manish Kumar
3 Zack B
3 MatthewShao
3 redfast00
3 requires.io
3 Guillem Anguera
3 smill@cuckoo.sh
3 Chris Neasbitt
3 Benjamin Lee
2 Steven Van Acker
2 Slobodan Mišković
2 Jim Lloyd
2 isra17
2 israel
2 Colin Bendell
2 Sean Coates
2 Sachin Kelkar
2 jpkrause
2 Paul
2 Bennett Blodinger
2 lilydjwg
2 Michael Frister
2 依云
2 Jaime Soriano Pastor
2 Nick Badger
2 Rob Wills
2 Heikki Hannikainen
2 Vincent Haupert
2 strohu
2 Wade Catron
2 Krzysztof Bielicki
2 Sachin Kelkar
2 Israel Nir
2 Anant
2 alts
2 Doug Freed
2 Niko Kommenda
2 Terry Long
2 Mark E. Haase
2 Steven Van Acker
2 Jim Lloyd
2 Bennett Blodinger
2 Sean Coates
2 Cory Benfield
1 Sergey Chipiga
2 phackt
2 Anant
2 Jaime Soriano Pastor
2 Paul
2 Colin Bendell
2 依云
2 Heikki Hannikainen
2 Rob Wills
2 Niko Kommenda
2 Naveen Pai
2 strohu
2 alts
2 Yoginski
2 Mark E. Haase
2 Wade Catron
2 Terry Long
2 Krzysztof Bielicki
2 Nick Badger
1 Nicolas Esteves
1 Andrew Orr
1 Andrey Plotnikov
1 Andy Smith
1 Angelo Agatino Nicolosi
@@ -97,6 +103,7 @@
1 BSalita
1 Ben Lerner
1 Bradley Baetz
1 Brady Law
1 Brett Randall
1 Chris Hamant
1 Christian Frichot
@@ -105,6 +112,7 @@
1 David Shaw
1 Doug Lethin
1 Drake Caraker
1 Edgar Boda-Majer
1 Eric Entzel
1 Felix Wolfsteller
1 FreeArtMan
@@ -128,22 +136,25 @@
1 Mathieu Mitchell
1 Michael Bisbjerg
1 Mike C
1 Mike Fotinakis
1 Mikhail Korobov
1 Morton Fox
1 Nick HS
1 Nick Raptis
1 Nicolas Esteves
1 Aditya
1 Oleksandr Sheremet
1 Parth Ganatra
1 Pritam Baral
1 Quentin Pradet
1 Rich Somerfield
1 Rory McCann
1 Rune Halvorsen
1 Ryo Onodera
1 Sahil Chelaramani
1 Sahn Lam
1 Sanchit Sokhey
1 Seppo Yli-Olli
1 Aditya
1 Sergey Chipiga
1 Stefan Wärting
1 Steve Phillips
1 Steven Noble
@@ -158,10 +169,8 @@
1 Ulrich Petri
1 Vyacheslav Bakhmutov
1 Wes Turner
1 Yoginski
1 Yuangxuan Wang
1 capt8bit
1 chhsiao90
1 cle1000
1 davidpshaw
1 deployable
@@ -172,7 +181,6 @@
1 meeee
1 michaeljau
1 peralta
1 phackt
1 phil plante
1 sentient07
1 sethp-jive

View File

@@ -1,4 +1,3 @@
graft mitmproxy
graft pathod
graft netlib
recursive-exclude * *.pyc *.pyo *.swo *.swp *.map
recursive-exclude * *.pyc *.pyo *.swo *.swp *.map

View File

@@ -3,14 +3,15 @@ mitmproxy
|travis| |appveyor| |coverage| |latest_release| |python_versions|
This repository contains the **mitmproxy** and **pathod** projects, as well as
their shared networking library, **netlib**.
This repository contains the **mitmproxy** and **pathod** projects.
``mitmproxy`` is an interactive, SSL-capable intercepting proxy with a console
interface.
``mitmdump`` is the command-line version of mitmproxy. Think tcpdump for HTTP.
``mitmweb`` is a web-based interface for mitmproxy.
``pathoc`` and ``pathod`` are perverse HTTP client and server applications
designed to let you craft almost any conceivable HTTP request, including ones
that creatively violate the standards.
@@ -23,8 +24,7 @@ Documentation & Help
General information, tutorials, and precompiled binaries can be found on the mitmproxy
and pathod websites.
|mitmproxy_site| |pathod_site|
|mitmproxy_site|
The latest documentation for mitmproxy is also available on ReadTheDocs.
@@ -37,7 +37,7 @@ each other solve problems, and come up with new ideas for the project.
|mitmproxy_discourse|
Join our developer chat on Slack if you would like to hack on mitmproxy itself.
Join our developer chat on Slack if you would like to contribute to mitmproxy itself.
|slack|
@@ -45,79 +45,67 @@ Join our developer chat on Slack if you would like to hack on mitmproxy itself.
Installation
------------
The installation instructions are `here <http://docs.mitmproxy.org/en/stable/install.html>`_.
The installation instructions are `here <http://docs.mitmproxy.org/en/stable/install.html>`__.
If you want to contribute changes, keep on reading.
Contributing
------------
Hacking
-------
As an open source project, mitmproxy welcomes contributions of all forms. If you would like to bring the project forward,
please consider contributing in the following areas:
To get started hacking on mitmproxy, make sure you have Python_ 3.5.x or above with
virtualenv_ installed (you can find installation instructions for virtualenv
`here <http://virtualenv.readthedocs.org/en/latest/>`_). Then do the following:
- **Maintenance:** We are *incredibly* thankful for individuals who are stepping up and helping with maintenance. This includes (but is not limited to) triaging issues, reviewing pull requests and picking up stale ones, helping out other users in our forums_, creating minimal, complete and verifiable examples or test cases for existing bug reports, updating documentation, or fixing minor bugs that have recently been reported.
- **Code Contributions:** We actively mark issues that we consider are `good first contributions`_. If you intend to work on a larger contribution to the project, please come talk to us first.
.. code-block:: text
Development Setup
-----------------
To get started hacking on mitmproxy, please follow the `advanced installation`_ steps to install mitmproxy from source, but stop right before running ``pip3 install mitmproxy``. Instead, do the following:
.. code-block:: bash
git clone https://github.com/mitmproxy/mitmproxy.git
cd mitmproxy
./dev.sh # powershell .\dev.ps1 on Windows
./dev.sh # "powershell .\dev.ps1" on Windows
The *dev* script will create a virtualenv environment in a directory called
"venv", and install all mandatory and optional dependencies into it. The
primary mitmproxy components - mitmproxy, netlib and pathod - are installed as
The *dev* script will create a `virtualenv`_ environment in a directory called "venv"
and install all mandatory and optional dependencies into it. The primary
mitmproxy components - mitmproxy and pathod - are installed as
"editable", so any changes to the source in the repository will be reflected
live in the virtualenv.
To confirm that you're up and running, activate the virtualenv, and run the
mitmproxy test suite:
.. code-block:: text
. venv/bin/activate # venv\Scripts\activate on Windows
py.test
Note that the main executables for the project - ``mitmdump``, ``mitmproxy``,
The main executables for the project - ``mitmdump``, ``mitmproxy``,
``mitmweb``, ``pathod``, and ``pathoc`` - are all created within the
virtualenv. After activating the virtualenv, they will be on your $PATH, and
you can run them like any other command:
.. code-block:: text
.. code-block:: bash
. venv/bin/activate # "venv\Scripts\activate" on Windows
mitmdump --version
For convenience, the project includes an autoenv_ file (`.env`_) that
auto-activates the virtualenv when you cd into the mitmproxy directory.
Testing
-------
If you've followed the procedure above, you already have all the development
requirements installed, and you can simply run the test suite:
requirements installed, and you can run the full test suite (including tests for code style and documentation) with tox_:
.. code-block:: text
.. code-block:: bash
py.test
tox
For speedier testing, we recommend you run `pytest`_ directly on individual test files or folders:
.. code-block:: bash
cd test/mitmproxy/addons
pytest --cov mitmproxy.addons.anticache --looponfail test_anticache.py
As pytest does not check the code style, you probably want to run ``tox -e lint`` before committing your changes.
Please ensure that all patches are accompanied by matching changes in the test
suite. The project tries to maintain 100% test coverage.
You can also use `tox` to run a full suite of tests in Python 2.7 and 3.5,
including a quick test to check documentation and code linting.
The following tox environments are relevant for local testing:
.. code-block:: text
tox -e py27 # runs all tests with Python 2.7
tox -e py35 # runs all tests with Python 3.5
tox -e docs # runs a does-it-compile check on the documentation
tox -e lint # runs the linter for coding style checks
We support Python 2.7 and 3.5, so please make sure all tests pass in both
environments. Running `tox` ensures all necessary tests are executed.
suite. The project tries to maintain 100% test coverage and enforces this strictly for some parts of the codebase.
Documentation
-------------
@@ -126,7 +114,7 @@ The mitmproxy documentation is build using Sphinx_, which is installed
automatically if you set up a development environment as described above. After
installation, you can render the documentation like this:
.. code-block:: text
.. code-block:: bash
cd docs
make clean
@@ -136,8 +124,8 @@ installation, you can render the documentation like this:
The last command invokes `sphinx-autobuild`_, which watches the Sphinx directory and rebuilds
the documentation when a change is detected.
Style
-----
Code Style
----------
Keeping to a consistent code style throughout the project makes it easier to
contribute and collaborate. Please stick to the guidelines in
@@ -145,22 +133,19 @@ contribute and collaborate. Please stick to the guidelines in
good reason not to.
This is automatically enforced on every PR. If we detect a linting error, the
PR checks will fail and block merging. We are using this command to check for style compliance:
PR checks will fail and block merging. You can run our lint checks yourself
with the following command:
.. code-block:: text
.. code-block:: bash
flake8 --jobs 8 --count mitmproxy netlib pathod examples test
tox -e lint
.. |mitmproxy_site| image:: https://shields.mitmproxy.org/api/https%3A%2F%2F-mitmproxy.org-blue.svg
:target: https://mitmproxy.org/
:alt: mitmproxy.org
.. |pathod_site| image:: https://shields.mitmproxy.org/api/https%3A%2F%2F-pathod.net-blue.svg
:target: https://pathod.net/
:alt: pathod.net
.. |mitmproxy_docs| image:: https://readthedocs.org/projects/mitmproxy/badge/
.. |mitmproxy_docs| image:: https://shields.mitmproxy.org/api/docs-latest-brightgreen.svg
:target: http://docs.mitmproxy.org/en/latest/
:alt: mitmproxy documentation
@@ -172,15 +157,15 @@ PR checks will fail and block merging. We are using this command to check for st
:target: http://slack.mitmproxy.org/
:alt: Slack Developer Chat
.. |travis| image:: https://shields.mitmproxy.org/travis/mitmproxy/mitmproxy/master.svg?label=Travis%20build
.. |travis| image:: https://shields.mitmproxy.org/travis/mitmproxy/mitmproxy/master.svg?label=travis%20ci
:target: https://travis-ci.org/mitmproxy/mitmproxy
:alt: Travis Build Status
.. |appveyor| image:: https://shields.mitmproxy.org/appveyor/ci/mhils/mitmproxy/master.svg?label=Appveyor%20build
.. |appveyor| image:: https://shields.mitmproxy.org/appveyor/ci/mhils/mitmproxy/master.svg?label=appveyor%20ci
:target: https://ci.appveyor.com/project/mhils/mitmproxy
:alt: Appveyor Build Status
.. |coverage| image:: https://codecov.io/gh/mitmproxy/mitmproxy/branch/master/graph/badge.svg
.. |coverage| image:: https://shields.mitmproxy.org/codecov/c/github/mitmproxy/mitmproxy/master.svg?label=codecov
:target: https://codecov.io/gh/mitmproxy/mitmproxy
:alt: Coverage Status
@@ -192,12 +177,13 @@ PR checks will fail and block merging. We are using this command to check for st
:target: https://pypi.python.org/pypi/mitmproxy
:alt: Supported Python versions
.. _Python: https://www.python.org/
.. _virtualenv: http://virtualenv.readthedocs.org/en/latest/
.. _autoenv: https://github.com/kennethreitz/autoenv
.. _.env: https://github.com/mitmproxy/mitmproxy/blob/master/.env
.. _`advanced installation`: http://docs.mitmproxy.org/en/latest/install.html#advanced-installation
.. _virtualenv: https://virtualenv.pypa.io/
.. _`pytest`: http://pytest.org/
.. _tox: https://tox.readthedocs.io/
.. _Sphinx: http://sphinx-doc.org/
.. _sphinx-autobuild: https://pypi.python.org/pypi/sphinx-autobuild
.. _issue_tracker: https://github.com/mitmproxy/mitmproxy/issues
.. _PEP8: https://www.python.org/dev/peps/pep-0008
.. _Google Style Guide: https://google.github.io/styleguide/pyguide.html
.. _`Google Style Guide`: https://google.github.io/styleguide/pyguide.html
.. _forums: https://discourse.mitmproxy.org/
.. _`good first contributions`: https://github.com/mitmproxy/mitmproxy/issues?q=is%3Aissue+is%3Aopen+label%3Agood-first-contribution

12
dev.ps1
View File

@@ -1,15 +1,19 @@
$ErrorActionPreference = "Stop"
$VENV = ".\venv"
virtualenv $VENV --always-copy
& $VENV\Scripts\activate.ps1
$pyver = python --version
if($pyver -notmatch "3\.[5-9]") {
Write-Warning "Unexpected Python version, expected Python 3.5 or above: $pyver"
}
python -m venv .\venv --copies
& .\venv\Scripts\activate.ps1
python -m pip install --disable-pip-version-check -U pip
cmd /c "pip install -r requirements.txt 2>&1"
echo @"
* Created virtualenv environment in $VENV.
* Created virtualenv environment in .\venv.
* Installed all dependencies into the virtualenv.
* Activated virtualenv environment.

18
dev.sh
View File

@@ -2,16 +2,14 @@
set -e
set -x
PYVERSION=$1
VENV="venv$1"
echo "Creating dev environment in ./venv..."
echo "Creating dev environment in $VENV using Python $PYVERSION"
python$PYVERSION -m virtualenv "$VENV" --always-copy
. "$VENV/bin/activate"
pip$PYVERSION install -U pip setuptools
pip$PYVERSION install -r requirements.txt
python3 -m venv venv
. venv/bin/activate
pip3 install -U pip setuptools
pip3 install -r requirements.txt
echo ""
echo "* Virtualenv created in $VENV and all dependencies installed."
echo "* You can now activate the $(python --version) virtualenv with this command: \`. $VENV/bin/activate\`"
echo " * Created virtualenv environment in ./venv."
echo " * Installed all dependencies into the virtualenv."
echo " * You can now activate the $(python3 --version) virtualenv with this command: \`. venv/bin/activate\`"

View File

@@ -24,6 +24,9 @@ something like this:
Click on the relevant icon, follow the setup instructions for the platform
you're on and you are good to go.
For iOS version 10.3 or up, you need to make sure ``mitmproxy`` is enabled in
``Certificate Trust Settings``, you can check it by going to
``Settings > General > About > Certificate Trust Settings``.
Installing the mitmproxy CA certificate manually
------------------------------------------------
@@ -40,7 +43,9 @@ start of mitmproxy.
iOS
^^^
http://kb.mit.edu/confluence/pages/viewpage.action?pageId=152600377
See http://jasdev.me/intercepting-ios-traffic
and https://web.archive.org/web/20150920082614/http://kb.mit.edu/confluence/pages/viewpage.action?pageId=152600377
iOS Simulator
^^^^^^^^^^^^^
@@ -50,7 +55,7 @@ See https://github.com/ADVTOOLS/ADVTrustStore#how-to-use-advtruststore
Java
^^^^
See http://docs.oracle.com/cd/E19906-01/820-4916/geygn/index.html
See https://docs.oracle.com/cd/E19906-01/820-4916/geygn/index.html
Android/Android Simulator
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +65,7 @@ See http://wiki.cacert.org/FAQ/ImportRootCert#Android_Phones_.26_Tablets
Windows
^^^^^^^
See http://windows.microsoft.com/en-ca/windows/import-export-certificates-private-keys#1TC=windows-7
See https://web.archive.org/web/20160612045445/http://windows.microsoft.com/en-ca/windows/import-export-certificates-private-keys#1TC=windows-7
Windows (automated)
^^^^^^^^^^^^^^^^^^^
@@ -77,7 +82,7 @@ See https://support.apple.com/kb/PH7297?locale=en_US
Ubuntu/Debian
^^^^^^^^^^^^^
See http://askubuntu.com/questions/73287/how-do-i-install-a-root-certificate/94861#94861
See https://askubuntu.com/questions/73287/how-do-i-install-a-root-certificate/94861#94861
Mozilla Firefox
^^^^^^^^^^^^^^^
@@ -87,7 +92,7 @@ See https://wiki.mozilla.org/MozillaRootCertificate#Mozilla_Firefox
Chrome on Linux
^^^^^^^^^^^^^^^
See https://code.google.com/p/chromium/wiki/LinuxCertManagement
See https://stackoverflow.com/a/15076602/198996
The mitmproxy certificate authority
@@ -130,7 +135,7 @@ mitmproxy-ca-cert.cer Same file as .pem, but with an extension expected by some
Using a custom certificate
--------------------------
You can use your own certificate by passing the ``--cert [domain=]path_to_certificate`` option to
You can use your own (leaf) certificate by passing the ``--cert [domain=]path_to_certificate`` option to
mitmproxy. Mitmproxy then uses the provided certificate for interception of the
specified domain instead of generating a certificate signed by its own CA.
@@ -203,4 +208,4 @@ directory and uses this as the client cert.
.. _Certificate Pinning: http://security.stackexchange.com/questions/29988/what-is-certificate-pinning/
.. _Certificate Pinning: https://security.stackexchange.com/questions/29988/what-is-certificate-pinning/

View File

@@ -5,7 +5,7 @@ import subprocess
import sys
sys.path.insert(0, os.path.abspath('..'))
import netlib.version
from mitmproxy import version as mversion
extensions = [
@@ -47,9 +47,9 @@ author = u'The mitmproxy project'
# built documents.
#
# The short X.Y version.
version = netlib.version.VERSION
version = mversion.VERSION
# The full version, including alpha/beta/rc tags.
release = netlib.version.VERSION
release = mversion.VERSION
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -231,10 +231,7 @@ def linkcode_resolve(domain, info):
_, line = inspect.getsourcelines(obj)
except (TypeError, IOError):
return None
if spath.rfind("netlib") > -1:
off = spath.rfind("netlib")
mpath = spath[off:]
elif spath.rfind("mitmproxy") > -1:
if spath.rfind("mitmproxy") > -1:
off = spath.rfind("mitmproxy")
mpath = spath[off:]
else:

View File

@@ -3,84 +3,11 @@
Configuration
=============
Mitmproxy is configured through a set of files in the users ~/.mitmproxy
directory.
Mitmproxy is configured with a YAML_ file, located at
``~/.mitmproxy/config.yaml``. We'll have complete documentation for all
supported options in the next release in the meantime, please consult the
source_ for a complete list of options and types.
mitmproxy.conf
Settings for the :program:`mitmproxy`. This file can contain any options supported by
mitmproxy.
mitmdump.conf
Settings for the :program:`mitmdump`. This file can contain any options supported by mitmdump.
common.conf
Settings shared between all command-line tools. Settings in this file are over-ridden by those
in the tool-specific files. Only options shared by mitmproxy and mitmdump should be used in
this file.
Syntax
------
Comments
^^^^^^^^
.. code-block:: none
# this is a comment
; this is also a comment (.ini style)
--- and this is a comment too (yaml style)
Key/Value pairs
^^^^^^^^^^^^^^^
- Keys and values are case-sensitive
- Whitespace is ignored
- Lists are comma-delimited, and enclosed in square brackets
.. code-block:: none
name = value # (.ini style)
name: value # (yaml style)
--name value # (command-line option style)
fruit = [apple, orange, lemon]
indexes = [1, 12, 35 , 40]
Flags
^^^^^
These are boolean options that take no value but true/false.
.. code-block:: none
name = true # (.ini style)
name
--name # (command-line option style)
Options
-------
The options available in the config files are precisely those available as
command-line flags, with the key being the option's long name. To get a
complete list of these, use the ``--help`` option on each of the tools. Be
careful to only specify common options in the **common.conf** file -
unsupported options in this file will be detected as an error on startup.
Examples
--------
common.conf
^^^^^^^^^^^
Note that ``--port`` is an option supported by all tools.
.. code-block:: none
port = 8080
mitmproxy.conf
^^^^^^^^^^^^^^
.. code-block:: none
palette = light
.. _YAML: http://www.yaml.org/start.html
.. _source: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/options.py

View File

@@ -1,14 +0,0 @@
.. _architecture:
Architecture
============
To give you a better understanding of how mitmproxy works, mitmproxy's
high-level architecture is detailed in the following graphic:
.. image:: ../schematics/architecture.png
:download:`architecture.pdf <../schematics/architecture.pdf>`
Please don't refrain from asking any further
questions on the mailing list, the Slack channel or the GitHub issue tracker.

11
docs/dev/contributing.rst Normal file
View File

@@ -0,0 +1,11 @@
.. _contributing:
Contributing
============
As an open source project, **mitmproxy** welcomes contributions of all forms.
Please head over to the README_ to get started! 😃
.. _README: https://github.com/mitmproxy/mitmproxy/blob/master/README.rst

View File

@@ -1,47 +0,0 @@
.. _testing:
Testing
=======
All the mitmproxy projects strive to maintain 100% code coverage. In general,
patches and pull requests will be declined unless they're accompanied by a
suitable extension to the test suite.
Our tests are written for the `py.test`_ or nose_ test frameworks.
At the point where you send your pull request, a command like this:
>>> py.test --cov mitmproxy --cov netlib
Should give output something like this:
.. code-block:: none
> ---------- coverage: platform darwin, python 2.7.2-final-0 --
> Name Stmts Miss Cover Missing
> ----------------------------------------------------
> mitmproxy/__init__ 0 0 100%
> mitmproxy/app 4 0 100%
> mitmproxy/cmdline 100 0 100%
> mitmproxy/controller 69 0 100%
> mitmproxy/dump 150 0 100%
> mitmproxy/encoding 39 0 100%
> mitmproxy/flowfilter 201 0 100%
> mitmproxy/flow 891 0 100%
> mitmproxy/proxy 427 0 100%
> mitmproxy/script 27 0 100%
> mitmproxy/utils 133 0 100%
> mitmproxy/version 4 0 100%
> ----------------------------------------------------
> TOTAL 2045 0 100%
> ----------------------------------------------------
> Ran 251 tests in 11.864s
There are exceptions to the coverage requirement - for instance, much of the
console interface code can't sensibly be unit tested. These portions are
excluded from coverage analysis either in the **.coveragerc** file, or using
**#pragma no-cover** directives. To keep our coverage analysis relevant, we use
these measures as sparingly as possible.
.. _nose: https://nose.readthedocs.org/en/latest/
.. _py.test: https://pytest.org/

View File

@@ -11,5 +11,5 @@ sure you capture an HTTP exchange in its totality. It's also often used during
================== ======================
command-line ``--anticache``
mitmproxy shortcut :kbd:`o` then :kbd:`a`
mitmproxy shortcut :kbd:`O` then :kbd:`a`
================== ======================

View File

@@ -23,7 +23,7 @@ How it works
================== ======================
command-line ``--ignore regex``
mitmproxy shortcut :kbd:`o` then :kbd:`I`
mitmproxy shortcut :kbd:`O` then :kbd:`I`
================== ======================

View File

@@ -48,25 +48,24 @@ In practice, it's pretty common for the replacement literal to be long and
complex. For instance, it might be an XSS exploit that weighs in at hundreds or
thousands of characters. To cope with this, there's a variation of the
replacement hook specifier that lets you load the replacement text from a file.
So, you might start **mitmdump** as follows:
To specify a file as replacement, prefix the file path with ``@``.
You might start **mitmdump** as follows:
>>> mitmdump --replace-from-file :~q:foo:~/xss-exploit
>>> mitmdump --replacements :~q:foo:@~/xss-exploit
This will load the replacement text from the file ``~/xss-exploit``.
Both the ``--replace`` and ``--replace-from-file`` flags can be passed multiple
times.
The ``--replacements`` flag can be passed multiple times.
Interactively
-------------
The :kbd:`R` shortcut key in the mitmproxy options menu (:kbd:`o`) lets you add and edit
The :kbd:`R` shortcut key in the mitmproxy options menu (:kbd:`O`) lets you add and edit
replacement hooks using a built-in editor. The context-sensitive help (:kbd:`?`) has
complete usage information.
================== =======================
command-line ``--replace``,
``--replace-from-file``
mitmproxy shortcut :kbd:`o` then :kbd:`R`
command-line ``--replacements``
mitmproxy shortcut :kbd:`O` then :kbd:`R`
================== =======================

View File

@@ -40,8 +40,8 @@ You can also use a script to customize exactly which responses are streamed.
Responses that should be tagged for streaming by setting their ``.stream``
attribute to ``True``:
.. literalinclude:: ../../examples/stream.py
:caption: examples/stream.py
.. literalinclude:: ../../examples/complex/stream.py
:caption: examples/complex/stream.py
:language: python
Implementation Details
@@ -59,8 +59,8 @@ Modifying streamed data
If the ``.stream`` attribute is callable, ``.stream`` will wrap the generator that yields all
chunks.
.. literalinclude:: ../../examples/stream_modify.py
:caption: examples/stream_modify.py
.. literalinclude:: ../../examples/complex/stream_modify.py
:caption: examples/complex/stream_modify.py
:language: python
.. seealso::

View File

@@ -31,7 +31,8 @@ Host Header
In reverse proxy mode, mitmproxy automatically rewrites the Host header to match the
upstream server. This allows mitmproxy to easily connect to existing endpoints on the
open web (e.g. ``mitmproxy -R https://example.com``).
open web (e.g. ``mitmproxy -R https://example.com``). You can disable this behaviour
by passing ``--keep-host-header`` on the console.
However, keep in mind that absolute URLs within the returned document or HTTP redirects will
NOT be rewritten by mitmproxy. This means that if you click on a link for "http://example.com"
@@ -39,4 +40,4 @@ in the returned web page, you will be taken directly to that URL, bypassing mitm
One possible way to address this is to modify the hosts file of your OS so that "example.com"
resolves to your proxy's IP, and then access the proxy by going directly to example.com.
Make sure that your proxy can still resolve the original IP, or specify an IP in mitmproxy.
Make sure that your proxy can still resolve the original IP, or specify an IP in mitmproxy.

View File

@@ -31,7 +31,20 @@ in the past at the time of replay, and vice versa. Cookie expiry times are
updated in a similar way.
You can turn off response refreshing using the ``--norefresh`` argument, or using
the :kbd:`o` options shortcut within :program:`mitmproxy`.
the :kbd:`O` options shortcut within :program:`mitmproxy`.
Replaying a session recorded in Reverse-proxy Mode
--------------------------------------------------
If you have captured the session in reverse proxy mode, in order to replay it you
still have to specify the server URL, otherwise you may get the error:
'HTTP protocol error in client request: Invalid HTTP request form (expected authority or absolute...)'.
During replay, when the client's requests match previously recorded requests, then the
respective recorded responses are simply replayed by mitmproxy.
Otherwise, the unmatched requests is forwarded to the upstream server.
If forwarding is not desired, you can use the --kill (-k) switch to prevent that.
================== ===========
command-line ``-S path``

View File

@@ -15,5 +15,5 @@ Example: Set the **Host** header to "example.com" for all requests.
================== =======================
command-line ``--setheader PATTERN``
mitmproxy shortcut :kbd:`o` then :kbd:`H`
mitmproxy shortcut :kbd:`O` then :kbd:`H`
================== =======================

View File

@@ -22,7 +22,7 @@ to interact with the secured resources.
================== ======================
command-line ``-t FILTER``
mitmproxy shortcut :kbd:`o` then :kbd:`t`
mitmproxy shortcut :kbd:`O` then :kbd:`t`
================== ======================
@@ -37,5 +37,5 @@ replay of HTTP Digest authentication.
================== ======================
command-line ``-u FILTER``
mitmproxy shortcut :kbd:`o` then :kbd:`A`
mitmproxy shortcut :kbd:`O` then :kbd:`A`
================== ======================

View File

@@ -3,7 +3,7 @@
TCP Proxy
=========
WebSockets or other non-HTTP protocols are not supported by mitmproxy yet. However, you can exempt
In case mitmproxy does not handle a specific protocol, you can exempt
hostnames from processing, so that mitmproxy acts as a generic TCP forwarder.
This feature is closely related to the :ref:`passthrough` functionality,
but differs in two important aspects:
@@ -19,7 +19,7 @@ How it works
================== ======================
command-line ``--tcp HOST``
mitmproxy shortcut :kbd:`o` then :kbd:`T`
mitmproxy shortcut :kbd:`O` then :kbd:`T`
================== ======================
For a detailed description how the hostname pattern works, please look at the :ref:`passthrough`

View File

@@ -19,5 +19,5 @@ Upstream cert sniffing is on by default, and can optionally be turned off.
================== ======================
command-line ``--no-upstream-cert``
mitmproxy shortcut :kbd:`o` then :kbd:`U`
mitmproxy shortcut :kbd:`O` then :kbd:`U`
================== ======================

View File

@@ -43,7 +43,7 @@ client connects to the proxy and makes a request that looks like this:
CONNECT example.com:443 HTTP/1.1
A conventional proxy can neither view nor manipulate an TLS-encrypted data
A conventional proxy can neither view nor manipulate a TLS-encrypted data
stream, so a CONNECT request simply asks the proxy to open a pipe between the
client and server. The proxy here is just a facilitator - it blindly forwards
data in both directions without knowing anything about the contents. The
@@ -63,7 +63,7 @@ exactly this attack, by allowing a trusted third-party to cryptographically sign
a server's certificates to verify that they are legit. If this signature doesn't
match or is from a non-trusted party, a secure client will simply drop the
connection and refuse to proceed. Despite the many shortcomings of the CA system
as it exists today, this is usually fatal to attempts to MITM an TLS connection
as it exists today, this is usually fatal to attempts to MITM a TLS connection
for analysis. Our answer to this conundrum is to become a trusted Certificate
Authority ourselves. Mitmproxy includes a full CA implementation that generates
interception certificates on the fly. To get the client to trust these
@@ -143,7 +143,7 @@ Lets put all of this together into the complete explicitly proxied HTTPS flow.
2. Mitmproxy responds with a ``200 Connection Established``, as if it has set up the CONNECT pipe.
3. The client believes it's talking to the remote server, and initiates the TLS connection.
It uses SNI to indicate the hostname it is connecting to.
4. Mitmproxy connects to the server, and establishes an TLS connection using the SNI hostname
4. Mitmproxy connects to the server, and establishes a TLS connection using the SNI hostname
indicated by the client.
5. The server responds with the matching certificate, which contains the CN and SAN values
needed to generate the interception certificate.
@@ -217,7 +217,7 @@ explicit HTTPS connections to establish the CN and SANs, and cope with SNI.
destination was.
3. The client believes it's talking to the remote server, and initiates the TLS connection.
It uses SNI to indicate the hostname it is connecting to.
4. Mitmproxy connects to the server, and establishes an TLS connection using the SNI hostname
4. Mitmproxy connects to the server, and establishes a TLS connection using the SNI hostname
indicated by the client.
5. The server responds with the matching certificate, which contains the CN and SAN values
needed to generate the interception certificate.

View File

@@ -17,6 +17,7 @@
mitmproxy
mitmdump
mitmweb
config
.. toctree::
@@ -46,6 +47,7 @@
transparent
transparent/linux
transparent/osx
transparent/openbsd
.. toctree::
:hidden:
@@ -77,10 +79,9 @@
.. toctree::
:hidden:
:caption: Hacking
:caption: Development
dev/architecture
dev/testing
dev/contributing
dev/sslkeylogfile
.. Indices and tables

View File

@@ -3,130 +3,164 @@
Installation
============
.. _install-ubuntu:
Please follow the steps for your operating system.
Installation On Ubuntu
----------------------
Once installation is complete, you can run :ref:`mitmproxy`, :ref:`mitmdump` or
:ref:`mitmweb` from a terminal.
Ubuntu comes with Python but we need to install pip, python-dev and several libraries.
This was tested on a fully patched installation of Ubuntu 14.04.
.. _install-macos:
Installation on macOS
---------------------
You can use Homebrew to install everything:
.. code:: bash
sudo apt-get install python-pip python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev zlib1g-dev g++
sudo pip install mitmproxy # or pip install --user mitmproxy
brew install mitmproxy
Once installation is complete you can run :ref:`mitmproxy` or :ref:`mitmdump` from a terminal.
Or you can download the pre-built binary packages from our `releases`_.
On **Ubuntu 12.04** (and other systems with an outdated version of pip),
you may need to update pip using ``pip install -U pip`` before installing mitmproxy.
Installation From Source (Ubuntu)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _install-windows:
If you would like to install mitmproxy directly from the master branch on GitHub or would like to
get set up to contribute to the project, install the dependencies as you would for a regular
mitmproxy installation (see :ref:`install-ubuntu`).
Then see the Hacking_ section of the README on GitHub.
Installation on Windows
-----------------------
.. _install-fedora:
The recommended way to install mitmproxy on Windows is to use the installer
provided at `mitmproxy.org`_. After installation, you'll find shortcuts for
:ref:`mitmweb` (the web-based interface) and :ref:`mitmdump` in the start menu.
Both executables are added to your PATH and can be invoked from the command
line.
Installation On Fedora
----------------------
.. note::
Mitmproxy's console interface is not supported on Windows, but you can use
mitmweb (the web-based interface) and mitmdump.
Fedora comes with Python but we need to install pip, python-dev and several libraries.
This was tested on a fully patched installation of Fedora 23.
.. _install-linux:
.. code:: bash
Installation on Linux
---------------------
sudo dnf install -y python-pip python-devel libffi-devel openssl-devel libxml2-devel libxslt-devel libpng-devel libjpeg-devel
sudo pip install mitmproxy # or pip install --user mitmproxy
The recommended way to run mitmproxy on Linux is to use the pre-built binaries
provided at `releases`_.
Once installation is complete you can run :ref:`mitmproxy` or :ref:`mitmdump` from a terminal.
Our pre-built binaries provide you with the latest version of mitmproxy, a
self-contained Python 3.5 environment and a recent version of OpenSSL that
supports HTTP/2. Of course, you can also install mitmproxy from source if you
prefer that (see :ref:`install-advanced`).
.. _install-advanced:
Advanced Installation
---------------------
.. _install-docker:
Docker Images
^^^^^^^^^^^^^
You can also use the official mitmproxy images from `DockerHub`_. That being
said, our portable binaries are just as easy to install and even easier to use. 😊
.. _install-arch:
Installation On Arch Linux
--------------------------
Installation on Arch Linux
^^^^^^^^^^^^^^^^^^^^^^^^^^
mitmproxy has been added into the [community] repository. Use pacman to install it:
>>> sudo pacman -S mitmproxy
.. _install-source-ubuntu:
Installation On Mac OS X
------------------------
The easiest way to get up and running on OSX is to download the pre-built binary packages from
`mitmproxy.org`_.
There are a few bits of customization you might want to do to make mitmproxy comfortable to use on
OSX. The default color scheme is optimized for a dark background terminal, but you can select a
palette for a light terminal background with the ``--palette`` option.
You can use the OSX **open** program to create a simple and effective ``~/.mailcap`` file to view
request and response bodies:
.. code-block:: none
application/*; /usr/bin/open -Wn %s
audio/*; /usr/bin/open -Wn %s
image/*; /usr/bin/open -Wn %s
video/*; /usr/bin/open -Wn %s
Once installation is complete you can run :ref:`mitmproxy` or :ref:`mitmdump` from a terminal.
Installation From Source (Mac OS X)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you would like to install mitmproxy directly from the master branch on GitHub or would like to
get set up to contribute to the project, there are a few OS X specific things to keep in mind.
- Make sure that XCode is installed from the App Store, and that the command-line tools have been
downloaded (XCode/Preferences/Downloads).
- If you're running a Python interpreter installed with homebrew (or similar), you may have to
install some dependencies by hand.
Then see the Hacking_ section of the README on GitHub.
Installation On Windows
-----------------------
.. note::
Please note that mitmdump is the only component of mitmproxy that is supported on Windows at
the moment.
**There is no interactive user interface on Windows.**
First, install the latest version of Python 2.7 from the `Python website`_.
If you already have an older version of Python 2.7 installed, make sure to install pip_
(pip is included in Python 2.7.9+ by default). If pip aborts with an error, make sure you are using the current version of pip.
>>> python -m pip install --upgrade pip
Next, add Python and the Python Scripts directory to your **PATH** variable.
You can do this easily by running the following in powershell:
>>> [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27;C:\Python27\Scripts", "User")
Now, you can install mitmproxy by running
>>> pip install mitmproxy
Once the installation is complete, you can run :ref:`mitmdump` from a command prompt.
Installation From Source (Windows)
Installation from Source on Ubuntu
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you would like to install mitmproxy directly from the master branch on GitHub or would like to
get set up to contribute to the project, install Python as outlined above, then see the
Hacking_ section of the README on GitHub.
Ubuntu comes with Python but we need to install pip3, python3-dev and several
libraries. This was tested on a fully patched installation of Ubuntu 16.04.
.. code:: bash
sudo apt-get install python3-dev python3-pip libffi-dev libssl-dev
sudo pip3 install mitmproxy # or pip3 install --user mitmproxy
On older Ubuntu versions, e.g., **12.04** and **14.04**, you may need to install
a newer version of Python. mitmproxy requires Python 3.5 or higher. Please take
a look at pyenv_. Make sure to have an up-to-date version of pip by running
``pip3 install -U pip``.
.. _Hacking: https://github.com/mitmproxy/mitmproxy/blob/master/README.rst#hacking
.. _install-source-fedora:
Installation from Source on Fedora
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Fedora comes with Python but we need to install pip3, python3-dev and several
libraries. This was tested on a fully patched installation of Fedora 24.
.. code:: bash
sudo dnf install make gcc redhat-rpm-config python3-devel python3-pip libffi-devel openssl-devel
sudo pip3 install mitmproxy # or pip3 install --user mitmproxy
Make sure to have an up-to-date version of pip by running ``pip3 install -U pip``.
.. _install-source-opensuse:
Installation from Source on openSUSE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This was tested on a fully patched installation of openSUSE Tumbleweed.
Please note that openSUSE Leap 42.2 only comes with Python 3.4.x, whereas mitmproxy requires Python 3.5 or above.
You can check you Python version by running ``python3 --version``.
.. code:: bash
sudo zypper install python3-pip python3-devel libffi-devel openssl-devel gcc-c++
sudo pip3 install mitmproxy
.. _install-source-windows:
Installation from Source on Windows
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note::
Mitmproxy's console interface is not supported on Windows, but you can use
mitmweb (the web-based interface) and mitmdump.
First, install the latest version of Python 3.5 or later from the `Python
website`_. During installation, make sure to select `Add Python to PATH`.
Mitmproxy has no other dependencies on Windows. You can now install mitmproxy by running
.. code:: powershell
pip3 install mitmproxy
.. _install-dev-version:
Latest Development Version
^^^^^^^^^^^^^^^^^^^^^^^^^^
If you would like to install mitmproxy directly from the master branch on GitHub
or would like to get set up to contribute to the project, install the
dependencies as you would for a regular installation from source. Then see the
project's README_ on GitHub. You can check your system information
by running: ``mitmproxy --version``
.. _README: https://github.com/mitmproxy/mitmproxy/blob/master/README.rst
.. _releases: https://github.com/mitmproxy/mitmproxy/releases
.. _mitmproxy.org: https://mitmproxy.org/
.. _`Python website`: https://www.python.org/downloads/windows/
.. _pip: https://pip.pypa.io/en/latest/installing.html
.. _pyenv: https://github.com/yyuu/pyenv
.. _DockerHub: https://hub.docker.com/r/mitmproxy/mitmproxy/

View File

@@ -6,6 +6,8 @@ with a console interface.
**mitmdump** is the command-line version of mitmproxy. Think tcpdump for HTTP.
**mitmweb** is a web-based interface for mitmproxy.
Documentation, tutorials and distribution packages can be found on the
mitmproxy website: `mitmproxy.org <https://mitmproxy.org/>`_

View File

@@ -66,7 +66,7 @@ At the moment, the Grid Editor is used in four parts of mitmproxy:
- Editing request or response headers (:kbd:`e` for edit, then :kbd:`h` for headers in flow view)
- Editing a query string (:kbd:`e` for edit, then :kbd:`q` for query in flow view)
- Editing a URL-encoded form (:kbd:`e` for edit, then :kbd:`f` for form in flow view)
- Editing replacement patterns (:kbd:`o` for options, then :kbd:`R` for Replacement Patterns)
- Editing replacement patterns (:kbd:`O` for options, then :kbd:`R` for Replacement Patterns)
If there is is no data, an empty editor will be started to let you add some.
Here is the editor showing the headers from a request:

18
docs/mitmweb.rst Normal file
View File

@@ -0,0 +1,18 @@
.. _mitmweb:
.. program:: mitmweb
mitmweb
=======
**mitmweb** is mitmproxy's web-based user interface that allows interactive
examination and modification of HTTP traffic. Like mitmproxy, it differs from
mitmdump in that all flows are kept in memory, which means that it's intended
for taking and manipulating small-ish samples.
.. warning::
Mitmweb is currently in beta. We consider it stable for all features currently
exposed in the UI, but it still misses a lot of mitmproxy's features.
.. image:: screenshots/mitmweb.png

View File

@@ -1,6 +1,6 @@
@build = ./_build
** !_build/** ../netlib/**/*.py ../mitmproxy/**/*.py {
** !_build/** ../mitmproxy/**/*.py {
prep: sphinx-build -W -d @build/doctrees -b html . @build/html
daemon: devd -m @build/html
}

View File

@@ -23,7 +23,7 @@ HTTP Request
mode if the server responds correctly. Apart from that, websocket
requests are just like any other, and all aspects of the request
can be over-ridden.
* - h\:\ :ref:`VALUE`\ =\ :ref:`VALUE`\
* - h\ :ref:`VALUE`\ =\ :ref:`VALUE`\
- Set a header.
* - r
- Set the **raw** flag on this response. Pathod will not calculate a
@@ -73,7 +73,7 @@ HTTP Response
* - m\ :ref:`VALUE`
- HTTP Reason message. Automatically chosen according to the response
code if not specified. (HTTP/1 only)
* - h\:\ :ref:`VALUE`\ =\ :ref:`VALUE`\
* - h\ :ref:`VALUE`\ =\ :ref:`VALUE`\
- Set a header.
* - r
- Set the **raw** flag on this response. Pathod will not calculate a

View File

@@ -14,7 +14,7 @@ The canonical docs can be accessed using pydoc:
>>> pydoc pathod.test
The remainder of this page demonstrates some common interaction patterns using
<a href="http://nose.readthedocs.org/en/latest/">nose</a>. These examples are
`Nose`_. These examples are
also applicable with only minor modification to most commonly used Python testing
engines.
@@ -33,3 +33,6 @@ One instance per test
.. literalinclude:: ../../examples/pathod/test_setup.py
:caption: examples/pathod/test_setup.py
:language: python
.. _Nose: https://nose.readthedocs.org/en/latest/

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -5,36 +5,38 @@ API
===
- Errors
- `mitmproxy.models.flow.Error <#mitmproxy.models.flow.Error>`_
- `mitmproxy.flow.Error <#mitmproxy.flow.Error>`_
- HTTP
- `mitmproxy.models.http.HTTPRequest <#mitmproxy.models.http.HTTPRequest>`_
- `mitmproxy.models.http.HTTPResponse <#mitmproxy.models.http.HTTPResponse>`_
- `mitmproxy.models.http.HTTPFlow <#mitmproxy.models.http.HTTPFlow>`_
- `mitmproxy.http.HTTPRequest <#mitmproxy.http.HTTPRequest>`_
- `mitmproxy.http.HTTPResponse <#mitmproxy.http.HTTPResponse>`_
- `mitmproxy.http.HTTPFlow <#mitmproxy.http.HTTPFlow>`_
- Logging
- `mitmproxy.controller.Log <#mitmproxy.controller.Log>`_
- `mitmproxy.controller.LogEntry <#mitmproxy.controller.LogEntry>`_
- `mitmproxy.log.Log <#mitmproxy.controller.Log>`_
- `mitmproxy.log.LogEntry <#mitmproxy.controller.LogEntry>`_
Errors
------
.. autoclass:: mitmproxy.models.flow.Error
.. autoclass:: mitmproxy.flow.Error
:inherited-members:
HTTP
----
.. autoclass:: mitmproxy.models.http.HTTPRequest
.. autoclass:: mitmproxy.http.HTTPRequest
:inherited-members:
.. autoclass:: mitmproxy.models.http.HTTPResponse
.. autoclass:: mitmproxy.http.HTTPResponse
:inherited-members:
.. autoclass:: mitmproxy.models.http.HTTPFlow
.. autoclass:: mitmproxy.http.HTTPFlow
:inherited-members:
Logging
--------
.. autoclass:: mitmproxy.controller.Log
.. autoclass:: mitmproxy.log.Log
:inherited-members:
.. autoclass:: mitmproxy.log.LogEntry
:inherited-members:

View File

@@ -56,7 +56,7 @@ Connection
connection can correspond to multiple HTTP requests.
*root_layer*
The root layer (see `mitmproxy.protocol` for an explanation what
The root layer (see `mitmproxy.proxy.protocol` for an explanation what
the root layer is), provides transparent access to all attributes
of the :py:class:`~mitmproxy.proxy.RootContext`. For example,
``root_layer.client_conn.address`` gives the remote address of the
@@ -98,6 +98,18 @@ HTTP Events
:widths: 40 60
:header-rows: 0
* - .. py:function:: http_connect(flow)
- Called when we receive an HTTP CONNECT request. Setting a non 2xx
response on the flow will return the response to the client abort the
connection. CONNECT requests and responses do not generate the usual
HTTP handler events. CONNECT requests are only valid in regular and
upstream proxy modes.
*flow*
A ``models.HTTPFlow`` object. The flow is guaranteed to have
non-None ``request`` and ``requestheaders`` attributes.
* - .. py:function:: request(flow)
- Called when a client request has been received.
@@ -146,21 +158,54 @@ HTTP Events
WebSocket Events
-----------------
These events are called only after a connection made an HTTP upgrade with
"101 Switching Protocols". No further HTTP-related events after the handshake
are issued, only new WebSocket messages are called.
.. list-table::
:widths: 40 60
:header-rows: 0
* - .. py:function:: websockets_handshake(flow)
- Called when a client wants to establish a WebSockets connection. The
WebSockets-specific headers can be manipulated to manipulate the
* - .. py:function:: websocket_handshake(flow)
- Called when a client wants to establish a WebSocket connection. The
WebSocket-specific headers can be manipulated to alter the
handshake. The ``flow`` object is guaranteed to have a non-None
``request`` attribute.
*flow*
The flow containing the HTTP websocket handshake request. The
The flow containing the HTTP WebSocket handshake request. The
object is guaranteed to have a non-None ``request`` attribute.
* - .. py:function:: websocket_start(flow)
- Called when WebSocket connection is established after a successful
handshake.
*flow*
A ``models.WebSocketFlow`` object.
* - .. py:function:: websocket_message(flow)
- Called when a WebSocket message is received from the client or server. The
sender and receiver are identifiable. The most recent message will be
``flow.messages[-1]``. The message is user-modifiable. Currently there are
two types of messages, corresponding to the BINARY and TEXT frame types.
*flow*
A ``models.WebSocketFlow`` object.
* - .. py:function:: websocket_end(flow)
- Called when WebSocket connection ends.
*flow*
A ``models.WebSocketFlow`` object.
* - .. py:function:: websocket_error(flow)
- Called when a WebSocket error occurs - e.g. the connection closing
unexpectedly.
*flow*
A ``models.WebSocketFlow`` object.
TCP Events
----------
@@ -173,6 +218,22 @@ connections.
:widths: 40 60
:header-rows: 0
* - .. py:function:: tcp_start(flow)
- Called when TCP streaming starts.
*flow*
A ``models.TCPFlow`` object.
* - .. py:function:: tcp_message(flow)
- Called when a TCP payload is received from the client or server. The
sender and receiver are identifiable. The most recent message will be
``flow.messages[-1]``. The message is user-modifiable.
*flow*
A ``models.TCPFlow`` object.
* - .. py:function:: tcp_end(flow)
- Called when TCP streaming ends.
@@ -185,18 +246,3 @@ connections.
*flow*
A ``models.TCPFlow`` object.
* - .. py:function:: tcp_message(flow)
- Called a TCP payload is received from the client or server. The
sender and receiver are identifiable. The most recent message will be
``flow.messages[-1]``. The message is user-modifiable.
*flow*
A ``models.TCPFlow`` object.
* - .. py:function:: tcp_start(flow)
- Called when TCP streaming starts.
*flow*
A ``models.TCPFlow`` object.

View File

@@ -6,7 +6,7 @@ Overview
Mitmproxy has a powerful scripting API that allows you to control almost any
aspect of traffic being proxied. In fact, much of mitmproxy's own core
functionality is implemented using the exact same API exposed to scripters (see
:src:`mitmproxy/builtins`).
:src:`mitmproxy/addons`).
A simple example
@@ -17,8 +17,8 @@ appropriate points of mitmproxy's operation. Here's a complete mitmproxy script
that adds a new header to every HTTP response before it is returned to the
client:
.. literalinclude:: ../../examples/add_header.py
:caption: :src:`examples/add_header.py`
.. literalinclude:: ../../examples/simple/add_header.py
:caption: :src:`examples/simple/add_header.py`
:language: python
All events that deal with an HTTP request get an instance of `HTTPFlow
@@ -29,6 +29,12 @@ will be added to all responses passing through the proxy:
>>> mitmdump -s add_header.py
Examples
--------
A collection of addons that demonstrate popular features can be found at :src:`examples/simple`.
Using classes
-------------
@@ -42,8 +48,8 @@ called before anything else happens. You can replace the current script object
by returning it from this handler. Here's how this looks when applied to the
example above:
.. literalinclude:: ../../examples/classes.py
:caption: :src:`examples/classes.py`
.. literalinclude:: ../../examples/simple/add_header_class.py
:caption: :src:`examples/simple/add_header_class.py`
:language: python
So here, we're using a module-level script to "boot up" into a class instance.
@@ -54,39 +60,23 @@ and is replaced by the class instance.
Handling arguments
------------------
Scripts can handle their own command-line arguments, just like any other Python
program. Let's build on the example above to do something slightly more
sophisticated - replace one value with another in all responses. Mitmproxy's
`HTTPRequest <api.html#mitmproxy.models.http.HTTPRequest>`_ and `HTTPResponse
<api.html#mitmproxy.models.http.HTTPResponse>`_ objects have a handy `replace
<api.html#mitmproxy.models.http.HTTPResponse.replace>`_ method that takes care
of all the details for us.
.. literalinclude:: ../../examples/arguments.py
:caption: :src:`examples/arguments.py`
:language: python
We can now call this script on the command-line like this:
>>> mitmdump -dd -s "./arguments.py html faketml"
Whenever a handler is called, mitpmroxy rewrites the script environment so that
it sees its own arguments as if it was invoked from the command-line.
FIXME
Logging and the context
-----------------------
Scripts should not output straight to stderr or stdout. Instead, the `log
<api.html#mitmproxy.controller.Log>`_ object on the ``ctx`` contexzt module
<api.html#mitmproxy.controller.Log>`_ object on the ``ctx`` context module
should be used, so that the mitmproxy host program can handle output
appropriately. So, mitmdump can print colorised sript output to the terminal,
appropriately. So, mitmdump can print colorised script output to the terminal,
and mitmproxy console can place script output in the event buffer.
Here's how this looks:
.. literalinclude:: ../../examples/logging.py
:caption: :src:`examples/logging.py`
.. literalinclude:: ../../examples/simple/log_events.py
:caption: :src:`examples/simple/log_events.py`
:language: python
The ``ctx`` module also exposes the mitmproxy master object at ``ctx.master``
@@ -126,15 +116,32 @@ It's possible to implement a concurrent mechanism on top of the blocking
framework, and mitmproxy includes a handy example of this that is fit for most
purposes. You can use it as follows:
.. literalinclude:: ../../examples/nonblocking.py
:caption: :src:`examples/nonblocking.py`
.. literalinclude:: ../../examples/complex/nonblocking.py
:caption: :src:`examples/complex/nonblocking.py`
:language: python
Testing
-------
Mitmproxy includes a number of helpers for testing addons. The
``mitmproxy.test.taddons`` module contains a context helper that takes care of
setting up and tearing down the addon event context. The
``mitmproxy.test.tflow`` module contains helpers for quickly creating test
flows. Pydoc is the canonical reference for these modules, and mitmproxy's own
test suite is an excellent source of examples of usage. Here, for instance, is
the mitmproxy unit tests for the `anticache` option, demonstrating a good
cross-section of the test helpers:
.. literalinclude:: ../../test/mitmproxy/addons/test_anticache.py
:caption: :src:`test/mitmproxy/addons/test_anticache.py`
:language: python
Developing scripts
------------------
Mitmprxoy monitors scripts for modifications, and reloads them on change. When
Mitmproxy monitors scripts for modifications, and reloads them on change. When
this happens, the script is shut down (the `done <events.html#done>`_ event is
called), and the new instance is started up as if the script had just been
loaded (the `start <events.html#start>`_ and `configure

View File

@@ -27,7 +27,7 @@ Fully transparent mode
By default mitmproxy will use its own local ip address for its server-side connections.
In case this isn't desired, the --spoof-source-address argument can be used to
use the client's ip address for server-side connections. The following config is
required for this mode to work:
required for this mode to work::
CLIENT_NET=192.168.1.0/24
TABLE_ID=100
@@ -42,9 +42,9 @@ required for this mode to work:
This mode does require root privileges though. There's a wrapper in the examples directory
called 'mitmproxy_shim.c', which will enable you to use this mode with dropped priviliges.
It can be used as follows:
It can be used as follows::
gcc examples/mitmproxy_shim.c -o mitmproxy_shim -lcap
gcc examples/complex/full_transparency_shim.c -o mitmproxy_shim -lcap
sudo chown root:root mitmproxy_shim
sudo chmod u+s mitmproxy_shim
./mitmproxy_shim $(which mitmproxy) -T --spoof-source-address

View File

@@ -0,0 +1,53 @@
.. _openbsd:
OpenBSD
=======
1. :ref:`Install the mitmproxy certificate on the test device <certinstall>`
2. Enable IP forwarding:
>>> sudo sysctl -w net.inet.ip.forwarding=1
3. Place the following two lines in **/etc/pf.conf**:
.. code-block:: none
mitm_if = "re2"
pass in quick proto tcp from $mitm_if to port { 80, 443 } divert-to 127.0.0.1 port 8080
These rules tell pf to divert all traffic from ``$mitm_if`` destined for
port 80 or 443 to the local mitmproxy instance running on port 8080. You
should replace ``$mitm_if`` value with the interface on which your test
device will appear.
4. Configure pf with the rules:
>>> doas pfctl -f /etc/pf.conf
5. And now enable it:
>>> doas pfctl -e
6. Fire up mitmproxy. You probably want a command like this:
>>> mitmproxy -T --host
The ``-T`` flag turns on transparent mode, and the ``--host``
argument tells mitmproxy to use the value of the Host header for URL display.
7. Finally, configure your test device to use the host on which mitmproxy is
running as the default gateway.
.. note::
Note that the **divert-to** rules in the pf.conf given above only apply to
inbound traffic. **This means that they will NOT redirect traffic coming
from the box running pf itself.** We can't distinguish between an outbound
connection from a non-mitmproxy app, and an outbound connection from
mitmproxy itself - if you want to intercept your traffic, you should use an
external host to run mitmproxy. Nonetheless, pf is flexible to cater for a
range of creative possibilities, like intercepting traffic emanating from
VMs. See the **pf.conf** man page for more.
.. _pf: http://man.openbsd.org/OpenBSD-current/man5/pf.conf.5

View File

@@ -63,7 +63,7 @@ Note that this means we don't support transparent mode for earlier versions of O
running pf itself.** We can't distinguish between an outbound connection from a
non-mitmproxy app, and an outbound connection from mitmproxy itself - if you
want to intercept your OSX traffic, you should use an external host to run
mitmproxy. None the less, pf is flexible to cater for a range of creative
mitmproxy. Nonetheless, pf is flexible to cater for a range of creative
possibilities, like intercepting traffic emanating from VMs. See the
**pf.conf** man page for more.

View File

@@ -38,8 +38,14 @@ DHCP and TFTP) services to a small-scale network.
**Ubuntu >12.04** runs an internal dnsmasq instance (listening on loopback only) by default
`[1] <https://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/>`_. For our use case, this needs
to be disabled by changing ``dns=dnsmasq`` to ``#dns=dnsmasq`` in
**/etc/NetworkManager/NetworkManager.conf** and running
**/etc/NetworkManager/NetworkManager.conf** and
if on Ubuntu 16.04 or newer running:
>>> sudo systemctl restart NetworkManager
if on Ubuntu 12.04 or 14.04 running:
>>> sudo restart network-manager
afterwards.
@@ -61,6 +67,12 @@ DHCP and TFTP) services to a small-scale network.
Apply changes:
if on Ubuntu 16.04 or newer:
>>> sudo systemctl restart dnsmasq
if on Ubuntu 12.04 or 14.04:
>>> sudo service dnsmasq restart
Your **proxied machine** in the internal virtual network should now receive an IP address via DHCP:
@@ -74,8 +86,8 @@ To redirect traffic to mitmproxy, we need to add two iptables rules:
.. code-block:: none
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8080
4. Run mitmproxy
----------------

View File

@@ -1,31 +0,0 @@
Some inline scripts may require additional dependencies, which can be installed using
`pip install mitmproxy[examples]`.
# inline script examples
add_header.py Simple script that just adds a header to every request.
change_upstream_proxy.py Dynamically change the upstream proxy
dns_spoofing.py Use mitmproxy in a DNS spoofing scenario.
dup_and_replay.py Duplicates each request, changes it, and then replays the modified request.
fail_with_500.py Turn every response into an Internal Server Error.
filt.py Use mitmproxy's filter expressions in your script.
flowwriter.py Only write selected flows into a mitmproxy dumpfile.
iframe_injector.py Inject configurable iframe into pages.
modify_form.py Modify all form submissions to add a parameter.
modify_querystring.py Modify all query strings to add a parameters.
modify_response_body.py Replace arbitrary strings in all responses
nonblocking.py Demonstrate parallel processing with a blocking script.
proxapp.py How to embed a WSGI app in a mitmproxy server
redirect_requests.py Redirect requests or directly reply to them.
stub.py Script stub with a method definition for every event.
upsidedownternet.py Rewrites traffic to turn images upside down.
# mitmproxy examples
flowbasic Basic use of mitmproxy as a library.
stickycookies An example of writing a custom proxy with mitmproxy.
# misc
read_dumpfile Read a dumpfile generated by mitmproxy.
mitmproxywrapper.py Bracket mitmproxy run with proxy enable/disable on OS X

15
examples/README.md Normal file
View File

@@ -0,0 +1,15 @@
# Mitmproxy Scripting API
Mitmproxy has a powerful scripting API that allows you to control almost any aspect of traffic being
proxied. In fact, much of mitmproxys own core functionality is implemented using the exact same API
exposed to scripters (see [mitmproxy/addons](../mitmproxy/addons)).
This directory contains some examples of the scripting API. We recommend to start with the
ones in [simple/](./simple).
| :warning: | If you are browsing this on GitHub, make sure to select the git tag matching your mitmproxy version. |
|------------|------------------------------------------------------------------------------------------------------|
Some inline scripts may require additional dependencies, which can be installed using
`pip install mitmproxy[examples]`.

View File

@@ -1,2 +0,0 @@
def response(flow):
flow.response.headers["newheader"] = "foo"

View File

@@ -1,17 +0,0 @@
import argparse
class Replacer:
def __init__(self, src, dst):
self.src, self.dst = src, dst
def response(self, flow):
flow.response.replace(self.src, self.dst)
def start():
parser = argparse.ArgumentParser()
parser.add_argument("src", type=str)
parser.add_argument("dst", type=str)
args = parser.parse_args()
return Replacer(args.src, args.dst)

View File

@@ -1,7 +0,0 @@
class AddHeader:
def response(self, flow):
flow.response.headers["newheader"] = "foo"
def start():
return AddHeader()

View File

@@ -0,0 +1,18 @@
## Complex Examples
| Filename | Description |
|:-------------------------|:----------------------------------------------------------------------------------------------|
| change_upstream_proxy.py | Dynamically change the upstream proxy. |
| dns_spoofing.py | Use mitmproxy in a DNS spoofing scenario. |
| dup_and_replay.py | Duplicates each request, changes it, and then replays the modified request. |
| full_transparency_shim.c | Setuid wrapper that can be used to run mitmproxy in full transparency mode, as a normal user. |
| har_dump.py | Dump flows as HAR files. |
| mitmproxywrapper.py | Bracket mitmproxy run with proxy enable/disable on OS X |
| nonblocking.py | Demonstrate parallel processing with a blocking script |
| remote_debug.py | This script enables remote debugging of the mitmproxy _UI_ with PyCharm. |
| sslstrip.py | sslstrip-like funtionality implemented with mitmproxy |
| stream.py | Enable streaming for all responses. |
| stream_modify.py | Modify a streamed response body. |
| tcp_message.py | Modify a raw TCP connection |
| tls_passthrough.py | Use conditional TLS interception based on a user-defined strategy. |
| xss_scanner.py | Scan all visited webpages. |

View File

@@ -0,0 +1,57 @@
"""
This script makes it possible to use mitmproxy in scenarios where IP spoofing
has been used to redirect connections to mitmproxy. The way this works is that
we rely on either the TLS Server Name Indication (SNI) or the Host header of the
HTTP request. Of course, this is not foolproof - if an HTTPS connection comes
without SNI, we don't know the actual target and cannot construct a certificate
that looks valid. Similarly, if there's no Host header or a spoofed Host header,
we're out of luck as well. Using transparent mode is the better option most of
the time.
Usage:
mitmproxy
-p 443
-s dns_spoofing.py
# Used as the target location if neither SNI nor host header are present.
-R http://example.com/
# To avoid auto rewriting of host header by the reverse proxy target.
--keep-host-header
mitmdump
-p 80
-R http://localhost:443/
(Setting up a single proxy instance and using iptables to redirect to it
works as well)
"""
import re
# This regex extracts splits the host header into host and port.
# Handles the edge case of IPv6 addresses containing colons.
# https://bugzilla.mozilla.org/show_bug.cgi?id=45891
parse_host_header = re.compile(r"^(?P<host>[^:]+|\[.+\])(?::(?P<port>\d+))?$")
class Rerouter:
def request(self, flow):
if flow.client_conn.ssl_established:
flow.request.scheme = "https"
sni = flow.client_conn.connection.get_servername()
port = 443
else:
flow.request.scheme = "http"
sni = None
port = 80
host_header = flow.request.host_header
m = parse_host_header.match(host_header)
if m:
host_header = m.group("host").strip("[]")
if m.group("port"):
port = int(m.group("port"))
flow.request.host_header = host_header
flow.request.host = sni or host_header
flow.request.port = port
addons = [Rerouter()]

View File

@@ -2,5 +2,7 @@ from mitmproxy import ctx
def request(flow):
f = ctx.master.duplicate_flow(flow)
f = flow.copy()
ctx.master.view.add(f)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True)

View File

@@ -3,20 +3,20 @@ This inline script can be used to dump flows as HAR files.
"""
import pprint
import json
import sys
import base64
import zlib
import os
from datetime import datetime
import pytz
from datetime import timezone
import mitmproxy
from netlib import version
from netlib import strutils
from netlib.http import cookies
from mitmproxy import version
from mitmproxy import ctx
from mitmproxy.utils import strutils
from mitmproxy.net.http import cookies
HAR = {}
@@ -25,17 +25,13 @@ HAR = {}
SERVERS_SEEN = set()
def start():
"""
Called once on script startup before any other events.
"""
if len(sys.argv) != 2:
raise ValueError(
'Usage: -s "har_dump.py filename" '
'(- will output to stdout, filenames ending with .zhar '
'will result in compressed har)'
)
def load(l):
l.add_option(
"hardump", str, "", "HAR dump path.",
)
def configure(updated):
HAR.update({
"log": {
"version": "1.2",
@@ -89,7 +85,7 @@ def response(flow):
# Timings set to -1 will be ignored as per spec.
full_time = sum(v for v in timings.values() if v > -1)
started_date_time = format_datetime(datetime.utcfromtimestamp(flow.request.timestamp_start))
started_date_time = datetime.fromtimestamp(flow.request.timestamp_start, timezone.utc).isoformat()
# Response body size and encoding
response_body_size = len(flow.response.raw_content)
@@ -128,23 +124,26 @@ def response(flow):
"timings": timings,
}
# Store binay data as base64
# Store binary data as base64
if strutils.is_mostly_bin(flow.response.content):
b64 = base64.b64encode(flow.response.content)
entry["response"]["content"]["text"] = b64.decode('ascii')
entry["response"]["content"]["text"] = base64.b64encode(flow.response.content).decode()
entry["response"]["content"]["encoding"] = "base64"
else:
entry["response"]["content"]["text"] = flow.response.text
entry["response"]["content"]["text"] = flow.response.get_text(strict=False)
if flow.request.method in ["POST", "PUT", "PATCH"]:
params = [
{"name": a, "value": b}
for a, b in flow.request.urlencoded_form.items(multi=True)
]
entry["request"]["postData"] = {
"mimeType": flow.request.headers.get("Content-Type", "").split(";")[0],
"text": flow.request.content,
"params": name_value(flow.request.urlencoded_form)
"mimeType": flow.request.headers.get("Content-Type", ""),
"text": flow.request.get_text(strict=False),
"params": params
}
if flow.server_conn:
entry["serverIPAddress"] = str(flow.server_conn.ip_address.address[0])
if flow.server_conn.connected():
entry["serverIPAddress"] = str(flow.server_conn.ip_address[0])
HAR["log"]["entries"].append(entry)
@@ -153,24 +152,20 @@ def done():
"""
Called once on script shutdown, after any other events.
"""
dump_file = sys.argv[1]
if ctx.options.hardump:
json_dump = json.dumps(HAR, indent=2) # type: str
if dump_file == '-':
mitmproxy.ctx.log(pprint.pformat(HAR))
else:
json_dump = json.dumps(HAR, indent=2)
if ctx.options.hardump == '-':
mitmproxy.ctx.log(json_dump)
else:
raw = json_dump.encode() # type: bytes
if ctx.options.hardump.endswith('.zhar'):
raw = zlib.compress(raw, 9)
if dump_file.endswith('.zhar'):
json_dump = zlib.compress(json_dump, 9)
with open(os.path.expanduser(ctx.options.hardump), "wb") as f:
f.write(raw)
with open(dump_file, "w") as f:
f.write(json_dump)
mitmproxy.ctx.log("HAR dump finished (wrote %s bytes to file)" % len(json_dump))
def format_datetime(dt):
return dt.replace(tzinfo=pytz.timezone("UTC")).isoformat()
mitmproxy.ctx.log("HAR dump finished (wrote %s bytes to file)" % len(json_dump))
def format_cookies(cookie_list):
@@ -194,7 +189,7 @@ def format_cookies(cookie_list):
# Expiration time needs to be formatted
expire_ts = cookies.get_expiration_ts(attrs)
if expire_ts is not None:
cookie_har["expires"] = format_datetime(datetime.fromtimestamp(expire_ts))
cookie_har["expires"] = datetime.fromtimestamp(expire_ts, timezone.utc).isoformat()
rv.append(cookie_har)
@@ -206,7 +201,7 @@ def format_request_cookies(fields):
def format_response_cookies(fields):
return format_cookies((c[0], c[1].value, c[1].attrs) for c in fields)
return format_cookies((c[0], c[1][0], c[1][1]) for c in fields)
def name_value(obj):

View File

@@ -15,7 +15,7 @@ import os
import sys
class Wrapper(object):
class Wrapper:
def __init__(self, port, extra_arguments=None):
self.port = port
self.extra_arguments = extra_arguments

View File

@@ -0,0 +1,11 @@
import time
from mitmproxy.script import concurrent
@concurrent # Remove this and see what happens
def request(flow):
# You don't want to use mitmproxy.ctx from a different thread
print("handle request: %s%s" % (flow.request.host, flow.request.path))
time.sleep(5)
print("start request: %s%s" % (flow.request.host, flow.request.path))

View File

@@ -14,6 +14,6 @@ Usage:
"""
def start():
def load(l):
import pydevd
pydevd.settrace("localhost", port=5678, stdoutToServer=True, stderrToServer=True)

View File

@@ -1,5 +1,9 @@
"""
This script implements an sslstrip-like attack based on mitmproxy.
https://moxie.org/software/sslstrip/
"""
import re
from six.moves import urllib
import urllib
# set of SSL/TLS capable hosts
secure_hosts = set()
@@ -17,13 +21,18 @@ def request(flow):
flow.request.scheme = 'https'
flow.request.port = 443
# We need to update the request destination to whatever is specified in the host header:
# Having no TLS Server Name Indication from the client and just an IP address as request.host
# in transparent mode, TLS server name certificate validation would fail.
flow.request.host = flow.request.pretty_host
def response(flow):
flow.response.headers.pop('Strict-Transport-Security', None)
flow.response.headers.pop('Public-Key-Pins', None)
# strip links in response body
flow.response.content = flow.response.content.replace('https://', 'http://')
flow.response.content = flow.response.content.replace(b'https://', b'http://')
# strip meta tag upgrade-insecure-requests in response body
csp_meta_tag_pattern = b'<meta.*http-equiv=["\']Content-Security-Policy[\'"].*upgrade-insecure-requests.*?>'

View File

@@ -1,5 +1,6 @@
def responseheaders(flow):
"""
Enables streaming for all responses.
This is equivalent to passing `--stream 0` to mitmproxy.
"""
flow.response.stream = True

View File

@@ -8,7 +8,7 @@ tcp_message Inline Script Hook API Demonstration
example cmdline invocation:
mitmdump -T --host --tcp ".*" -q -s examples/tcp_message.py
"""
from netlib import strutils
from mitmproxy.utils import strutils
def tcp_message(tcp_msg):

View File

@@ -20,16 +20,15 @@ Example:
Authors: Maximilian Hils, Matthew Tuusberg
"""
from __future__ import absolute_import, print_function, division
import collections
import random
import sys
from enum import Enum
import mitmproxy
from mitmproxy import ctx
from mitmproxy.exceptions import TlsProtocolException
from mitmproxy.protocol import TlsLayer, RawTCPLayer
from mitmproxy.proxy.protocol import TlsLayer, RawTCPLayer
class InterceptionResult(Enum):
@@ -38,7 +37,7 @@ class InterceptionResult(Enum):
skipped = None
class _TlsStrategy(object):
class _TlsStrategy:
"""
Abstract base class for interception strategies.
"""
@@ -113,10 +112,16 @@ class TlsFeedback(TlsLayer):
tls_strategy = None
def start():
def load(l):
l.add_option(
"tlsstrat", int, 0, "TLS passthrough strategy (0-100)",
)
def configure(updated):
global tls_strategy
if len(sys.argv) == 2:
tls_strategy = ProbabilisticStrategy(float(sys.argv[1]))
if ctx.options.tlsstrat > 0:
tls_strategy = ProbabilisticStrategy(float(ctx.options.tlsstrat) / 100.0)
else:
tls_strategy = ConservativeStrategy()

407
examples/complex/xss_scanner.py Executable file
View File

@@ -0,0 +1,407 @@
"""
__ __ _____ _____ _____
\ \ / // ____/ ____| / ____|
\ V /| (___| (___ | (___ ___ __ _ _ __ _ __ ___ _ __
> < \___ \\___ \ \___ \ / __/ _` | '_ \| '_ \ / _ \ '__|
/ . \ ____) |___) | ____) | (_| (_| | | | | | | | __/ |
/_/ \_\_____/_____/ |_____/ \___\__,_|_| |_|_| |_|\___|_|
This script automatically scans all visited webpages for XSS and SQLi vulnerabilities.
Usage: mitmproxy -s xss_scanner.py
This script scans for vulnerabilities by injecting a fuzzing payload (see PAYLOAD below) into 4 different places
and examining the HTML to look for XSS and SQLi injection vulnerabilities. The XSS scanning functionality works by
looking to see whether it is possible to inject HTML based off of of where the payload appears in the page and what
characters are escaped. In addition, it also looks for any script tags that load javascript from unclaimed domains.
The SQLi scanning functionality works by using regular expressions to look for errors from a number of different
common databases. Since it is only looking for errors, it will not find blind SQLi vulnerabilities.
The 4 places it injects the payload into are:
1. URLs (e.g. https://example.com/ -> https://example.com/PAYLOAD/)
2. Queries (e.g. https://example.com/index.html?a=b -> https://example.com/index.html?a=PAYLOAD)
3. Referers (e.g. The referer changes from https://example.com to PAYLOAD)
4. User Agents (e.g. The UA changes from Chrome to PAYLOAD)
Reports from this script show up in the event log (viewable by pressing e) and formatted like:
===== XSS Found ====
XSS URL: http://daviddworken.com/vulnerableUA.php
Injection Point: User Agent
Suggested Exploit: <script>alert(0)</script>
Line: 1029zxcs'd"ao<ac>so[sb]po(pc)se;sl/bsl\eq=3847asd
"""
from mitmproxy import ctx
from socket import gaierror, gethostbyname
from urllib.parse import urlparse
import requests
import re
from html.parser import HTMLParser
from mitmproxy import http
from typing import Dict, Union, Tuple, Optional, List, NamedTuple
# The actual payload is put between a frontWall and a backWall to make it easy
# to locate the payload with regular expressions
FRONT_WALL = b"1029zxc"
BACK_WALL = b"3847asd"
PAYLOAD = b"""s'd"ao<ac>so[sb]po(pc)se;sl/bsl\\eq="""
FULL_PAYLOAD = FRONT_WALL + PAYLOAD + BACK_WALL
# A XSSData is a named tuple with the following fields:
# - url -> str
# - injection_point -> str
# - exploit -> str
# - line -> str
XSSData = NamedTuple('XSSData', [('url', str),
('injection_point', str),
('exploit', str),
('line', str)])
# A SQLiData is named tuple with the following fields:
# - url -> str
# - injection_point -> str
# - regex -> str
# - dbms -> str
SQLiData = NamedTuple('SQLiData', [('url', str),
('injection_point', str),
('regex', str),
('dbms', str)])
VulnData = Tuple[Optional[XSSData], Optional[SQLiData]]
Cookies = Dict[str, str]
def get_cookies(flow: http.HTTPFlow) -> Cookies:
""" Return a dict going from cookie names to cookie values
- Note that it includes both the cookies sent in the original request and
the cookies sent by the server """
return {name: value for name, value in flow.request.cookies.fields}
def find_unclaimed_URLs(body: Union[str, bytes], requestUrl: bytes) -> None:
""" Look for unclaimed URLs in script tags and log them if found"""
class ScriptURLExtractor(HTMLParser):
script_URLs = []
def handle_starttag(self, tag, attrs):
if tag == "script" and "src" in [name for name, value in attrs]:
for name, value in attrs:
if name == "src":
self.script_URLs.append(value)
parser = ScriptURLExtractor()
try:
parser.feed(body)
except TypeError:
parser.feed(body.decode('utf-8'))
for url in parser.script_URLs:
parser = urlparse(url)
domain = parser.netloc
try:
gethostbyname(domain)
except gaierror:
ctx.log.error("XSS found in %s due to unclaimed URL \"%s\" in script tag." % (requestUrl, url))
def test_end_of_URL_injection(original_body: str, request_URL: str, cookies: Cookies) -> VulnData:
""" Test the given URL for XSS via injection onto the end of the URL and
log the XSS if found """
parsed_URL = urlparse(request_URL)
path = parsed_URL.path
if path != "" and path[-1] != "/": # ensure the path ends in a /
path += "/"
path += FULL_PAYLOAD.decode('utf-8') # the path must be a string while the payload is bytes
url = parsed_URL._replace(path=path).geturl()
body = requests.get(url, cookies=cookies).text.lower()
xss_info = get_XSS_data(body, url, "End of URL")
sqli_info = get_SQLi_data(body, original_body, url, "End of URL")
return xss_info, sqli_info
def test_referer_injection(original_body: str, request_URL: str, cookies: Cookies) -> VulnData:
""" Test the given URL for XSS via injection into the referer and
log the XSS if found """
body = requests.get(request_URL, headers={'referer': FULL_PAYLOAD}, cookies=cookies).text.lower()
xss_info = get_XSS_data(body, request_URL, "Referer")
sqli_info = get_SQLi_data(body, original_body, request_URL, "Referer")
return xss_info, sqli_info
def test_user_agent_injection(original_body: str, request_URL: str, cookies: Cookies) -> VulnData:
""" Test the given URL for XSS via injection into the user agent and
log the XSS if found """
body = requests.get(request_URL, headers={'User-Agent': FULL_PAYLOAD}, cookies=cookies).text.lower()
xss_info = get_XSS_data(body, request_URL, "User Agent")
sqli_info = get_SQLi_data(body, original_body, request_URL, "User Agent")
return xss_info, sqli_info
def test_query_injection(original_body: str, request_URL: str, cookies: Cookies):
""" Test the given URL for XSS via injection into URL queries and
log the XSS if found """
parsed_URL = urlparse(request_URL)
query_string = parsed_URL.query
# queries is a list of parameters where each parameter is set to the payload
queries = [query.split("=")[0] + "=" + FULL_PAYLOAD.decode('utf-8') for query in query_string.split("&")]
new_query_string = "&".join(queries)
new_URL = parsed_URL._replace(query=new_query_string).geturl()
body = requests.get(new_URL, cookies=cookies).text.lower()
xss_info = get_XSS_data(body, new_URL, "Query")
sqli_info = get_SQLi_data(body, original_body, new_URL, "Query")
return xss_info, sqli_info
def log_XSS_data(xss_info: Optional[XSSData]) -> None:
""" Log information about the given XSS to mitmproxy """
# If it is None, then there is no info to log
if not xss_info:
return
ctx.log.error("===== XSS Found ====")
ctx.log.error("XSS URL: %s" % xss_info.url)
ctx.log.error("Injection Point: %s" % xss_info.injection_point)
ctx.log.error("Suggested Exploit: %s" % xss_info.exploit)
ctx.log.error("Line: %s" % xss_info.line)
def log_SQLi_data(sqli_info: Optional[SQLiData]) -> None:
""" Log information about the given SQLi to mitmproxy """
if not sqli_info:
return
ctx.log.error("===== SQLi Found =====")
ctx.log.error("SQLi URL: %s" % sqli_info.url.decode('utf-8'))
ctx.log.error("Injection Point: %s" % sqli_info.injection_point.decode('utf-8'))
ctx.log.error("Regex used: %s" % sqli_info.regex.decode('utf-8'))
ctx.log.error("Suspected DBMS: %s" % sqli_info.dbms.decode('utf-8'))
def get_SQLi_data(new_body: str, original_body: str, request_URL: str, injection_point: str) -> Optional[SQLiData]:
""" Return a SQLiDict if there is a SQLi otherwise return None
String String URL String -> (SQLiDict or None) """
# Regexes taken from Damn Small SQLi Scanner: https://github.com/stamparm/DSSS/blob/master/dsss.py#L17
DBMS_ERRORS = {
"MySQL": (r"SQL syntax.*MySQL", r"Warning.*mysql_.*", r"valid MySQL result", r"MySqlClient\."),
"PostgreSQL": (r"PostgreSQL.*ERROR", r"Warning.*\Wpg_.*", r"valid PostgreSQL result", r"Npgsql\."),
"Microsoft SQL Server": (r"Driver.* SQL[\-\_\ ]*Server", r"OLE DB.* SQL Server", r"(\W|\A)SQL Server.*Driver",
r"Warning.*mssql_.*", r"(\W|\A)SQL Server.*[0-9a-fA-F]{8}",
r"(?s)Exception.*\WSystem\.Data\.SqlClient\.", r"(?s)Exception.*\WRoadhouse\.Cms\."),
"Microsoft Access": (r"Microsoft Access Driver", r"JET Database Engine", r"Access Database Engine"),
"Oracle": (r"\bORA-[0-9][0-9][0-9][0-9]", r"Oracle error", r"Oracle.*Driver", r"Warning.*\Woci_.*", r"Warning.*\Wora_.*"),
"IBM DB2": (r"CLI Driver.*DB2", r"DB2 SQL error", r"\bdb2_\w+\("),
"SQLite": (r"SQLite/JDBCDriver", r"SQLite.Exception", r"System.Data.SQLite.SQLiteException", r"Warning.*sqlite_.*",
r"Warning.*SQLite3::", r"\[SQLITE_ERROR\]"),
"Sybase": (r"(?i)Warning.*sybase.*", r"Sybase message", r"Sybase.*Server message.*"),
}
for dbms, regexes in DBMS_ERRORS.items():
for regex in regexes:
if re.search(regex, new_body) and not re.search(regex, original_body):
return SQLiData(request_URL,
injection_point,
regex,
dbms)
# A qc is either ' or "
def inside_quote(qc: str, substring: bytes, text_index: int, body: bytes) -> bool:
""" Whether the Numberth occurence of the first string in the second
string is inside quotes as defined by the supplied QuoteChar """
substring = substring.decode('utf-8')
body = body.decode('utf-8')
num_substrings_found = 0
in_quote = False
for index, char in enumerate(body):
# Whether the next chunk of len(substring) chars is the substring
next_part_is_substring = (
(not (index + len(substring) > len(body))) and
(body[index:index + len(substring)] == substring)
)
# Whether this char is escaped with a \
is_not_escaped = (
(index - 1 < 0 or index - 1 > len(body)) or
(body[index - 1] != "\\")
)
if char == qc and is_not_escaped:
in_quote = not in_quote
if next_part_is_substring:
if num_substrings_found == text_index:
return in_quote
num_substrings_found += 1
return False
def paths_to_text(html: str, str: str) -> List[str]:
""" Return list of Paths to a given str in the given HTML tree
- Note that it does a BFS """
def remove_last_occurence_of_sub_string(str: str, substr: str):
""" Delete the last occurence of substr from str
String String -> String
"""
index = str.rfind(substr)
return str[:index] + str[index + len(substr):]
class PathHTMLParser(HTMLParser):
currentPath = ""
paths = []
def handle_starttag(self, tag, attrs):
self.currentPath += ("/" + tag)
def handle_endtag(self, tag):
self.currentPath = remove_last_occurence_of_sub_string(self.currentPath, "/" + tag)
def handle_data(self, data):
if str in data:
self.paths.append(self.currentPath)
parser = PathHTMLParser()
parser.feed(html)
return parser.paths
def get_XSS_data(body: str, request_URL: str, injection_point: str) -> Optional[XSSData]:
""" Return a XSSDict if there is a XSS otherwise return None """
def in_script(text, index, body) -> bool:
""" Whether the Numberth occurence of the first string in the second
string is inside a script tag """
paths = paths_to_text(body.decode('utf-8'), text.decode("utf-8"))
try:
path = paths[index]
return "script" in path
except IndexError:
return False
def in_HTML(text: bytes, index: int, body: bytes) -> bool:
""" Whether the Numberth occurence of the first string in the second
string is inside the HTML but not inside a script tag or part of
a HTML attribute"""
# if there is a < then lxml will interpret that as a tag, so only search for the stuff before it
text = text.split(b"<")[0]
paths = paths_to_text(body.decode('utf-8'), text.decode("utf-8"))
try:
path = paths[index]
return "script" not in path
except IndexError:
return False
def inject_javascript_handler(html: str) -> bool:
""" Whether you can inject a Javascript:alert(0) as a link """
class injectJSHandlerHTMLParser(HTMLParser):
injectJSHandler = False
def handle_starttag(self, tag, attrs):
for name, value in attrs:
if name == "href" and value.startswith(FRONT_WALL.decode('utf-8')):
self.injectJSHandler = True
parser = injectJSHandlerHTMLParser()
parser.feed(html)
return parser.injectJSHandler
# Only convert the body to bytes if needed
if isinstance(body, str):
body = bytes(body, 'utf-8')
# Regex for between 24 and 72 (aka 24*3) characters encapsulated by the walls
regex = re.compile(b"""%s.{24,72}?%s""" % (FRONT_WALL, BACK_WALL))
matches = regex.findall(body)
for index, match in enumerate(matches):
# Where the string is injected into the HTML
in_script = in_script(match, index, body)
in_HTML = in_HTML(match, index, body)
in_tag = not in_script and not in_HTML
in_single_quotes = inside_quote("'", match, index, body)
in_double_quotes = inside_quote('"', match, index, body)
# Whether you can inject:
inject_open_angle = b"ao<ac" in match # open angle brackets
inject_close_angle = b"ac>so" in match # close angle brackets
inject_single_quotes = b"s'd" in match # single quotes
inject_double_quotes = b'd"ao' in match # double quotes
inject_slash = b"sl/bsl" in match # forward slashes
inject_semi = b"se;sl" in match # semicolons
inject_equals = b"eq=" in match # equals sign
if in_script and inject_slash and inject_open_angle and inject_close_angle: # e.g. <script>PAYLOAD</script>
return XSSData(request_URL,
injection_point,
'</script><script>alert(0)</script><script>',
match.decode('utf-8'))
elif in_script and in_single_quotes and inject_single_quotes and inject_semi: # e.g. <script>t='PAYLOAD';</script>
return XSSData(request_URL,
injection_point,
"';alert(0);g='",
match.decode('utf-8'))
elif in_script and in_double_quotes and inject_double_quotes and inject_semi: # e.g. <script>t="PAYLOAD";</script>
return XSSData(request_URL,
injection_point,
'";alert(0);g="',
match.decode('utf-8'))
elif in_tag and in_single_quotes and inject_single_quotes and inject_open_angle and inject_close_angle and inject_slash:
# e.g. <a href='PAYLOAD'>Test</a>
return XSSData(request_URL,
injection_point,
"'><script>alert(0)</script>",
match.decode('utf-8'))
elif in_tag and in_double_quotes and inject_double_quotes and inject_open_angle and inject_close_angle and inject_slash:
# e.g. <a href="PAYLOAD">Test</a>
return XSSData(request_URL,
injection_point,
'"><script>alert(0)</script>',
match.decode('utf-8'))
elif in_tag and not in_double_quotes and not in_single_quotes and inject_open_angle and inject_close_angle and inject_slash:
# e.g. <a href=PAYLOAD>Test</a>
return XSSData(request_URL,
injection_point,
'><script>alert(0)</script>',
match.decode('utf-8'))
elif inject_javascript_handler(body.decode('utf-8')): # e.g. <html><a href=PAYLOAD>Test</a>
return XSSData(request_URL,
injection_point,
'Javascript:alert(0)',
match.decode('utf-8'))
elif in_tag and in_double_quotes and inject_double_quotes and inject_equals: # e.g. <a href="PAYLOAD">Test</a>
return XSSData(request_URL,
injection_point,
'" onmouseover="alert(0)" t="',
match.decode('utf-8'))
elif in_tag and in_single_quotes and inject_single_quotes and inject_equals: # e.g. <a href='PAYLOAD'>Test</a>
return XSSData(request_URL,
injection_point,
"' onmouseover='alert(0)' t='",
match.decode('utf-8'))
elif in_tag and not in_single_quotes and not in_double_quotes and inject_equals: # e.g. <a href=PAYLOAD>Test</a>
return XSSData(request_URL,
injection_point,
" onmouseover=alert(0) t=",
match.decode('utf-8'))
elif in_HTML and not in_script and inject_open_angle and inject_close_angle and inject_slash: # e.g. <html>PAYLOAD</html>
return XSSData(request_URL,
injection_point,
'<script>alert(0)</script>',
match.decode('utf-8'))
else:
return None
# response is mitmproxy's entry point
def response(flow: http.HTTPFlow) -> None:
cookiesDict = get_cookies(flow)
# Example: http://xss.guru/unclaimedScriptTag.html
find_unclaimed_URLs(flow.response.content, flow.request.url)
results = test_end_of_URL_injection(flow.response.content.decode('utf-8'), flow.request.url, cookiesDict)
log_XSS_data(results[0])
log_SQLi_data(results[1])
# Example: https://daviddworken.com/vulnerableReferer.php
results = test_referer_injection(flow.response.content.decode('utf-8'), flow.request.url, cookiesDict)
log_XSS_data(results[0])
log_SQLi_data(results[1])
# Example: https://daviddworken.com/vulnerableUA.php
results = test_user_agent_injection(flow.response.content.decode('utf-8'), flow.request.url, cookiesDict)
log_XSS_data(results[0])
log_SQLi_data(results[1])
if "?" in flow.request.url:
# Example: https://daviddworken.com/vulnerable.php?name=
results = test_query_injection(flow.response.content.decode('utf-8'), flow.request.url, cookiesDict)
log_XSS_data(results[0])
log_SQLi_data(results[1])

View File

@@ -1,70 +0,0 @@
import string
import lxml.html
import lxml.etree
from mitmproxy import contentviews
from netlib import strutils
class ViewPigLatin(contentviews.View):
name = "pig_latin_HTML"
prompt = ("pig latin HTML", "l")
content_types = ["text/html"]
def __call__(self, data, **metadata):
if strutils.is_xml(data):
parser = lxml.etree.HTMLParser(
strip_cdata=True,
remove_blank_text=True
)
d = lxml.html.fromstring(data, parser=parser)
docinfo = d.getroottree().docinfo
def piglify(src):
words = src.split()
ret = ''
for word in words:
idx = -1
while word[idx] in string.punctuation and (idx * -1) != len(word):
idx -= 1
if word[0].lower() in 'aeiou':
if idx == -1:
ret += word[0:] + "hay"
else:
ret += word[0:len(word) + idx + 1] + "hay" + word[idx + 1:]
else:
if idx == -1:
ret += word[1:] + word[0] + "ay"
else:
ret += word[1:len(word) + idx + 1] + word[0] + "ay" + word[idx + 1:]
ret += ' '
return ret.strip()
def recurse(root):
if hasattr(root, 'text') and root.text:
root.text = piglify(root.text)
if hasattr(root, 'tail') and root.tail:
root.tail = piglify(root.tail)
if len(root):
for child in root:
recurse(child)
recurse(d)
s = lxml.etree.tostring(
d,
pretty_print=True,
doctype=docinfo.doctype
)
return "HTML", contentviews.format_text(s)
pig_view = ViewPigLatin()
def start():
contentviews.add(pig_view)
def done():
contentviews.remove(pig_view)

View File

@@ -1,49 +0,0 @@
"""
This inline scripts makes it possible to use mitmproxy in scenarios where IP spoofing has been used to redirect
connections to mitmproxy. The way this works is that we rely on either the TLS Server Name Indication (SNI) or the
Host header of the HTTP request.
Of course, this is not foolproof - if an HTTPS connection comes without SNI, we don't
know the actual target and cannot construct a certificate that looks valid.
Similarly, if there's no Host header or a spoofed Host header, we're out of luck as well.
Using transparent mode is the better option most of the time.
Usage:
mitmproxy
-p 443
-s dns_spoofing.py
# Used as the target location if neither SNI nor host header are present.
-R http://example.com/
mitmdump
-p 80
-R http://localhost:443/
(Setting up a single proxy instance and using iptables to redirect to it
works as well)
"""
import re
# This regex extracts splits the host header into host and port.
# Handles the edge case of IPv6 addresses containing colons.
# https://bugzilla.mozilla.org/show_bug.cgi?id=45891
parse_host_header = re.compile(r"^(?P<host>[^:]+|\[.+\])(?::(?P<port>\d+))?$")
def request(flow):
if flow.client_conn.ssl_established:
flow.request.scheme = "https"
sni = flow.client_conn.connection.get_servername()
port = 443
else:
flow.request.scheme = "http"
sni = None
port = 80
host_header = flow.request.pretty_host
m = parse_host_header.match(host_header)
if m:
host_header = m.group("host").strip("[]")
if m.group("port"):
port = int(m.group("port"))
flow.request.host = sni or host_header
flow.request.port = port

View File

@@ -1,7 +0,0 @@
from mitmproxy import master
def request(flow):
f = master.duplicate_flow(flow)
f.request.path = "/changed"
master.replay_request(f, block=True, run_scripthooks=False)

View File

@@ -1,3 +0,0 @@
def response(flow):
flow.response.status_code = 500
flow.response.content = b""

View File

@@ -1,43 +0,0 @@
#!/usr/bin/env python
"""
This example shows how to build a proxy based on mitmproxy's Flow
primitives.
Heads Up: In the majority of cases, you want to use inline scripts.
Note that request and response messages are not automatically replied to,
so we need to implement handlers to do this.
"""
from mitmproxy import flow, controller, options
from mitmproxy.proxy import ProxyServer, ProxyConfig
class MyMaster(flow.FlowMaster):
def run(self):
try:
flow.FlowMaster.run(self)
except KeyboardInterrupt:
self.shutdown()
@controller.handler
def request(self, f):
print("request", f)
@controller.handler
def response(self, f):
print("response", f)
@controller.handler
def error(self, f):
print("error", f)
@controller.handler
def log(self, l):
print("log", l.msg)
opts = options.Options(cadir="~/.mitmproxy/")
config = ProxyConfig(opts)
state = flow.State()
server = ProxyServer(config)
m = MyMaster(opts, server, state)
m.run()

View File

@@ -1,21 +0,0 @@
# This scripts demonstrates how to use mitmproxy's filter pattern in scripts.
# Usage: mitmdump -s "flowfilter.py FILTER"
import sys
from mitmproxy import flowfilter
class Filter:
def __init__(self, spec):
self.filter = flowfilter.parse(spec)
def response(self, flow):
if flowfilter.match(flow, self.filter):
print("Flow matches filter:")
print(flow)
def start():
if len(sys.argv) != 2:
raise ValueError("Usage: -s 'filt.py FILTER'")
return Filter(sys.argv[1])

View File

@@ -1,23 +0,0 @@
import random
import sys
from mitmproxy.flow import FlowWriter
class Writer:
def __init__(self, path):
if path == "-":
f = sys.stdout
else:
f = open(path, "wb")
self.w = FlowWriter(f)
def response(self, flow):
if random.choice([True, False]):
self.w.add(flow)
def start():
if len(sys.argv) != 2:
raise ValueError('Usage: -s "flowriter.py filename"')
return Writer(sys.argv[1])

View File

@@ -1,29 +0,0 @@
# Usage: mitmdump -s "iframe_injector.py url"
# (this script works best with --anticache)
import sys
from bs4 import BeautifulSoup
class Injector:
def __init__(self, iframe_url):
self.iframe_url = iframe_url
def response(self, flow):
if flow.request.host in self.iframe_url:
return
html = BeautifulSoup(flow.response.content, "lxml")
if html.body:
iframe = html.new_tag(
"iframe",
src=self.iframe_url,
frameborder=0,
height=0,
width=0)
html.body.insert(0, iframe)
flow.response.content = str(html).encode("utf8")
def start():
if len(sys.argv) != 2:
raise ValueError('Usage: -s "iframe_injector.py url"')
return Injector(sys.argv[1])

View File

@@ -1,6 +0,0 @@
from mitmproxy import ctx
def start():
ctx.log.info("This is some informative text.")
ctx.log.error("This is an error.")

View File

@@ -1,2 +0,0 @@
def request(flow):
flow.request.query["mitmproxy"] = "rocks"

View File

@@ -1,10 +0,0 @@
import time
import mitmproxy
from mitmproxy.script import concurrent
@concurrent # Remove this and see what happens
def request(flow):
mitmproxy.ctx.log("handle request: %s%s" % (flow.request.host, flow.request.path))
time.sleep(5)
mitmproxy.ctx.log("start request: %s%s" % (flow.request.host, flow.request.path))

View File

@@ -1,19 +0,0 @@
"""
This example shows two ways to redirect flows to other destinations.
"""
from mitmproxy.models import HTTPResponse
def request(flow):
# pretty_host takes the "Host" header of the request into account,
# which is useful in transparent mode where we usually only have the IP
# otherwise.
# Method 1: Answer with a locally generated response
if flow.request.pretty_host.endswith("example.com"):
resp = HTTPResponse.make(200, b"Hello World", {"Content-Type": "text/html"})
flow.reply.send(resp)
# Method 2: Redirect the request to a different server
if flow.request.pretty_host.endswith("example.org"):
flow.request.host = "mitmproxy.org"

18
examples/simple/README.md Normal file
View File

@@ -0,0 +1,18 @@
## Simple Examples
| Filename | Description |
|:-----------------------------|:---------------------------------------------------------------------------|
| add_header.py | Simple script that just adds a header to every request. |
| custom_contentview.py | Add a custom content view to the mitmproxy UI. |
| filter_flows.py | This script demonstrates how to use mitmproxy's filter pattern in scripts. |
| io_read_dumpfile.py | Read a dumpfile generated by mitmproxy. |
| io_write_dumpfile.py | Only write selected flows into a mitmproxy dumpfile. |
| log_events.py | Use mitmproxy's logging API. |
| modify_body_inject_iframe.py | Inject configurable iframe into pages. |
| modify_form.py | Modify HTTP form submissions. |
| modify_querystring.py | Modify HTTP query strings. |
| redirect_requests.py | Redirect a request to a different server. |
| script_arguments.py | Add arguments to a script. |
| send_reply_from_proxy.py | Send a HTTP response directly from the proxy. |
| upsidedownternet.py | Turn all images upside down. |
| wsgi_flask_app.py | Embed a WSGI app into mitmproxy. |

View File

@@ -0,0 +1,5 @@
from mitmproxy import http
def response(flow: http.HTTPFlow) -> None:
flow.response.headers["newheader"] = "foo"

View File

@@ -0,0 +1,9 @@
from mitmproxy import http
class AddHeader:
def response(self, flow: http.HTTPFlow) -> None:
flow.response.headers["newheader"] = "foo"
addons = [AddHeader()]

View File

@@ -0,0 +1,32 @@
"""
This example shows how one can add a custom contentview to mitmproxy.
The content view API is explained in the mitmproxy.contentviews module.
"""
from mitmproxy import contentviews
import typing
CVIEWSWAPCASE = typing.Tuple[str, typing.Iterable[typing.List[typing.Tuple[str, typing.AnyStr]]]]
class ViewSwapCase(contentviews.View):
name = "swapcase"
# We don't have a good solution for the keyboard shortcut yet -
# you manually need to find a free letter. Contributions welcome :)
prompt = ("swap case text", "z")
content_types = ["text/plain"]
def __call__(self, data: typing.AnyStr, **metadata) -> CVIEWSWAPCASE:
return "case-swapped text", contentviews.format_text(data.swapcase())
view = ViewSwapCase()
def load(l):
contentviews.add(view)
def done():
contentviews.remove(view)

View File

@@ -0,0 +1,11 @@
from mitmproxy import ctx
def load(l):
ctx.log.info("Registering option 'custom'")
l.add_option("custom", bool, False, "A custom option")
def configure(updated):
if "custom" in updated:
ctx.log.info("custom option value: %s" % ctx.options.custom)

View File

@@ -0,0 +1,26 @@
"""
This scripts demonstrates how to use mitmproxy's filter pattern in scripts.
"""
from mitmproxy import flowfilter
from mitmproxy import ctx, http
class Filter:
def __init__(self):
self.filter = None # type: flowfilter.TFilter
def configure(self, updated):
self.filter = flowfilter.parse(ctx.options.flowfilter)
def load(self, l):
l.add_option(
"flowfilter", str, "", "Check that flow matches filter."
)
def response(self, flow: http.HTTPFlow) -> None:
if flowfilter.match(self.filter, flow):
print("Flow matches filter:")
print(flow)
addons = [Filter()]

View File

@@ -1,15 +1,17 @@
#!/usr/bin/env python
# type: ignore
#
# Simple script showing how to read a mitmproxy dump file
#
from mitmproxy import flow
from mitmproxy import io
from mitmproxy.exceptions import FlowReadException
import pprint
import sys
with open(sys.argv[1], "rb") as logfile:
freader = flow.FlowReader(logfile)
freader = io.FlowReader(logfile)
pp = pprint.PrettyPrinter(indent=4)
try:
for f in freader.stream():

View File

@@ -0,0 +1,27 @@
"""
This script how to generate a mitmproxy dump file,
as it would also be generated by passing `-w` to mitmproxy.
In contrast to `-w`, this gives you full control over which
flows should be saved and also allows you to rotate files or log
to multiple files in parallel.
"""
import random
import sys
from mitmproxy import io, http
import typing # noqa
class Writer:
def __init__(self, path: str) -> None:
if path == "-":
f = sys.stdout # type: typing.IO[typing.Any]
else:
f = open(path, "wb")
self.w = io.FlowWriter(f)
def response(self, flow: http.HTTPFlow) -> None:
if random.choice([True, False]):
self.w.add(flow)
addons = [Writer(sys.argv[1])]

View File

@@ -0,0 +1,12 @@
"""
It is recommended to use `ctx.log` for logging within a script.
This goes to the event log in mitmproxy and to stdout in mitmdump.
If you want to help us out: https://github.com/mitmproxy/mitmproxy/issues/1530 :-)
"""
from mitmproxy import ctx
def load(l):
ctx.log.info("This is some informative text.")
ctx.log.error("This is an error.")

View File

@@ -0,0 +1,26 @@
# (this script works best with --anticache)
from bs4 import BeautifulSoup
from mitmproxy import ctx, http
class Injector:
def load(self, loader):
loader.add_option(
"iframe", str, "", "IFrame to inject"
)
def response(self, flow: http.HTTPFlow) -> None:
if ctx.options.iframe:
html = BeautifulSoup(flow.response.content, "html.parser")
if html.body:
iframe = html.new_tag(
"iframe",
src=ctx.options.iframe,
frameborder=0,
height=0,
width=0)
html.body.insert(0, iframe)
flow.response.content = str(html).encode("utf8")
addons = [Injector()]

View File

@@ -1,7 +1,12 @@
def request(flow):
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
if flow.request.urlencoded_form:
# If there's already a form, one can just add items to the dict:
flow.request.urlencoded_form["mitmproxy"] = "rocks"
else:
# One can also just pass new form data.
# This sets the proper content type and overrides the body.
flow.request.urlencoded_form = [
("foo", "bar")

View File

@@ -0,0 +1,5 @@
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
flow.request.query["mitmproxy"] = "rocks"

View File

@@ -0,0 +1,12 @@
"""
This example shows two ways to redirect flows to another server.
"""
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
# pretty_host takes the "Host" header of the request into account,
# which is useful in transparent mode where we usually only have the IP
# otherwise.
if flow.request.pretty_host == "example.org":
flow.request.host = "mitmproxy.org"

View File

@@ -0,0 +1,17 @@
"""
This example shows how to send a reply from the proxy immediately
without sending any data to the remote server.
"""
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
# pretty_url takes the "Host" header of the request into account, which
# is useful in transparent mode where we usually only have the IP otherwise.
if flow.request.pretty_url == "http://example.com/path":
flow.response = http.HTTPResponse.make(
200, # (optional) status code
b"Hello World", # (optional) content
{"Content-Type": "text/html"} # (optional) headers
)

View File

@@ -0,0 +1,16 @@
"""
This script rotates all images passing through the proxy by 180 degrees.
"""
import io
from PIL import Image
from mitmproxy import http
def response(flow: http.HTTPFlow) -> None:
if flow.response.headers.get("content-type", "").startswith("image"):
s = io.BytesIO(flow.response.content)
img = Image.open(s).rotate(180)
s2 = io.BytesIO()
img.save(s2, "png")
flow.response.content = s2.getvalue()
flow.response.headers["content-type"] = "image/png"

View File

@@ -4,22 +4,22 @@ instance, we're using the Flask framework (http://flask.pocoo.org/) to expose
a single simplest-possible page.
"""
from flask import Flask
import mitmproxy
from mitmproxy.addons import wsgiapp
app = Flask("proxapp")
@app.route('/')
def hello_world():
def hello_world() -> str:
return 'Hello World!'
# Register the app using the magic domain "proxapp" on port 80. Requests to
# this domain and port combination will now be routed to the WSGI app instance.
def start():
mitmproxy.ctx.master.apps.add(app, "proxapp", 80)
def load(l):
# Host app at the magic domain "proxapp.local" on port 80. Requests to this
# domain and port combination will now be routed to the WSGI app instance.
return wsgiapp.WSGIApp(app, "proxapp.local", 80)
# SSL works too, but the magic domain needs to be resolvable from the mitmproxy machine due to mitmproxy's design.
# mitmproxy will connect to said domain and use serve its certificate (unless --no-upstream-cert is set)
# but won't send any data.
mitmproxy.ctx.master.apps.add(app, "example.com", 443)
# mitmproxy.ctx.master.apps.add(app, "example.com", 443)

View File

@@ -1,42 +0,0 @@
#!/usr/bin/env python
"""
This example builds on mitmproxy's base proxying infrastructure to
implement functionality similar to the "sticky cookies" option.
Heads Up: In the majority of cases, you want to use inline scripts.
"""
import os
from mitmproxy import controller, proxy
from mitmproxy.proxy.server import ProxyServer
class StickyMaster(controller.Master):
def __init__(self, server):
controller.Master.__init__(self, server)
self.stickyhosts = {}
def run(self):
try:
return controller.Master.run(self)
except KeyboardInterrupt:
self.shutdown()
@controller.handler
def request(self, flow):
hid = (flow.request.host, flow.request.port)
if "cookie" in flow.request.headers:
self.stickyhosts[hid] = flow.request.headers.get_all("cookie")
elif hid in self.stickyhosts:
flow.request.headers.set_all("cookie", self.stickyhosts[hid])
@controller.handler
def response(self, flow):
hid = (flow.request.host, flow.request.port)
if "set-cookie" in flow.response.headers:
self.stickyhosts[hid] = flow.response.headers.get_all("set-cookie")
config = proxy.ProxyConfig(port=8080)
server = ProxyServer(config)
m = StickyMaster(server)
m.run()

View File

@@ -1,87 +0,0 @@
import mitmproxy
"""
This is a script stub, with definitions for all events.
"""
def start():
"""
Called once on script startup before any other events
"""
mitmproxy.ctx.log("start")
def configure(options, updated):
"""
Called once on script startup before any other events, and whenever options changes.
"""
mitmproxy.ctx.log("configure")
def clientconnect(root_layer):
"""
Called when a client initiates a connection to the proxy. Note that a
connection can correspond to multiple HTTP requests
"""
mitmproxy.ctx.log("clientconnect")
def request(flow):
"""
Called when a client request has been received.
"""
mitmproxy.ctx.log("request")
def serverconnect(server_conn):
"""
Called when the proxy initiates a connection to the target server. Note that a
connection can correspond to multiple HTTP requests
"""
mitmproxy.ctx.log("serverconnect")
def responseheaders(flow):
"""
Called when the response headers for a server response have been received,
but the response body has not been processed yet. Can be used to tell mitmproxy
to stream the response.
"""
mitmproxy.ctx.log("responseheaders")
def response(flow):
"""
Called when a server response has been received.
"""
mitmproxy.ctx.log("response")
def error(flow):
"""
Called when a flow error has occured, e.g. invalid server responses, or
interrupted connections. This is distinct from a valid server HTTP error
response, which is simply a response with an HTTP error code.
"""
mitmproxy.ctx.log("error")
def serverdisconnect(server_conn):
"""
Called when the proxy closes the connection to the target server.
"""
mitmproxy.ctx.log("serverdisconnect")
def clientdisconnect(root_layer):
"""
Called when a client disconnects from the proxy.
"""
mitmproxy.ctx.log("clientdisconnect")
def done():
"""
Called once on script shutdown, after any other events.
"""
mitmproxy.ctx.log("done")

View File

@@ -1,15 +0,0 @@
from six.moves import cStringIO as StringIO
from PIL import Image
def response(flow):
if flow.response.headers.get("content-type", "").startswith("image"):
try:
s = StringIO(flow.response.content)
img = Image.open(s).rotate(180)
s2 = StringIO()
img.save(s2, "png")
flow.response.content = s2.getvalue()
flow.response.headers["content-type"] = "image/png"
except: # Unknown image types etc.
pass

View File

@@ -1,22 +1,20 @@
##### Steps to reproduce the problem:
1.
2.
3.
##### What is the expected behavior?
##### What went wrong?
1.
2.
3.
##### Any other comments? What have you tried so far?
---
Mitmproxy Version:
Operating System:
##### System information
<!-- Please use the mitmproxy forums (https://discourse.mitmproxy.org/) for support/how-to questions. Thanks! :) -->
<!--
Cut and paste the output of "mitmproxy --version".
If you're using an older version if mitmproxy, please specify the version
and OS.
-->

View File

@@ -0,0 +1,3 @@
# https://github.com/mitmproxy/mitmproxy/issues/1809
# import script here so that pyinstaller registers it.
from . import script # noqa

Some files were not shown because too many files have changed in this diff Show More