Commit Graph

1081 Commits

Author SHA1 Message Date
Thomas Kriechbaumer
514ea1b701 http2: cleanup tests 2016-07-23 11:08:32 +02:00
Shadab Zafar
08000c940c Test marked property while serialization roundtrip 2016-07-23 10:41:57 +05:30
Aldo Cortesi
afda175e1c Addon iface: .configure(options) -> .configure(options, updated) 2016-07-23 15:43:55 +12:00
Aldo Cortesi
b5416895f5 script: convert test recorder to an addon class 2016-07-23 11:38:45 +12:00
Aldo Cortesi
9294d19f90 scripts: .start can now return an Addon instance 2016-07-23 11:29:13 +12:00
Aldo Cortesi
51a8ba57f1 script: add a namespace adaptor to match Addons 2016-07-23 11:03:50 +12:00
Maximilian Hils
65c2f30218 fix mitmproxy 0.11 dumpfile - was 0.18 before 2016-07-22 10:36:26 -07:00
Maximilian Hils
798759d2b3 fix content view cache invalidation 2016-07-21 19:49:32 -07:00
Aldo Cortesi
33ffbc28ed console: share one ActionBar instance
This fixes an issues where popping a view off the stack caused stale ActionBar
contents to be displayed.
2016-07-21 15:41:43 +12:00
Aldo Cortesi
6750ab899a Merge branch 'flow-export' of https://github.com/dufferzafar/mitmproxy into dufferzafar-flow-export 2016-07-21 13:53:41 +12:00
Aldo Cortesi
02acfb1242 Fix netlib.utils.is_valid_host
- Don't crash when passed an empty string. This translated into an actual core
crash, discovered while fuzzing with afl.
- Taking a slice of length one out of bytes returns an integer, so the check
for trailing period in this function never worked on Python3.
- Add unit tests.
2016-07-21 10:38:37 +12:00
Shadab Zafar
c84d0bd10b Add a url exporter 2016-07-20 10:03:00 +05:30
Shadab Zafar
8f4d49e22a Remove raw_request exporter
This functionality will be handled by headers+content
2016-07-20 10:03:00 +05:30
Aldo Cortesi
8317772377 mitproxy.options -> mitmproxy.optmanager, mitmproxy.flow.options -> mitmproxy.options
It might be slightly  more felicitous to move optmanager into netlib at some
point, especially if we can also use it in pathod.

This also consolidates our constants in mitmproxy.options, removing some duplicates.
2016-07-20 11:28:53 +12:00
Aldo Cortesi
09fbebf42a Test suite: get_proxy_config -> get_options 2016-07-19 19:36:40 +12:00
Aldo Cortesi
9c9d28d068 Remove proxy.config.process_proxy_options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
ef380917a8 ProxyConf: adapt mitmproxy console, ditch tcp|host filter attrs on flow.master 2016-07-19 16:25:09 +12:00
Aldo Cortesi
be081a24bc ProxyConf: auth_* into Options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
5cfe783b6c ProxyConfig: http2, rawtcp, no_upstream_cert -> Options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
26fa88a338 ProxyConfig: Refactor to move verification mode checks into configure 2016-07-19 16:25:09 +12:00
Aldo Cortesi
98bf544664 Regularize naming of upstream_trusted_ca* options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
0a3839375d ProxyConfig: various SSL options to Options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
78e8159007 config.parse_server_spec shouldn't pass byts to tcp.Address 2016-07-19 16:25:09 +12:00
Aldo Cortesi
f9622074cc ProxyConfig: mode, upstream_server and upstream_auth to Options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
d2268ddb1e ProxyConfig: --body-size-limit to Options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
856e1c2ba9 Move clientcers & cadir to Options
Also adds a .configure mechanism to ProxyConfig, and hooks it up to the change
event.
2016-07-19 16:25:09 +12:00
Aldo Cortesi
b1b1a1b9cf ProxyConfig: cadir to options 2016-07-19 16:25:09 +12:00
Aldo Cortesi
6908dc4d90 ProxyConfig refactor
Step two of frog boiling: move listening address and port into options. This is
the hard bit, because it touches the test suite so deeply.
2016-07-19 16:25:09 +12:00
Aldo Cortesi
9bc1514aef Unify proxy config and options
This is step 1 in a gradual "boiling frog" strategy. Decorate ProxyConfig
with an Options object.
2016-07-19 16:25:09 +12:00
Aldo Cortesi
e9865800a8 Console options cleanup
Use setters, use togglers, move more things out of master
2016-07-18 10:31:34 +12:00
Aldo Cortesi
f9e4249499 Add a toggller helper to Options, start using it in mitmproxy console 2016-07-18 10:03:10 +12:00
Thomas Kriechbaumer
7b57c2948e cleanup 2016-07-17 18:17:35 +02:00
Thomas Kriechbaumer
d9021f8505 http2: coverage++ 2016-07-17 18:07:02 +02:00
Aldo Cortesi
216e38d437 setheaders -> addon 2016-07-17 18:41:14 +12:00
Aldo Cortesi
a26cc75aab Merge pull request #1370 from cortesi/filestreamer
Some work on stream-to-file
2016-07-17 16:20:41 +12:00
Aldo Cortesi
9bf1d300d8 Some work on stream-to-file
- stream -> filestreamer throughout
- move active_flows set into FileStreamer addon
2016-07-17 16:07:29 +12:00
Aldo Cortesi
fb45d59c02 Merge pull request #1367 from Kriechi/fix-1366
fix-1366
2016-07-17 15:06:58 +12:00
Aldo Cortesi
08b3af98c2 Merge branch 'master' into dumper 2016-07-17 12:53:14 +12:00
Aldo Cortesi
b0b3b19ad6 Extract console dump functionality into an addon
This removes all the code that deals with printing flows to screen from dump.py
into a self-contained addon.

