Improve Markdown syntax(styling) (#4496)

* Improve Markdown syntax

- Add missing blank lines
- Remove trailing spaces
- Remove additional blank lines
- Fix indentation consistency and correctness

* Update addons-examples.md

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
This commit is contained in:
Peter Dave Hello 2021-03-12 02:13:02 +08:00 committed by GitHub
parent aede8849db
commit 123342ea0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 83 additions and 132 deletions

View File

@ -34,7 +34,6 @@ We wanted to bring these improvements out, so we have a few temporary regression
If you depend on these features, please raise your voice in If you depend on these features, please raise your voice in
[#4348](https://github.com/mitmproxy/mitmproxy/issues/4348)! [#4348](https://github.com/mitmproxy/mitmproxy/issues/4348)!
### Full Changelog ### Full Changelog
* New Proxy Core based on sans-io pattern (@mhils) * New Proxy Core based on sans-io pattern (@mhils)
@ -485,7 +484,6 @@ If you depend on these features, please raise your voice in
* Fix XSS vulnerability in HTTP errors (Will Coster) * Fix XSS vulnerability in HTTP errors (Will Coster)
* Numerous bugfixes and minor improvements * Numerous bugfixes and minor improvements
## 15 February 2016: mitmproxy 0.16 ## 15 February 2016: mitmproxy 0.16
* Completely revised HTTP2 implementation based on hyper-h2 (Thomas Kriechbaumer) * Completely revised HTTP2 implementation based on hyper-h2 (Thomas Kriechbaumer)
@ -643,7 +641,6 @@ If you depend on these features, please raise your voice in
* Big improvements to fuzzing, including random spec selection and memoization to avoid repeating randomly generated patterns * Big improvements to fuzzing, including random spec selection and memoization to avoid repeating randomly generated patterns
* Reflected patterns, allowing you to embed a pathod server response specification in a pathoc request, resolving both on client side. This makes fuzzing proxies and other intermediate systems much better. * Reflected patterns, allowing you to embed a pathod server response specification in a pathoc request, resolving both on client side. This makes fuzzing proxies and other intermediate systems much better.
## 28 January 2014: mitmproxy 0.10 ## 28 January 2014: mitmproxy 0.10
* Support for multiple scripts and multiple script arguments * Support for multiple scripts and multiple script arguments
@ -725,7 +722,6 @@ If you depend on these features, please raise your voice in
* Pathoc client certificate support. * Pathoc client certificate support.
* API improvements, bugfixes. * API improvements, bugfixes.
## 16 November 2012: pathod 0.3 ## 16 November 2012: pathod 0.3
A release focusing on shoring up our fuzzing capabilities, especially with A release focusing on shoring up our fuzzing capabilities, especially with

View File

@ -14,10 +14,11 @@ forward, please consider contributing in the following areas:
## Development Setup ## Development Setup
To get started hacking on mitmproxy, please install a recent version of Python (we require at least Python 3.8). To get started hacking on mitmproxy, please install a recent version of Python (we require at least Python 3.8).
Then, do the following: Then, do the following:
##### Linux / macOS ##### Linux / macOS
```shell ```shell
# 1) Verify that these commands work: # 1) Verify that these commands work:
python3 --version python3 --version
@ -31,6 +32,7 @@ venv/bin/pip install -e ".[dev]"
``` ```
##### Windows ##### Windows
```shell ```shell
# 1) Verify that this command works: # 1) Verify that this command works:
python --version python --version
@ -49,12 +51,14 @@ The main executables for the project `mitmdump`, `mitmproxy`, and `mitmweb`
After activating the virtualenv, they will be on your $PATH, and you can run them like any other command: After activating the virtualenv, they will be on your $PATH, and you can run them like any other command:
##### Linux / macOS ##### Linux / macOS
```shell ```shell
source venv/bin/activate source venv/bin/activate
mitmdump --version mitmdump --version
``` ```
##### Windows ##### Windows
```shell ```shell
venv\Scripts\activate venv\Scripts\activate
mitmdump --version mitmdump --version

View File

@ -5,7 +5,6 @@
[![Latest Version](https://shields.mitmproxy.org/pypi/v/mitmproxy.svg)](https://pypi.python.org/pypi/mitmproxy) [![Latest Version](https://shields.mitmproxy.org/pypi/v/mitmproxy.svg)](https://pypi.python.org/pypi/mitmproxy)
[![Supported Python versions](https://shields.mitmproxy.org/pypi/pyversions/mitmproxy.svg)](https://pypi.python.org/pypi/mitmproxy) [![Supported Python versions](https://shields.mitmproxy.org/pypi/pyversions/mitmproxy.svg)](https://pypi.python.org/pypi/mitmproxy)
``mitmproxy`` is an interactive, SSL/TLS-capable intercepting proxy with a console ``mitmproxy`` is an interactive, SSL/TLS-capable intercepting proxy with a console
interface for HTTP/1, HTTP/2, and WebSockets. interface for HTTP/1, HTTP/2, and WebSockets.
@ -34,12 +33,9 @@ ask them on StackOverflow!
[![StackOverflow: mitmproxy](https://shields.mitmproxy.org/stackexchange/stackoverflow/t/mitmproxy?color=orange&label=stackoverflow%20questions)](https://stackoverflow.com/questions/tagged/mitmproxy) [![StackOverflow: mitmproxy](https://shields.mitmproxy.org/stackexchange/stackoverflow/t/mitmproxy?color=orange&label=stackoverflow%20questions)](https://stackoverflow.com/questions/tagged/mitmproxy)
## Contributing ## Contributing
As an open source project, mitmproxy welcomes contributions of all forms. As an open source project, mitmproxy welcomes contributions of all forms.
[![Dev Guide](https://shields.mitmproxy.org/badge/dev_docs-CONTRIBUTING.md-blue)](./CONTRIBUTING.md) [![Dev Guide](https://shields.mitmproxy.org/badge/dev_docs-CONTRIBUTING.md-blue)](./CONTRIBUTING.md)

View File

@ -12,7 +12,6 @@ This directory houses the mitmproxy documentation available at <https://docs.mit
Now you can run `hugo server -D` in ./src. Now you can run `hugo server -D` in ./src.
## Extended Install ## Extended Install
This is required to modify CSS files. This is required to modify CSS files.

View File

@ -10,7 +10,6 @@ menu:
mitmproxy is a set of tools that provide an interactive, SSL/TLS-capable intercepting proxy for HTTP/1, HTTP/2, and WebSockets. mitmproxy is a set of tools that provide an interactive, SSL/TLS-capable intercepting proxy for HTTP/1, HTTP/2, and WebSockets.
## Features ## Features
- Intercept HTTP & HTTPS requests and responses and modify them on the fly - Intercept HTTP & HTTPS requests and responses and modify them on the fly
@ -23,7 +22,6 @@ mitmproxy is a set of tools that provide an interactive, SSL/TLS-capable interce
- SSL/TLS certificates for interception are generated on the fly - SSL/TLS certificates for interception are generated on the fly
- And [much, much more...]({{< relref "overview-features">}}) - And [much, much more...]({{< relref "overview-features">}})
## 3 Powerful Core Tools ## 3 Powerful Core Tools
The mitmproxy project's tools are a set of front-ends that expose common The mitmproxy project's tools are a set of front-ends that expose common
@ -77,7 +75,6 @@ tcpdump-like functionality to let you view, record, and programmatically
transform HTTP traffic. See the `--help` flag output for complete transform HTTP traffic. See the `--help` flag output for complete
documentation. documentation.
#### Example: Saving traffic #### Example: Saving traffic
```bash ```bash
@ -131,4 +128,3 @@ mitmdump -ns examples/simple/add_header.py -r srcfile -w dstfile
This command loads flows from **srcfile**, transforms it according to This command loads flows from **srcfile**, transforms it according to
the specified script, then writes it back to **dstfile**. the specified script, then writes it back to **dstfile**.

View File

@ -19,7 +19,6 @@ header with a count of the number of responses seen:
{{< example src="examples/addons/http-add-header.py" lang="py" >}} {{< example src="examples/addons/http-add-header.py" lang="py" >}}
## Available Hooks ## Available Hooks
The following addons list all available event hooks. The following addons list all available event hooks.

View File

@ -14,7 +14,6 @@ invocations and data returned from commands are checked at runtime. Commands are
a very powerful construct - for instance, all user interaction in mitmproxy a very powerful construct - for instance, all user interaction in mitmproxy
console are built by binding commands to keys. console are built by binding commands to keys.
## Simple example ## Simple example
Let's begin with a simple example. Let's begin with a simple example.
@ -46,7 +45,6 @@ builtin commands. There are a few things to note about this example:
included in the built-in help, the command editor in mitmproxy console can included in the built-in help, the command editor in mitmproxy console can
perform sophisticated completion and error checking, and so forth. perform sophisticated completion and error checking, and so forth.
## Working with flows ## Working with flows
Since command arguments are typed, we can provide special conveniences for Since command arguments are typed, we can provide special conveniences for
@ -95,7 +93,6 @@ mitmproxy if we plan to use them frequently. Flow selectors combined with
commands are amazingly powerful, and lets us build and expose re-usable functions commands are amazingly powerful, and lets us build and expose re-usable functions
for operating on flows. for operating on flows.
## Paths ## Paths
Commands can take an arbitrary number of arguments. Let's build on the previous Commands can take an arbitrary number of arguments. Let's build on the previous
@ -114,8 +111,6 @@ command. Try invoking it like this:
Notice that mitmproxy provides tab completion both for the flow specification Notice that mitmproxy provides tab completion both for the flow specification
and the path. and the path.
## Supported Types ## Supported Types
The following types are supported for options. If you need to use a type not The following types are supported for options. If you need to use a type not

View File

@ -1,4 +1,3 @@
--- ---
title: "Examples" title: "Examples"
menu: menu:

View File

@ -18,7 +18,6 @@ presenting typed values for editing in interactive programs. Attempting to set a
value with the wrong type will result in an error. This means that addon options value with the wrong type will result in an error. This means that addon options
get full support throughout mitmproxy's toolchain simply by declaring a type. get full support throughout mitmproxy's toolchain simply by declaring a type.
## Simple example ## Simple example
{{< example src="examples/addons/options-simple.py" lang="py" >}} {{< example src="examples/addons/options-simple.py" lang="py" >}}
@ -62,7 +61,6 @@ using the `--set` flag:
mitmproxy -s ./examples/addons/options-simple.py --set addheader=true mitmproxy -s ./examples/addons/options-simple.py --set addheader=true
``` ```
## Handling configuration updates ## Handling configuration updates
Sometimes, simply testing the value of an option from an event is not Sometimes, simply testing the value of an option from an event is not
@ -91,7 +89,6 @@ Loading script: ./examples/addons/options-configure.py
/Users/cortesi/mitmproxy/mitmproxy/venv/bin/mitmdump: addheader must be <= 100 /Users/cortesi/mitmproxy/mitmproxy/venv/bin/mitmdump: addheader must be <= 100
``` ```
## Supported Types ## Supported Types
The following types are supported for options. The following types are supported for options.

View File

@ -8,19 +8,18 @@ menu:
# Addons # Addons
Mitmproxy's addon mechanism is an exceptionally powerful part of mitmproxy. In fact, much of mitmproxy's own Mitmproxy's addon mechanism is an exceptionally powerful part of mitmproxy. In fact, much of mitmproxy's own
functionality is defined in functionality is defined in
[a suite of built-in addons](https://github.com/mitmproxy/mitmproxy/tree/master/mitmproxy/addons), [a suite of built-in addons](https://github.com/mitmproxy/mitmproxy/tree/master/mitmproxy/addons),
implementing everything from functionality like implementing everything from functionality like
[anticaching]({{< relref "overview-features#anticache" >}}) and [sticky cookies]({{< relref [anticaching]({{< relref "overview-features#anticache" >}}) and [sticky cookies]({{< relref
"overview-features#sticky-cookies" >}}) to our onboarding webapp. "overview-features#sticky-cookies" >}}) to our onboarding webapp.
Addons interact with mitmproxy by responding to [events]({{< relref addons-api >}}), which allow them to hook into and Addons interact with mitmproxy by responding to [events]({{< relref addons-api >}}), which allow them to hook into and
change mitmproxy's behaviour. They are configured through [options]({{< relref addons-options >}}), which can be set in change mitmproxy's behaviour. They are configured through [options]({{< relref addons-options >}}), which can be set in
mitmproxy's config file, changed interactively by users, or passed on the command-line. Finally, they can expose mitmproxy's config file, changed interactively by users, or passed on the command-line. Finally, they can expose
[commands]({{< relref addons-commands >}}), which allows users to invoke their actions either directly or by binding [commands]({{< relref addons-commands >}}), which allows users to invoke their actions either directly or by binding
them to keys in the interactive tools. them to keys in the interactive tools.
# Anatomy of an addon # Anatomy of an addon
{{< example src="examples/addons/anatomy.py" lang="py" >}} {{< example src="examples/addons/anatomy.py" lang="py" >}}
@ -52,12 +51,11 @@ Here are a few things to note about the code above:
an importable global. In this case, we're using the `ctx.log` object to do our an importable global. In this case, we're using the `ctx.log` object to do our
logging. logging.
# Abbreviated Scripting Syntax # Abbreviated Scripting Syntax
Sometimes, we would like to write a quick script without going through the trouble of creating a class. Sometimes, we would like to write a quick script without going through the trouble of creating a class.
The addons mechanism has a shorthand that allows a module as a whole to be treated as an addon object. The addons mechanism has a shorthand that allows a module as a whole to be treated as an addon object.
This lets us place event handler functions in the module scope. This lets us place event handler functions in the module scope.
For instance, here is a complete script that adds a header to every request: For instance, here is a complete script that adds a header to every request:
{{< example src="examples/addons/anatomy2.py" lang="py" >}} {{< example src="examples/addons/anatomy2.py" lang="py" >}}

View File

@ -21,7 +21,6 @@ all registered commands, their arguments and their return values to screen. In
mimtproxy console you can also view a palette of all commands in the command mimtproxy console you can also view a palette of all commands in the command
browser (by default accessible with the `C` key binding). browser (by default accessible with the `C` key binding).
# Working with Flows # Working with Flows
Many of mitmproxy's commands take flows as arguments. For instance, the Many of mitmproxy's commands take flows as arguments. For instance, the
@ -31,7 +30,6 @@ signature for the client replay commands looks like this:
replay.client [flow] replay.client [flow]
``` ```
That means that it expects a sequence of one or more flows. This is where [flow That means that it expects a sequence of one or more flows. This is where [flow
specifications]({{< relref concepts-filters >}}) come in - mitmproxy will specifications]({{< relref concepts-filters >}}) come in - mitmproxy will
intelligently expand a flexible flow selection language to a list of flows when intelligently expand a flexible flow selection language to a list of flows when

View File

@ -18,7 +18,6 @@ expressions consist of the following operators:
- Strings with no operators are matched against the request URL. - Strings with no operators are matched against the request URL.
- The default binary operator is &. - The default binary operator is &.
## View flow selectors ## View flow selectors
In interactive contexts, mitmproxy has a set of convenient flow selectors that In interactive contexts, mitmproxy has a set of convenient flow selectors that
@ -35,7 +34,6 @@ operate on the current view:
These are frequently used in commands and key bindings. These are frequently used in commands and key bindings.
## Examples ## Examples
URL containing "google.com": URL containing "google.com":
@ -53,4 +51,3 @@ Anything but requests with a text/html content type:
Replace entire GET string in a request (quotes required to make it work): Replace entire GET string in a request (quotes required to make it work):
":~q ~m GET:.*:/replacement.html" ":~q ~m GET:.*:/replacement.html"

View File

@ -33,14 +33,11 @@ This is a proxy GET request - an extended form of the vanilla HTTP GET
request that includes a schema and host specification, and it includes request that includes a schema and host specification, and it includes
all the information mitmproxy needs to proceed. all the information mitmproxy needs to proceed.
{{< figure src="/schematics/how-mitmproxy-works-explicit.png" title="Explicit" >}} {{< figure src="/schematics/how-mitmproxy-works-explicit.png" title="Explicit" >}}
1. The client connects to the proxy and makes a request. 1. The client connects to the proxy and makes a request.
2. Mitmproxy connects to the upstream server and simply forwards the request on. 2. Mitmproxy connects to the upstream server and simply forwards the request on.
## Explicit HTTPS ## Explicit HTTPS
The process for an explicitly proxied HTTPS connection is quite The process for an explicitly proxied HTTPS connection is quite

View File

@ -17,7 +17,6 @@ Now, which one should you pick? Use this flow chart:
{{< figure src="/schematics/proxy-modes-flowchart.png" >}} {{< figure src="/schematics/proxy-modes-flowchart.png" >}}
## Regular Proxy ## Regular Proxy
Mitmproxy's regular mode is the simplest and the easiest to set up. Mitmproxy's regular mode is the simplest and the easiest to set up.
@ -183,7 +182,6 @@ One possible way to address this is to modify the hosts file of your OS so that
directly to example.com. Make sure that your proxy can still resolve the directly to example.com. Make sure that your proxy can still resolve the
original IP, or specify an IP in mitmproxy. original IP, or specify an IP in mitmproxy.
{{% note %}} {{% note %}}
### Caveat: Interactive Use ### Caveat: Interactive Use
@ -195,7 +193,6 @@ remains unchanged - as soon as the user clicks on an non-relative URL
through mitmproxy. through mitmproxy.
{{% /note %}} {{% /note %}}
## Upstream Proxy ## Upstream Proxy
If you want to chain proxies by adding mitmproxy in front of a different If you want to chain proxies by adding mitmproxy in front of a different
@ -210,7 +207,6 @@ proxy mode. You could in theory chain multiple mitmproxy instances in a
row, but that doesn't make any sense in practice (i.e. outside of our row, but that doesn't make any sense in practice (i.e. outside of our
tests). tests).
## SOCKS Proxy ## SOCKS Proxy
In this mode, mitmproxy acts as a SOCKS5 proxy. In this mode, mitmproxy acts as a SOCKS5 proxy.

View File

@ -25,7 +25,6 @@ are treated exactly like mitmproxy's own. This means that addons can also be
configured through the central configuration file, and their options will appear configured through the central configuration file, and their options will appear
in the options editors in interactive tools. in the options editors in interactive tools.
## Tools ## Tools
Both **mitmproxy** and **mitmweb** have built-in editors that let you view and Both **mitmproxy** and **mitmweb** have built-in editors that let you view and
@ -37,7 +36,6 @@ the specific tool's interactive help for details on how to do this).
For all tools, options can be set directly by name using the `--set` For all tools, options can be set directly by name using the `--set`
command-line option. Please see the command-line help (`--help`) for usage. command-line option. Please see the command-line help (`--help`) for usage.
## Available Options ## Available Options
This list might not reflect what is actually available in your current mitmproxy This list might not reflect what is actually available in your current mitmproxy

View File

@ -23,7 +23,6 @@ If you want to peek into (SSL-protected) non-HTTP connections, check out the
**tcp_proxy** feature. If you want to ignore traffic from mitmproxy's processing **tcp_proxy** feature. If you want to ignore traffic from mitmproxy's processing
because of large response bodies, take a look at the [streaming]({{< relref "overview-features#streaming" >}}) feature. because of large response bodies, take a look at the [streaming]({{< relref "overview-features#streaming" >}}) feature.
## ignore_hosts ## ignore_hosts
The `ignore_hosts` option allows you to specify a regex which is matched against The `ignore_hosts` option allows you to specify a regex which is matched against
@ -35,7 +34,6 @@ are excluded from interception, and passed on unmodified.
| command-line alias | `--ignore-hosts regex` | | command-line alias | `--ignore-hosts regex` |
| mitmproxy option | `ignore_hosts` | | mitmproxy option | `ignore_hosts` |
## Limitations ## Limitations
There are two important quirks to consider: There are two important quirks to consider:
@ -59,7 +57,6 @@ method to do so:
2. Take the `host:port` string, surround it with ^ and $, escape all dots (. 2. Take the `host:port` string, surround it with ^ and $, escape all dots (.
becomes \\.) and use this as your ignore pattern: becomes \\.) and use this as your ignore pattern:
``` ```
>>> mitmdump -v >>> mitmdump -v
127.0.0.1:50588: clientconnect 127.0.0.1:50588: clientconnect

View File

@ -15,27 +15,31 @@ Please note, that apps can decide to ignore the system certificate store and mai
## 1. Prerequisites ## 1. Prerequisites
- Emulator from Android SDK with proxy settings pointing to mitmproxy - Emulator from Android SDK with proxy settings pointing to mitmproxy
- Mitmproxy CA certificate
- Usually located in `~/.mitmproxy/mitmproxy-ca-cert.cer`
- If the folder is empty or does not exist, run `mitmproxy` in order to generate the certificates
- Mitmproxy CA certificate
- Usually located in `~/.mitmproxy/mitmproxy-ca-cert.cer`
- If the folder is empty or does not exist, run `mitmproxy` in order to generate the certificates
## 2. Rename certificate ## 2. Rename certificate
Enter your certificate folder Enter your certificate folder
```bash ```bash
cd ~/.mitmproxy/ cd ~/.mitmproxy/
``` ```
- CA Certificates in Android are stored by the name of their hash, with a '0' as extension - CA Certificates in Android are stored by the name of their hash, with a '0' as extension
- Now generate the hash of your certificate - Now generate the hash of your certificate
```bash ```bash
openssl x509 -inform PEM -subject_hash_old -in mitmproxy-ca-cert.cer | head -1 openssl x509 -inform PEM -subject_hash_old -in mitmproxy-ca-cert.cer | head -1
``` ```
Lets assume, the output is `c8450d0d` Lets assume, the output is `c8450d0d`
We can now copy `mitmproxy-ca-cert.cer` to `c8450d0d.0` and our system certificate is ready to use We can now copy `mitmproxy-ca-cert.cer` to `c8450d0d.0` and our system certificate is ready to use
```bash ```bash
cp mitmproxy-ca-cert.cer c8450d0d.0 cp mitmproxy-ca-cert.cer c8450d0d.0
``` ```
@ -44,30 +48,30 @@ cp mitmproxy-ca-cert.cer c8450d0d.0
Note, that Android 9 (API LEVEL 28) was used to test the following steps and that the `emulator` executable is located in the Android SDK Note, that Android 9 (API LEVEL 28) was used to test the following steps and that the `emulator` executable is located in the Android SDK
- Start your android emulator. - Start your android emulator.
- Get a list of your AVDs with `emulator -list-avds` - Get a list of your AVDs with `emulator -list-avds`
- Make sure to use the `-writable-system` option. Otherwise it will not be possible to write to `/system` - Make sure to use the `-writable-system` option. Otherwise it will not be possible to write to `/system`
- Keep in mind, that the **emulator will load a clean system image when starting without `-writable-system` option**. - Keep in mind, that the **emulator will load a clean system image when starting without `-writable-system` option**.
- This means you always have to start the emulator with `-writable-system` option in order to use your certificate - This means you always have to start the emulator with `-writable-system` option in order to use your certificate
```bash ```bash
emulator -avd <avd_name_here> -writable-system emulator -avd <avd_name_here> -writable-system
``` ```
- Restart adb as root - Restart adb as root
```bash ```bash
adb root adb root
``` ```
- Get write access to `/system` on the device - Get write access to `/system` on the device
- In earlier versions (API LEVEL < 28) of Android you have to use `adb shell "mount -o rw,remount /system"` - In earlier versions (API LEVEL < 28) of Android you have to use `adb shell "mount -o rw,remount /system"`
```bash ```bash
adb shell "mount -o rw,remount /" adb shell "mount -o rw,remount /"
``` ```
- Push your certificate to the system certificate store and set file permissions - Push your certificate to the system certificate store and set file permissions
```bash ```bash
adb push c8450d0d.0 /system/etc/security/cacerts adb push c8450d0d.0 /system/etc/security/cacerts
@ -76,9 +80,9 @@ adb shell "chmod 664 /system/etc/security/cacerts/c8450d0d.0"
## 4. Reboot device and enjoy decrypted TLS traffic ## 4. Reboot device and enjoy decrypted TLS traffic
- Reboot your device. - Reboot your device.
- You CA certificate should now be system trusted - You CA certificate should now be system trusted
```bash ```bash
adb reboot adb reboot
``` ```

View File

@ -24,12 +24,10 @@ Usually with Ubuntu and Virtualbox, **eth0** or **enp0s3** (Ubuntu 15.10 and new
### VirtualBox configuration ### VirtualBox configuration
{{< figure src="/transparent-vms/step1_vbox_eth0.png" >}} {{< figure src="/transparent-vms/step1_vbox_eth0.png" >}}
{{< figure src="/transparent-vms/step1_vbox_eth1.png" >}} {{< figure src="/transparent-vms/step1_vbox_eth1.png" >}}
### VM Network Configuration ### VM Network Configuration
{{< figure src="/transparent-vms/step1_proxy.png" >}} {{< figure src="/transparent-vms/step1_proxy.png" >}}

View File

@ -26,7 +26,6 @@ connection.
At the moment, mitmproxy supports transparent proxying on OSX Lion and above, At the moment, mitmproxy supports transparent proxying on OSX Lion and above,
and all current flavors of Linux. and all current flavors of Linux.
## Linux ## Linux
On Linux, mitmproxy integrates with the iptables redirection mechanism to On Linux, mitmproxy integrates with the iptables redirection mechanism to
@ -107,12 +106,11 @@ ip6tables -t nat -A OUTPUT -p tcp -m owner ! --uid-owner mitmproxyuser --dport 4
``` ```
This will redirect the packets from all users other than `mitmproxyuser` on the machine to mitmproxy. To avoid circularity, run mitmproxy as the user `mitmproxyuser`. Hence step **4** should look like: This will redirect the packets from all users other than `mitmproxyuser` on the machine to mitmproxy. To avoid circularity, run mitmproxy as the user `mitmproxyuser`. Hence step **4** should look like:
```bash ```bash
sudo -u mitmproxyuser -H bash -c '$HOME/.local/bin/mitmproxy --mode transparent --showhost --set block_global=false' sudo -u mitmproxyuser -H bash -c '$HOME/.local/bin/mitmproxy --mode transparent --showhost --set block_global=false'
``` ```
## OpenBSD ## OpenBSD
### 1. Enable IP forwarding. ### 1. Enable IP forwarding.
@ -160,8 +158,6 @@ mitmproxy to use the value of the Host header for URL display.
Set the test device up to use the host on which mitmproxy is running as the default gateway and Set the test device up to use the host on which mitmproxy is running as the default gateway and
[install the mitmproxy certificate authority on the test device]({{< relref "concepts-certificates" >}}). [install the mitmproxy certificate authority on the test device]({{< relref "concepts-certificates" >}}).
{{% note %}} {{% note %}}
Note that the **divert-to** rules in the pf.conf given above only apply 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 to inbound traffic. **This means that they will NOT redirect traffic
@ -174,7 +170,6 @@ intercepting traffic emanating from VMs. See the **pf.conf** man page
for more. for more.
{{% /note %}} {{% /note %}}
## macOS ## macOS
OSX Lion integrated the [pf](https://en.wikipedia.org/wiki/PF_(firewall)) OSX Lion integrated the [pf](https://en.wikipedia.org/wiki/PF_(firewall))
@ -190,7 +185,6 @@ sudo sysctl -w net.inet.ip.forwarding=1
### 2. Place the following line in a file called, say, **pf.conf**. ### 2. Place the following line in a file called, say, **pf.conf**.
``` ```
rdr pass on en0 inet proto tcp to any port {80, 443} -> 127.0.0.1 port 8080 rdr pass on en0 inet proto tcp to any port {80, 443} -> 127.0.0.1 port 8080
``` ```

View File

@ -13,9 +13,11 @@ Wireshark can use these log files to decrypt packets. See the [Wireshark wiki](h
Key logging is enabled by setting the environment variable `SSLKEYLOGFILE` so Key logging is enabled by setting the environment variable `SSLKEYLOGFILE` so
that it points to a writable text file: that it points to a writable text file:
```bash ```bash
SSLKEYLOGFILE="$PWD/.mitmproxy/sslkeylogfile.txt" mitmproxy SSLKEYLOGFILE="$PWD/.mitmproxy/sslkeylogfile.txt" mitmproxy
``` ```
You can also `export` this environment variable to make it persistent for all applications started from your current shell session. You can also `export` this environment variable to make it persistent for all applications started from your current shell session.
You can specify the key file path in Wireshark via `Edit -> Preferences -> You can specify the key file path in Wireshark via `Edit -> Preferences ->

View File

@ -7,7 +7,6 @@ menu:
# Features # Features
- [Anticache](#anticache) - [Anticache](#anticache)
- [Client-side replay](#client-side-replay) - [Client-side replay](#client-side-replay)
- [Map Local](#map-local) - [Map Local](#map-local)
@ -21,7 +20,6 @@ menu:
- [Streaming](#streaming) - [Streaming](#streaming)
- [Upstream Certificates](#upstream-certificates) - [Upstream Certificates](#upstream-certificates)
## Anticache ## Anticache
When the `anticache` option is set, it removes headers (`if-none-match` and When the `anticache` option is set, it removes headers (`if-none-match` and
@ -30,7 +28,6 @@ server. This is useful when you want to make sure you capture an HTTP exchange
in its totality. It's also often used during client-side replay, when you want in its totality. It's also often used during client-side replay, when you want
to make sure the server responds with complete data. to make sure the server responds with complete data.
## Client-side replay ## Client-side replay
Client-side replay does what it says on the tin: you provide a previously saved Client-side replay does what it says on the tin: you provide a previously saved
@ -42,7 +39,6 @@ conversation, where requests may have been made concurrently.
You may want to use client-side replay in conjunction with the `anticache` You may want to use client-side replay in conjunction with the `anticache`
option, to make sure the server responds with complete data. option, to make sure the server responds with complete data.
## Map Local ## Map Local
The `map_local` option lets you specify an arbitrary number of patterns that The `map_local` option lets you specify an arbitrary number of patterns that
@ -115,9 +111,6 @@ Served File: Preferred: <span style="color:#82b719">~/static-dir
Otherwise: 404 response without content Otherwise: 404 response without content
</pre> </pre>
## Map Remote ## Map Remote
The `map_remote` option lets you specify an arbitrary number of patterns that The `map_remote` option lets you specify an arbitrary number of patterns that
@ -159,7 +152,6 @@ Re-route all GET requests from `example.org` to `mitmproxy.org` (using `|` as th
|~m GET|//example.org/|//mitmproxy.org/ |~m GET|//example.org/|//mitmproxy.org/
``` ```
## Modify Body ## Modify Body
The `modify_body` option lets you specify an arbitrary number of patterns that The `modify_body` option lets you specify an arbitrary number of patterns that
@ -204,7 +196,6 @@ Replace `foo` with the data read from `~/xss-exploit`:
mitmdump --modify-body :~q:foo:@~/xss-exploit mitmdump --modify-body :~q:foo:@~/xss-exploit
``` ```
## Modify Headers ## Modify Headers
The `modify_headers` option lets you specify a set of headers to be modified. The `modify_headers` option lets you specify a set of headers to be modified.
@ -277,7 +268,7 @@ upstream servers. For now, only HTTP Basic Authentication is supported.
Proxy Authentication does not work well in transparent proxy mode by design Proxy Authentication does not work well in transparent proxy mode by design
because the client is not aware that it is talking to a proxy. because the client is not aware that it is talking to a proxy.
Mitmproxy will re-request credentials for every individual domain. Mitmproxy will re-request credentials for every individual domain.
SOCKS proxy authentication is currently unimplemented SOCKS proxy authentication is currently unimplemented
([#738](https://github.com/mitmproxy/mitmproxy/issues/738)). ([#738](https://github.com/mitmproxy/mitmproxy/issues/738)).
## Server-side replay ## Server-side replay
@ -322,7 +313,6 @@ then the respective recorded responses are simply replayed by mitmproxy.
Otherwise, the unmatched requests is forwarded to the upstream server. If 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. forwarding is not desired, you can use the --kill (-k) switch to prevent that.
## Sticky auth ## Sticky auth
The `stickyauth` option is analogous to the sticky cookie option, in that HTTP The `stickyauth` option is analogous to the sticky cookie option, in that HTTP
@ -332,7 +322,6 @@ authentication through the proxy. Note that <span
data-role="program">mitmproxy</span> doesn't (yet) support replay of HTTP Digest data-role="program">mitmproxy</span> doesn't (yet) support replay of HTTP Digest
authentication. authentication.
## Sticky cookies ## Sticky cookies
When the `stickycookie` option is set, **mitmproxy** will add the cookie most When the `stickycookie` option is set, **mitmproxy** will add the cookie most
@ -350,7 +339,6 @@ replay]({{< relref "#client-side-replay" >}}) - you can record the
authentication process once, and simply replay it on startup every time you need authentication process once, and simply replay it on startup every time you need
to interact with the secured resources. to interact with the secured resources.
## Streaming ## Streaming
By default, mitmproxy will read an entire request/response, perform any By default, mitmproxy will read an entire request/response, perform any
@ -380,7 +368,6 @@ payload sent to the server as the frames are immediately forwarded to the
server. In contrast to HTTP streaming, where the body is not stored, the message server. In contrast to HTTP streaming, where the body is not stored, the message
payload will still be stored in the WebSocket flow. payload will still be stored in the WebSocket flow.
## Upstream Certificates ## Upstream Certificates
When mitmproxy receives a connection destined for an SSL-protected service, it When mitmproxy receives a connection destined for an SSL-protected service, it

View File

@ -11,18 +11,16 @@ menu:
We assume you have already [installed]({{< relref "overview-installation">}}) mitmproxy on We assume you have already [installed]({{< relref "overview-installation">}}) mitmproxy on
your machine. your machine.
## Launch the tool you need ## Launch the tool you need
You can start any of our three tools from the command line / terminal. You can start any of our three tools from the command line / terminal.
* **mitmproxy** gives you an interactive TUI * **mitmproxy** gives you an interactive TUI
* **mitmweb** gives you a browser-based GUI * **mitmweb** gives you a browser-based GUI
* **mitmdump** gives you a plain and simple terminal output * **mitmdump** gives you a plain and simple terminal output
In case you use the console-based version of mitmproxy, we highly recommend you to take the [tutorial]({{< relref "mitmproxytutorial-userinterface" >}}) to get started. In case you use the console-based version of mitmproxy, we highly recommend you to take the [tutorial]({{< relref "mitmproxytutorial-userinterface" >}}) to get started.
## Configure your browser or device ## Configure your browser or device
For the basic setup as [regular proxy]({{< relref For the basic setup as [regular proxy]({{< relref
@ -40,7 +38,6 @@ Authority - which is also the next steps. Follow the instructions for your OS /
system and install the CA (and make sure to enable it, some system require system and install the CA (and make sure to enable it, some system require
multiple steps!). multiple steps!).
## Verifying everything works ## Verifying everything works
At this point your running mitmproxy instance should already show the first HTTP At this point your running mitmproxy instance should already show the first HTTP
@ -48,7 +45,6 @@ flows from your client. You can test that all TLS-encrypted web traffic is
working as expected by browsing to https://mitmproxy.org - it should show up as working as expected by browsing to https://mitmproxy.org - it should show up as
new flow and you can inspect it. new flow and you can inspect it.
## Resources ## Resources
* [**StackOverflow**](https://stackoverflow.com/questions/tagged/mitmproxy): If you want to ask usage questions, please do so on StackOverflow. * [**StackOverflow**](https://stackoverflow.com/questions/tagged/mitmproxy): If you want to ask usage questions, please do so on StackOverflow.

View File

@ -1,9 +1,8 @@
# Mitmproxy Examples # Mitmproxy Examples
Mitmproxy has a powerful scripting API that allows you to control almost any aspect of traffic being 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 proxied. In fact, much of mitmproxys own core functionality is implemented using the exact same API
(see [mitmproxy/addons](../mitmproxy/addons)). (see [mitmproxy/addons](../mitmproxy/addons)).
| :warning: | If you are browsing this on GitHub, make sure to select the git tag matching your mitmproxy version. | | :warning: | If you are browsing this on GitHub, make sure to select the git tag matching your mitmproxy version. |
|------------|------------------------------------------------------------------------------------------------------| |------------|------------------------------------------------------------------------------------------------------|

View File

@ -1,4 +1,4 @@
# Community-Contributed Examples # Community-Contributed Examples
Examples in this directory are contributed by the mitmproxy community. Examples in this directory are contributed by the mitmproxy community.
We do _not_ maintain them, but we welcome PRs that add/fix/modernize/clean up examples. We do _not_ maintain them, but we welcome PRs that add/fix/modernize/clean up examples.

View File

@ -7,11 +7,12 @@ These steps assume you are on the correct branch and have a git remote called `o
- Verify that all CI tests pass. - Verify that all CI tests pass.
- Verify that `mitmproxy/version.py` is correct. Remove `.dev` suffix if it exists. - Verify that `mitmproxy/version.py` is correct. Remove `.dev` suffix if it exists.
- Tag the release and push to Github. - Tag the release and push to Github.
- `git tag v4.0.0` - `git tag v4.0.0`
- `git push origin v4.0.0` - `git push origin v4.0.0`
- Wait for tag CI to complete. - Wait for tag CI to complete.
### GitHub Releases ### GitHub Releases
- Create release notice on Github - Create release notice on Github
[here](https://github.com/mitmproxy/mitmproxy/releases/new) if not already [here](https://github.com/mitmproxy/mitmproxy/releases/new) if not already
auto-created by the tag. auto-created by the tag.
@ -20,36 +21,41 @@ These steps assume you are on the correct branch and have a git remote called `o
`You can find the latest release packages at https://mitmproxy.org/downloads/.` `You can find the latest release packages at https://mitmproxy.org/downloads/.`
### PyPi ### PyPi
- The created wheel is uploaded to PyPi automatically. - The created wheel is uploaded to PyPi automatically.
- Please verify that https://pypi.python.org/pypi/mitmproxy has the latest version. - Please verify that https://pypi.python.org/pypi/mitmproxy has the latest version.
### Homebrew ### Homebrew
- The Homebrew maintainers are typically very fast and detect our new relese - The Homebrew maintainers are typically very fast and detect our new relese
within a day. within a day.
- If you feel the need, you can run this from a macOS machine: - If you feel the need, you can run this from a macOS machine:
`brew bump-formula-pr --url https://github.com/mitmproxy/mitmproxy/archive/v<version number here>.tar.gz mitmproxy` `brew bump-formula-pr --url https://github.com/mitmproxy/mitmproxy/archive/v<version number here>.tar.gz mitmproxy`
### Docker ### Docker
- The docker image is built by our CI workers and pushed to Docker Hub automatically. - The docker image is built by our CI workers and pushed to Docker Hub automatically.
- Please verify that https://hub.docker.com/r/mitmproxy/mitmproxy/tags/ has the latest version. - Please verify that https://hub.docker.com/r/mitmproxy/mitmproxy/tags/ has the latest version.
- Please verify that the latest tag points to the most recent image (same digest / hash). - Please verify that the latest tag points to the most recent image (same digest / hash).
### Docs ### Docs
- `./build.sh`. If everything looks alright, continue with
- `./upload-stable.sh`, - `./build.sh`. If everything looks alright, continue with
- `DOCS_ARCHIVE=true ./build.sh`, and - `./upload-stable.sh`,
- `./upload-archive.sh v4`. Doing this now already saves you from switching back to an old state on the next release. - `DOCS_ARCHIVE=true ./build.sh`, and
- `./upload-archive.sh v4`. Doing this now already saves you from switching back to an old state on the next release.
### Website ### Website
- The website does not need to be updated for patch releases. New versions are automatically picked up once they are on the download server.
- Update version here:
https://github.com/mitmproxy/www/blob/master/src/config.toml
- Update docs menu here:
https://github.com/mitmproxy/www/blob/master/src/themes/mitmproxy/layouts/partials/header.html
- Run `./build && ./upload-test`.
- If everything looks alright at https://www-test.mitmproxy.org, run `./upload-prod`.
- The website does not need to be updated for patch releases. New versions are automatically picked up once they are on the download server.
- Update version here:
https://github.com/mitmproxy/www/blob/master/src/config.toml
- Update docs menu here:
https://github.com/mitmproxy/www/blob/master/src/themes/mitmproxy/layouts/partials/header.html
- Run `./build && ./upload-test`.
- If everything looks alright at https://www-test.mitmproxy.org, run `./upload-prod`.
### Prepare for next release ### Prepare for next release
- Last but not least, bump the major version on master in
- Last but not least, bump the major version on master in
[https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/version.py](mitmproxy/version.py) and add a `.dev` suffix. [https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/version.py](mitmproxy/version.py) and add a `.dev` suffix.

View File

@ -7,26 +7,31 @@ Containerized version of [mitmproxy](https://mitmproxy.org/): an interactive, SS
```sh ```sh
$ docker run --rm -it [-v ~/.mitmproxy:/home/mitmproxy/.mitmproxy] -p 8080:8080 mitmproxy/mitmproxy $ docker run --rm -it [-v ~/.mitmproxy:/home/mitmproxy/.mitmproxy] -p 8080:8080 mitmproxy/mitmproxy
``` ```
The *volume mount* is optional: It's to store the generated CA certificates. The *volume mount* is optional: It's to store the generated CA certificates.
Once started, mitmproxy listens as a HTTP proxy on `localhost:8080`: Once started, mitmproxy listens as a HTTP proxy on `localhost:8080`:
```sh ```sh
$ http_proxy=http://localhost:8080/ curl http://example.com/ $ http_proxy=http://localhost:8080/ curl http://example.com/
$ https_proxy=http://localhost:8080/ curl -k https://example.com/ $ https_proxy=http://localhost:8080/ curl -k https://example.com/
``` ```
You can also start `mitmdump` by just adding that to the end of the command-line: You can also start `mitmdump` by just adding that to the end of the command-line:
```sh ```sh
$ docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy mitmdump $ docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy mitmdump
``` ```
For `mitmweb`, you also need to expose port 8081: For `mitmweb`, you also need to expose port 8081:
```sh ```sh
# this makes :8081 accessible to the local machine only # this makes :8081 accessible to the local machine only
$ docker run --rm -it -p 8080:8080 -p 127.0.0.1:8081:8081 mitmproxy/mitmproxy mitmweb --web-host 0.0.0.0 $ docker run --rm -it -p 8080:8080 -p 127.0.0.1:8081:8081 mitmproxy/mitmproxy mitmweb --web-host 0.0.0.0
``` ```
You can also pass options directly via the CLI: You can also pass options directly via the CLI:
```sh ```sh
$ docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy mitmdump --set ssl_insecure=true $ docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy mitmdump --set ssl_insecure=true
``` ```

View File

@ -1,20 +1,20 @@
# Mitmproxy on the Windows Store # Mitmproxy on the Windows Store
@mhils experimented with bringing mitmproxy to the Window Store using the Desktop Bridge. This would replace our current InstallBuilder setup and allow for clean installs and - more importantly - automatic updates. @mhils experimented with bringing mitmproxy to the Window Store using the Desktop Bridge. This would replace our current InstallBuilder setup and allow for clean installs and - more importantly - automatic updates.
## Advantages ## Advantages
- Automatic updates - Automatic updates
- Clean installs - Clean installs
- Very simple setup on our end - Very simple setup on our end
- Possibility to roll out experimental releases to a subset of users - Possibility to roll out experimental releases to a subset of users
## Disadvantages ## Disadvantages
- No support for mitmproxy. That only runs under WSL. Making WSL nicer is a complementary effort. - No support for mitmproxy. That only runs under WSL. Making WSL nicer is a complementary effort.
- "Your developer account doesnt have permission to submit apps converted with the Desktop Bridge at this time." (requested) - "Your developer account doesnt have permission to submit apps converted with the Desktop Bridge at this time." (requested)
- New releases need to be submitted manually (Submission API is in preview). - New releases need to be submitted manually (Submission API is in preview).
## Notes ## Notes
We do not want to force anyone to use this, we would of course keep our portable binaries (and, of course, WSL). We do not want to force anyone to use this, we would of course keep our portable binaries (and, of course, WSL).

View File

@ -4,7 +4,6 @@ the moment, this is simply to give developers a quick way to see the impact of
their work. Eventually, this might grow into a performance dashboard with their work. Eventually, this might grow into a performance dashboard with
historical data, so we can track performance over time. historical data, so we can track performance over time.
# Setup # Setup
Install the following tools: Install the following tools:
@ -23,4 +22,3 @@ Now run the benchmark by loading the addon. A typical invocation is as follows:
This will start up the backend server, run the benchmark, save the results to This will start up the backend server, run the benchmark, save the results to
/tmp/foo.bench and /tmp/foo.prof, and exit. /tmp/foo.bench and /tmp/foo.prof, and exit.

View File

@ -1 +1 @@
https://github.com/erikras/ducks-modular-redux https://github.com/erikras/ducks-modular-redux