Commit Graph

86 Commits

Author SHA1 Message Date
Aldo Cortesi
7d76f3e992 Make sure all command-line arguments have a long form
... so they can be used in config files
2014-11-15 17:41:04 +13:00
Aldo Cortesi
09c503563a Enable config file parsing
We support 4 different config files:

~/.mitmproxy/common.conf:       Options that are common to all tools
~/.mitmproxy/mitmproxy.conf:    Options for mitmproxy
~/.mitmproxy/mitmdump.conf:     Options for mitmdump
~/.mitmproxy/mitmweb.conf:      Options for mitmweb

Options in the tool-specific config files over-ride options in common.conf. If
a non-common option is put in common.conf, an error will be raised if a
non-supporting tool is used.
2014-11-15 17:25:05 +13:00
Aldo Cortesi
6c1dc4522d Refactor command-line argument definition
- Argument definitions live in cmdline.py
- Parsing and initial processing lives in main.py
2014-11-15 16:29:38 +13:00
Aldo Cortesi
24c4df07e3 First-order integration of configargparser to add config file support 2014-11-15 16:14:08 +13:00
Aldo Cortesi
16654ad6a4 Fix crash while streaming
Found using fuzzing. Reproduction with pathoc, given "mitmproxy -s" and
pathod running on 9999:

get:'http://localhost:9999/p/':s'200:b\'foo\':h\'Content-Length\'=\'3\'':i58,'\x1a':r

 return flow.FlowMaster.run(self)
   File "/Users/aldo/mitmproxy/mitmproxy/libmproxy/controller.py", line 111, in run
     self.tick(self.masterq, 0.01)
   File "/Users/aldo/mitmproxy/mitmproxy/libmproxy/flow.py", line 613, in tick
     return controller.Master.tick(self, q, timeout)
   File "/Users/aldo/mitmproxy/mitmproxy/libmproxy/controller.py", line 101, in tick
     self.handle(*msg)
   File "/Users/aldo/mitmproxy/mitmproxy/libmproxy/controller.py", line 118, in handle
     m(obj)
   File "/Users/aldo/mitmproxy/mitmproxy/libmproxy/flow.py", line 738, in handle_responseheaders
     self.stream_large_bodies.run(f, False)
   File "/Users/aldo/mitmproxy/mitmproxy/libmproxy/flow.py", line 155, in run
     r.headers, is_request, flow.request.method, code
   File "/Users/aldo/mitmproxy/mitmproxy/netlib/http.py", line 401, in expected_http_body_size
     raise HttpError(400 if is_request else 502, "Invalid content-length header: %s" % headers["content-length"])
 netlib.http.HttpError: Invalid content-length header: ['\x1a3']