- This fixes a bug - by moving dumping into an
addon, we now dump flows AFTER addon transformation, so we can see the changes
made.
- We get dumping "for free" in other places by simply adding the addon. It's
now easy to add dumping to console to mitmweb for debugging and development.
The same goes for external projects that derive from master.
- We also get major benefits in clarity for a frankly hairy part of our
project. Mitmdump is much clearer, and all the hairyness is now isolated for
further refactoring.
2016-07-17 10:17:02 +12:00
Thomas Kriechbaumer
a32312cecc fix-1366 2016-07-16 18:31:37 +02:00
Maximilian Hils
afc3f6d854 Merge remote-tracking branch 'duffer/tcpflow-filter' 2016-07-16 00:19:01 -07:00
Maximilian Hils
b27d59095d Merge pull request #1306 from mitmproxy/message-body-encoding
Improve Message Body Encoding
2016-07-16 00:13:58 -07:00
Maximilian Hils
e6e39ce80f preserve content-type parameter order 2016-07-15 23:46:12 -07:00
Aldo Cortesi
1a1f7e6fd9 replacehooks -> addon
Also fixes a bug in header replacements in netlib that resulted in a mutable
multidict.
2016-07-16 18:37:30 +12:00
Maximilian Hils
3602fd7a36 Merge remote-tracking branch 'origin/master' into message-body-encoding 2016-07-15 23:17:57 -07:00
Maximilian Hils
a3c7c84d49 improve message content semantics 2016-07-15 22:50:33 -07:00
Shadab Zafar
fea4435dac Allow DummyFlow to match ~e, ~src and ~dst 2016-07-16 10:15:38 +05:30
Shadab Zafar
1d2ccb9170 Add DummyFlow and its Tests 2016-07-16 10:15:38 +05:30
Shadab Zafar
8c49f0e784 Add tests for TCPFlow.match 2016-07-16 10:15:38 +05:30
Shadab Zafar
6a2668d865 Add ~http and ~tcp filters 2016-07-16 10:15:38 +05:30
Shadab Zafar
262a420553 Use ~bq / ~bs for messages sent from client / server 2016-07-16 10:15:38 +05:30
Shadab Zafar
767457fda9 Add tests for HTTPFlow only filters 2016-07-16 10:15:38 +05:30
Shadab Zafar
317355a9af Add test for operators (& | !) 2016-07-16 10:15:38 +05:30
Shadab Zafar
4e29993c1f Add test for addresses (~src, ~dst) 2016-07-16 10:15:38 +05:30
Shadab Zafar
124b87b851 Add test for body (~b) 2016-07-16 10:15:38 +05:30
Shadab Zafar
88671c3aac Add test for error (~e) 2016-07-16 10:15:38 +05:30
Aldo Cortesi
5f23d4f5ca add_event -> add_log throughout project
"Event" is terribly over-loaded in the project, and "log" is straight-forward
and self-explanatory.
2016-07-16 10:19:06 +12:00
Aldo Cortesi
c4fb489a96 Zap unused test scripts 2016-07-15 22:37:52 +12:00
Aldo Cortesi
c7d0850d8f Script cleanups
- Preserve script order on config change
- Prohibit script duplicates (i.e. identical script + args)
- Various cleanups and tweaks
2016-07-15 16:35:24 +12:00
Aldo Cortesi
917d51bd22 Fix HAR extractor
Thanks to @mhils
2016-07-15 15:01:35 +12:00
Aldo Cortesi
92a5076bd0 Adjust concurrent tests for start method 2016-07-15 15:00:37 +12:00
Aldo Cortesi
4ba7ce50c6 Add .start for addons and scripts
Also improve error messages, fix various unit tests
2016-07-15 14:52:34 +12:00
Aldo Cortesi
fcc1416ffd Fix windows parse_args test 2016-07-15 10:33:51 +12:00
Aldo Cortesi
698af945a4 Adjust for new options scheme 2016-07-14 19:58:12 +12:00
Aldo Cortesi
a4127fb6d5 Add a tick event for addons and scripts, and use it for race-free reload 2016-07-14 19:54:15 +12:00
Aldo Cortesi
deffed2196 Script cleanup: editing in console, Python3 compatibility fixes 2016-07-14 19:54:15 +12:00
Aldo Cortesi
b94f5fd361 Convert examples and example tests for new-style scripts
Remove the test that just loads all the example scripts for now - it's a very
low-value test, and we need to think of something better.
2016-07-14 19:54:15 +12:00
Aldo Cortesi
a6821aad8e Zap old scripts infrastructure, fix concurrency tests 2016-07-14 19:54:15 +12:00
Aldo Cortesi
a3a22fba33 First-order integration of scripts addon 2016-07-14 19:54:15 +12:00
Shadab Zafar
1266255842 Re-add deletion of stickycookies (#1355)
This was originally added in #1324 (fixing issue #1096)
but got lost during "the big refactor" (#1352)
2016-07-14 00:37:27 -07:00
Maximilian Hils
f84a23f11d minor fixes 2016-07-13 22:01:16 -07:00
Maximilian Hils
ec6fbe9eb6 make options explicit 2016-07-13 21:45:25 -07:00
Aldo Cortesi
b2c4f301cb Stream to file -> addon
This commit also clarifies a confusion about the "outfile" attribute and its
use in testing in the mitmdump master.
2016-07-14 13:52:09 +12:00
Aldo Cortesi
703c05066e Fix indeterminacy in sticky cookie tests
How has this not bitten us before?
2016-07-14 12:59:00 +12:00
Aldo Cortesi
00509d86a8 StickyCookies to addon 2016-07-14 12:13:14 +12:00
Aldo Cortesi
143bf0dfa9 AntiCache to addon 2016-07-14 11:24:06 +12:00
Aldo Cortesi
97b2e6d958 Add a .setter helper to Options
This returns a function that sets a named attribute, and is handy for
event-driven code like mitmproxy console.
2016-07-14 11:11:41 +12:00
Aldo Cortesi
a8a083a10d Move StickyAuth into addon
This is the first addon that handles an OptionsError, so this commit also demos
how this works in console. Handling of command-line erorrs is on its way.
2016-07-14 10:08:41 +12:00
Aldo Cortesi
255e1eb00b Add the addons mechanism
Demonstrate how it works and interacts with Options by adding our first new
builtin: anticomp.
2016-07-13 23:45:49 +12:00
Aldo Cortesi
7f8fd3cdff Basic outline of addons
Add addons.py, integrate with our event mechanism, and change the Master API so
options is the first init argument.
2016-07-13 23:26:04 +12:00
Aldo Cortesi
a20f8e9620 More powerful Options scheme
This prepares us for the addon configuration mechanism and gives us a more
flexible way to handle options changes. This changeset should spell the end of
the current anti-pattern in our codebase where we duplicate data out of options
onto the master when mutability is needed. From now on, Options can be the one
source of thruth.

- Change notifications
- Rollback on error
2016-07-13 18:45:50 +12:00
Thomas Kriechbaumer
3579c6dd43 http2: fix race-condition in tests 2016-07-12 19:55:28 +02:00
Thomas Kriechbaumer
7c09255298 http2: more coverage 2016-07-10 20:07:43 +02:00
Thomas Kriechbaumer
b611997619 http2: simplify test class 2016-07-10 18:53:00 +02:00
Shadab Zafar
7eade1ef7c Remove redundant tests 2016-07-10 01:08:02 +05:30
Shadab Zafar
39f5108400 Test cookies.is_expired separately 2016-07-10 01:06:50 +05:30
Shadab Zafar
6a746deff5 Add tests for deletion of stickycookies 2016-07-09 22:20:25 +05:30
Shadab Zafar
83a1cc5a9a Make escape_control_characters handle strings on Py2 2016-07-09 13:28:20 +05:30
Shadab Zafar
c7cbbf5f0d Set verbosity & flow_detail to 0 2016-07-09 12:32:41 +05:30
Shadab Zafar
147f61fa62 py3++ 2016-07-09 11:14:12 +05:30
Maximilian Hils
15c10d49f6 Merge pull request #1327 from mitmproxy/remove-script-context
Remove script context
2016-07-08 20:11:12 -07:00
Maximilian Hils
5d2b7c52f9 move script context to mitmproxy.ctx 2016-07-08 19:57:57 -07:00
Maximilian Hils
f7639e077a py3++ 2016-07-08 15:58:12 -07:00
jpkrause
05ab9c1b37 Updated coding style and modified flow format compat test to use v0.11 and v0.10 dump files 2016-07-08 15:03:36 -07:00
Maximilian Hils
7c67faa8da remove script contexts 2016-07-07 23:50:55 -07:00
Maximilian Hils
c048ae1d5b remove context from all scripts 2016-07-07 20:14:52 -07:00
Maximilian Hils
00dce24015 tests++ 2016-07-07 18:02:59 -07:00
Maximilian Hils
76473d44e0 py3++ 2016-07-07 17:50:26 -07:00
Maximilian Hils
f62e976e1e py3++ 2016-07-07 17:29:22 -07:00
Thomas Kriechbaumer
d962bd4e83 py3++ 2016-07-07 20:25:48 +02:00