2014-10-26 17:58:36 +13:00
Maximilian Hils
e114858438 add generic tcp proxying, fix #374 2014-10-18 18:29:35 +02:00
Maximilian Hils
52b29d4926 remove default_ca 2014-10-18 15:26:10 +02:00
Maximilian Hils
7c56a3bb01 Add SOCKS5 mode, fix #305 2014-10-09 01:59:02 +02:00
Marcelo Glezer
81f5636389 --replay-ignore-content & --replay-ignore-param ported from branch 0.10 2014-10-03 07:29:44 -03:00
Aldo Cortesi
6812d304a1 Basic web service and options 2014-09-14 12:22:28 +12:00
Aldo Cortesi
17868f61a9 Remove external app option, make tick timeout explicit 2014-09-14 11:46:01 +12:00
Maximilian Hils
d06b4bfa4e remove proxy mode abstraction: always be clear which mode we are in 2014-09-08 14:32:42 +02:00
Maximilian Hils
b6c8a22b67 coverage++ 2014-09-06 12:23:05 +02:00
Maximilian Hils
bb2ce689a9 adjust to netlib changes 2014-08-17 23:06:25 +02:00
Maximilian Hils
ecf8081ba6 implement passthrough mode, fixes #175 2014-08-09 03:03:21 +02:00
Maximilian Hils
4b4a18a2e4 add --stream options, various fixes 2014-07-21 21:06:55 +02:00
Maximilian Hils
5fed5753b4 fix command line help 2014-07-06 02:15:54 +02:00
Aldo Cortesi
1dba379ae9 Fix proxy options 2014-04-12 17:57:19 +12:00
Maximilian Hils
a66913d4a3 forward proxy -> upstream proxy 2014-03-14 00:02:00 +01:00
Maximilian Hils
4e17b00ce8 order command line options, add disting proxy option group 2014-03-13 23:43:26 +01:00
Maximilian Hils
843b2e28bc adjust command line docs, fix log typo 2014-03-13 23:25:13 +01:00
Maximilian Hils
1bfc164692 adjust tests, fix option handling 2014-03-13 01:22:12 +01:00
Maximilian Hils
7e86744226 add -d switch to mitmdump to compensate for old verbosity functionality 2014-03-12 22:39:23 +01:00
Maximilian Hils
aefb30ea60 restrict -e to mitmproxy only (not mitmdump) 2014-03-12 22:13:00 +01:00
Maximilian Hils
c1fff51b1b always use relative imports, fix status bar bug 2014-03-10 22:36:47 +01:00
Maximilian Hils
9cc10630c8 update docs, fix #215 2014-03-10 17:01:30 +01:00
Maximilian Hils
fe58c1c6eb add advanced proxying options, add SSL-terminating capability to mitmproxy 2014-03-10 05:11:51 +01:00
Maximilian Hils
5598a8de82 finish proxy.py split up 2014-03-09 21:51:24 +01:00
Aldo Cortesi
f373ac5b6c Improve explicit certificate specification
- Support cert/key in the same PEM file
- Rationalize arguments, expand tests, clean up a bit
2014-03-02 17:27:24 +13:00
Aldo Cortesi
2df321e71b Use the mitm.it domain for the app, turn it on by default. 2014-01-27 14:37:29 +13:00
Aldo Cortesi
7ddc941116 Silence pyflakes
And pick up one bug as a consequence.
2014-01-19 18:16:24 +13:00
Aldo Cortesi
42d4a2fae9 Script refactoring: move script command parsing into script module. 2014-01-12 23:02:29 +13:00
Aldo Cortesi
3aa4b6603c Fix app in mitmproxy console, update to bootstrap 3. 2014-01-03 15:29:32 +13:00
Maximilian Hils
a509a9037b Merge branch 'master' into 0.10 2013-12-08 14:14:57 +01:00
Aldo Cortesi
3a1d85ab18 Merge pull request #134 from mhils/scripts_improvements
Support multiple scripts and script arguments. refs #76
2013-12-08 01:14:12 -08:00
JC
65d1ed1b3c Added -F http[s]://server:port option that allows MITM to forward traffic to another http server upstream. 2013-08-30 17:19:58 -07:00
Maximilian Hils
bb4748fb8f add option to expose webapp externally, remove distinct ip setting 2013-08-18 20:03:53 +02:00
Maximilian Hils
729677cd85 Merge branch 'master' into 0.10 2013-08-17 13:30:36 +02:00
Aldo Cortesi
edb10e33aa Remove GPL notices left in source files after our change to the MIT license.
Thanks to Roy Shamir for reporting this.
2013-08-01 11:08:00 +12:00
Aldo Cortesi
5c1157ddaf Move app instantiation out of proxy.py. 2013-07-24 10:32:56 +12:00
Maximilian Hils
fd36142018 Merge remote-tracking branch 'origin/scripts_improvements' into 0.10 2013-06-16 00:41:43 +02:00
Maximilian Hils
ba47690a03 always read files in binary mode 2013-06-16 00:23:44 +02:00
Maximilian Hils
2b4af8d475 add support for multiple scripts and script arguments. refs #76 2013-06-13 16:09:38 +02:00
Aldo Cortesi
e3fd0e838d Add a basic built-in web app. 2013-03-25 09:20:26 +13:00
Aldo Cortesi
0e993bec6f Add the --host option, which uses the value in the Host header for dispaly URLs.
- Can be toggled with "o" then "h" in mitmproxy
- Useful for transparent mode
2013-03-17 17:37:54 +13:00
Aldo Cortesi
060e3198bc Remove cert_wait_time flag.
We now cater for this by generating certs with a commencement date an hour in
the past in netlib.
2013-01-06 01:18:47 +13:00
Aldo Cortesi
09f664cdea Refactor proxy auth a bit
- Remove authentication scheme option. We only support basic at the moment -
we'll add the option back when we diversify.
- Add some meta variables to make printout nicer
2013-01-02 17:35:44 +13:00
israel
440a9f6bda adding some simple authetication code to limit proxy access 2012-12-30 01:41:58 -08:00
Aldo Cortesi
1b7990897e Command-line options for header setting. 2012-08-19 00:14:16 +12:00
Maximilian Hils
b0566b9d4c add dummy cert dir 2012-08-17 19:13:56 +02:00