├── kill-request.yaml ├── redirect-request.yaml ├── replace-router.yaml ├── response ├── test_fail.json ├── example.yaml └── test_pass.json ├── .gitignore ├── rewrite-router.yaml ├── dump-curl.yaml ├── record-request.yaml ├── show-header.yaml ├── screenshot └── mitm-rewrite-example.jpg ├── delay-request.yaml ├── check-analytics.yaml ├── mitm-random-outage.py ├── mitm-delay-request.py ├── mitm-redirect-url.py ├── mitm-redirect-host.py ├── mitm-kill-request.py ├── mitm-dump-curl.py ├── mitm-replace.py ├── mitm-show-header.py ├── LICENSE ├── mitm-rewrite.py ├── mitmutils └── utils.py ├── mitm-record.py ├── mitm-check-analytics.py └── README.md /kill-request.yaml: -------------------------------------------------------------------------------- 1 | GET: 2 | - .*example.com/.* 3 | -------------------------------------------------------------------------------- /redirect-request.yaml: -------------------------------------------------------------------------------- 1 | # https://www.google.com/.*: example.com 2 | -------------------------------------------------------------------------------- /replace-router.yaml: -------------------------------------------------------------------------------- 1 | ### TEST 2 | http://(www.|)example.com: example 3 | -------------------------------------------------------------------------------- /response/test_fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": 500, 3 | "header": {} 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.swp 3 | .* 4 | mitm-rewrite/response/*.json 5 | *__pycache__* 6 | -------------------------------------------------------------------------------- /rewrite-router.yaml: -------------------------------------------------------------------------------- 1 | http://example.com/pass: test_pass 2 | http://example.com/fail: test_fail 3 | -------------------------------------------------------------------------------- /dump-curl.yaml: -------------------------------------------------------------------------------- 1 | # .*example.*: example_request_folder 2 | # .*google.com.*: google_request_folder 3 | -------------------------------------------------------------------------------- /response/example.yaml: -------------------------------------------------------------------------------- 1 | Example Domain: Replace Test 2 | This domain is for use: TEST! TEST! TEST! 3 | -------------------------------------------------------------------------------- /record-request.yaml: -------------------------------------------------------------------------------- 1 | # .*example.*: example_request_folder 2 | # .*google.com.*: google_request_folder 3 | -------------------------------------------------------------------------------- /show-header.yaml: -------------------------------------------------------------------------------- 1 | # .*www.google*: 2 | # - user-agent 3 | # - Cookie 4 | # - x-xss-protection 5 | -------------------------------------------------------------------------------- /screenshot/mitm-rewrite-example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KevCui/mitm-scripts/HEAD/screenshot/mitm-rewrite-example.jpg -------------------------------------------------------------------------------- /delay-request.yaml: -------------------------------------------------------------------------------- 1 | # URL: 2 | # - min second 3 | # - max second 4 | http.*logout: 5 | - 8 6 | - 9 7 | http.*login.*: 8 | - 3 9 | - 5 10 | -------------------------------------------------------------------------------- /check-analytics.yaml: -------------------------------------------------------------------------------- 1 | # Google analytics 2 | https://www.google-analytics.com/r/collect: 3 | - dl # url 4 | - dt # page name 5 | https://www.google-analytics.com/r/: 6 | - sr # screen size 7 | -------------------------------------------------------------------------------- /response/test_pass.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": 200, 3 | "header": { 4 | "Content-Type": "application/json; charset=UTF-8" 5 | }, 6 | "content": { 7 | "value": "test", 8 | "key": "one" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mitm-random-outage.py: -------------------------------------------------------------------------------- 1 | import random 2 | import logging 3 | from mitmproxy import http 4 | 5 | percentage = 25 6 | 7 | 8 | def response(flow: http.HTTPFlow) -> None: 9 | if random.randint(1, 100) < percentage: 10 | logging.warn('>>> Down ' + flow.request.url) 11 | flow.response = http.Response.make(503, '', {}) 12 | -------------------------------------------------------------------------------- /mitm-delay-request.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | from mitmproxy.script import concurrent 4 | 5 | CONFIG_FILE = './delay-request.yaml' 6 | 7 | 8 | @concurrent 9 | def request(flow: http.HTTPFlow) -> None: 10 | utils.delay(flow, CONFIG_FILE) 11 | 12 | 13 | @concurrent 14 | def response(flow: http.HTTPFlow) -> None: 15 | utils.delay(flow, CONFIG_FILE) 16 | -------------------------------------------------------------------------------- /mitm-redirect-url.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | from mitmproxy.log import ALERT 4 | import logging 5 | import re 6 | 7 | ROUTER_FILE = './redirect-request.yaml' 8 | 9 | 10 | def request(flow: http.HTTPFlow) -> None: 11 | routers = utils.readFile(ROUTER_FILE) 12 | url = flow.request.url 13 | 14 | if routers is not None: 15 | for patternURL, redirectURL in routers.items(): 16 | if re.match(patternURL, url) is not None: 17 | logging.log(ALERT, url + '>>> FOUND url "' + url + '" to redircet: ' + redirectURL) 18 | flow.request.url = redirectURL 19 | -------------------------------------------------------------------------------- /mitm-redirect-host.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | from mitmproxy.log import ALERT 4 | import re 5 | import logging 6 | 7 | ROUTER_FILE = './redirect-request.yaml' 8 | 9 | 10 | def request(flow: http.HTTPFlow) -> None: 11 | routers = utils.readFile(ROUTER_FILE) 12 | url = flow.request.url 13 | 14 | if routers is not None: 15 | for patternURL, redirectURL in routers.items(): 16 | if re.match(patternURL, url) is not None: 17 | logging.log(ALERT, url + '>>> FOUND url "' + url + '" to redirect host: ' + redirectURL) 18 | flow.request.host = redirectURL 19 | -------------------------------------------------------------------------------- /mitm-kill-request.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | import logging 4 | import re 5 | 6 | CONFIG_FILE = './kill-request.yaml' 7 | 8 | 9 | def request(flow: http.HTTPFlow) -> None: 10 | config = utils.readFile(CONFIG_FILE) 11 | method = flow.request.method 12 | url = flow.request.url 13 | 14 | if config is not None: 15 | for matchMethod in config: 16 | if matchMethod == method: 17 | for patternURL in config[matchMethod]: 18 | if re.match(patternURL, url) is not None: 19 | logging.warn('>>> FOUND request to kill: ' + method + ' ' + url) 20 | flow.kill() 21 | -------------------------------------------------------------------------------- /mitm-dump-curl.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmproxy import ctx 3 | from mitmutils import utils 4 | import os 5 | import re 6 | import time 7 | import logging 8 | 9 | CONFIG_FILE = './dump-curl.yaml' 10 | 11 | 12 | def request(flow: http.HTTPFlow) -> None: 13 | matches = utils.readFile(CONFIG_FILE) 14 | url = flow.request.url 15 | 16 | if matches is not None: 17 | for patternURL, dumpFolder in matches.items(): 18 | if not os.path.exists(dumpFolder): 19 | os.makedirs(dumpFolder) 20 | 21 | if re.match(patternURL, url) is not None: 22 | dumpFile = dumpFolder + '/' + str(int(round(time.time() * 1000))) 23 | logging.info('>>> Dump ' + url + ' to ' + dumpFile) 24 | ctx.master.commands.call("export.file", 'curl', flow, dumpFile) 25 | -------------------------------------------------------------------------------- /mitm-replace.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | import re 4 | import logging 5 | 6 | HOME_DIR = './' 7 | DATA_DIR = HOME_DIR + 'response/' 8 | ROUTER_FILE = HOME_DIR + 'replace-router.yaml' 9 | 10 | 11 | def response(flow: http.HTTPFlow) -> None: 12 | routers = utils.readFile(ROUTER_FILE) 13 | url = flow.request.url 14 | 15 | if routers is not None: 16 | for patternURL, yamlfilename in routers.items(): 17 | if re.match(patternURL, url) is not None: 18 | yamlfile = DATA_DIR + str(yamlfilename) + '.yaml' 19 | logging.info('>>> FOUND "' + url + '" to replace strings from "' + yamlfile + '"') 20 | 21 | data = utils.readFile(yamlfile) 22 | logging.info(data) 23 | 24 | if data is not None: 25 | for old, new in data.items(): 26 | flow.response.content = flow.response.content.replace(bytes(old.encode('utf8')), bytes(new.encode('utf8'))) 27 | -------------------------------------------------------------------------------- /mitm-show-header.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | import re 4 | import logging 5 | 6 | CONFIG_FILE = './show-header.yaml' 7 | 8 | 9 | def searchHeaders(flow, config, state): 10 | config = utils.readFile(config) 11 | url = flow.request.url 12 | 13 | if config is not None: 14 | for patternURL, headers in config.items(): 15 | if re.match(patternURL, url) is not None: 16 | 17 | if state == 'request': 18 | items = flow.request.headers.items() 19 | else: 20 | items = flow.response.headers.items() 21 | 22 | logging.warn('>> FOUND ' + state + ' header in: ' + url) 23 | for k, v in items: 24 | if k.lower() in [x.lower() for x in headers]: 25 | logging.warn('-> ' + str(k) + ': ' + str(v)) 26 | 27 | 28 | def request(flow: http.HTTPFlow) -> None: 29 | searchHeaders(flow, CONFIG_FILE, 'request') 30 | 31 | 32 | def response(flow: http.HTTPFlow) -> None: 33 | searchHeaders(flow, CONFIG_FILE, 'response') 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2017 Kevin Cui 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /mitm-rewrite.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | import logging 4 | import re 5 | import json 6 | 7 | HOME_DIR = './' 8 | DATA_DIR = HOME_DIR + 'response/' 9 | ROUTER_FILE = HOME_DIR + 'rewrite-router.yaml' 10 | 11 | 12 | def response(flow: http.HTTPFlow) -> None: 13 | routers = utils.readFile(ROUTER_FILE) 14 | url = flow.request.url 15 | 16 | if routers is not None: 17 | for patternURL, jsonfilename in routers.items(): 18 | if re.match(patternURL, url) is not None: 19 | jsonfile = DATA_DIR + str(jsonfilename) + '.json' 20 | logging.warn('>>> FOUND "' + url + '". Send response data from "' + jsonfile + '"') 21 | 22 | data = utils.readFile(jsonfile) 23 | 24 | if data is not None: 25 | status = int(data['status']) 26 | try: 27 | content = json.dumps(data['content']) 28 | except: 29 | content = '' 30 | header = data['header'] 31 | 32 | flow.response = http.Response.make(status, content, header) 33 | -------------------------------------------------------------------------------- /mitmutils/utils.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import json 4 | import random 5 | from ruamel.yaml import YAML 6 | from time import sleep 7 | import logging 8 | 9 | 10 | def readFile(file): 11 | """Read file and return json data or dict 12 | 13 | Read file and return all its content as json format or dict 14 | 15 | Arg: 16 | file: File name, including its path 17 | """ 18 | 19 | if not os.path.isfile(file): 20 | logging.error("File: " + file + ' not found!') 21 | return None 22 | 23 | fname, fext = os.path.splitext(file) 24 | 25 | with open(file) as data: 26 | if fext == ".yaml": 27 | yaml = YAML(typ='safe') 28 | return yaml.load(data) 29 | else: 30 | return json.load(data) 31 | 32 | 33 | def delay(flow, conf): 34 | """Delay http flow 35 | 36 | delay flow according to conf file 37 | 38 | Arg: 39 | flow : http flow 40 | """ 41 | 42 | config = readFile(conf) 43 | url = flow.request.url 44 | 45 | if config is not None: 46 | for patternURL, timer in config.items(): 47 | delay = round(random.uniform(min(timer[0], timer[1]), max(timer[0], timer[1])), 2) 48 | if re.match(patternURL, url) is not None: 49 | sleep(delay) 50 | -------------------------------------------------------------------------------- /mitm-record.py: -------------------------------------------------------------------------------- 1 | from mitmproxy import http 2 | from mitmutils import utils 3 | import os 4 | import re 5 | import time 6 | import logging 7 | 8 | CONFIG_FILE = './record-request.yaml' 9 | 10 | 11 | def response(flow: http.HTTPFlow) -> None: 12 | matches = utils.readFile(CONFIG_FILE) 13 | url = flow.request.url 14 | 15 | if matches is not None: 16 | for patternURL, dumpFolder in matches.items(): 17 | if not os.path.exists(dumpFolder): 18 | os.makedirs(dumpFolder) 19 | 20 | if re.match(patternURL, url) is not None: 21 | dumpFile = dumpFolder + '/' + str(int(round(time.time() * 1000))) 22 | 23 | logging.info('>>> Save ' + url + ' request details to ' + dumpFile) 24 | with open(dumpFile, 'a') as f: 25 | f.write(str(flow.request.method) + ' ' + str(flow.request.url) + '\n') 26 | for k, v in flow.request.headers.items(): 27 | f.write(str(k) + ': ' + str(v) + '\n') 28 | f.write('\n' + str(flow.request.content.decode('utf-8')) + '\n') 29 | f.write('---\n') 30 | for k, v in flow.response.headers.items(): 31 | f.write(str(k) + ': ' + str(v) + '\n') 32 | f.write('\n' + str(flow.response.content.decode('utf-8')) + '\n') 33 | -------------------------------------------------------------------------------- /mitm-check-analytics.py: -------------------------------------------------------------------------------- 1 | import json 2 | import urllib.parse 3 | from mitmproxy import http 4 | from mitmutils import utils 5 | import logging 6 | 7 | DATA_FILE = './check-analytics.yaml' 8 | 9 | 10 | def check_analytics(keyword, source, format): 11 | if format == 'form': 12 | for s in str(source).split("&"): 13 | if keyword in s: 14 | logging.warn('MATCH: ' + urllib.parse.unquote(str(s))) 15 | 16 | if format == 'json': 17 | txt = json.loads(source) 18 | try: 19 | logging.warn('MATCH: ' + keyword + '=' + txt[keyword]) 20 | except: 21 | pass 22 | 23 | 24 | def check_data(url, data, flow): 25 | if data is not None: 26 | for link in data: 27 | if link in url: 28 | logging.warn('>> FOUND: ' + str(url)) 29 | for keyword in data[link]: 30 | check_analytics(keyword, flow.request.url, 'form') 31 | for header, value in flow.request.headers.items(): 32 | if 'Content-Type' in str(header): 33 | if 'form' in str(value): 34 | check_analytics(keyword, flow.request.text, 'form') 35 | if 'json' in str(value): 36 | check_analytics(keyword, flow.request.text, 'json') 37 | 38 | 39 | def request(flow: http.HTTPFlow) -> None: 40 | check_data(flow.request.url, utils.readFile(DATA_FILE), flow) 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mitm-scripts 2 | 3 | > A collection of some handy [mitmproxy](https://github.com/mitmproxy/mitmproxy) inline scripts. 4 | 5 | ## Table of Contents 6 | 7 | - [Precondition](#precondition) 8 | - [List of Scripts](#list-of-scripts) 9 | - [mitm-rewrite](#mitm-rewrite) 10 | - [mitm-replace](#mitm-replace) 11 | - [mitm-redirect-host](#mitm-redirect-host) 12 | - [mitm-redirect-url](#mitm-redirect-url) 13 | - [mitm-delay-request](#mitm-delay-request) 14 | - [mitm-kill-request](#mitm-kill-request) 15 | - [mitm-show-header](#mitm-show-header) 16 | - [mitm-check-analytics](#mitm-check-analytics) 17 | - [mitm-dump-curl](#mitm-dump-curl) 18 | - [mitm-record](#mitm-record) 19 | - [mitm-random-outage](#mitm-random-outage) 20 | 21 | ## Precondition 22 | 23 | 1. Install [mitmproxy](https://docs.mitmproxy.org/stable/overview-installation/) 24 | 25 | 2. [Configure client browser or device](https://docs.mitmproxy.org/stable/overview-getting-started/#configure-your-browser-or-device): configure proxy settings and install CA on client. 26 | 27 | ## List of Scripts 28 | 29 | - [mitm-rewrite](#mitm-rewrite): ./mitm-rewrite.py, ./rewrite-router.yaml 30 | - [mitm-replace](#mitm-replace): ./mitm-replace.py, ./replace-router.yaml 31 | - [mitm-redirect-host](#mitm-redirect-host): ./mitm-redirect-host.py, ./redirect-request.yaml 32 | - [mitm-redirect-url](#mitm-redirect-url): ./mitm-redirect-url.py, ./redirect-request.yaml 33 | - [mitm-delay-request](#mitm-delay-request): ./mitm-delay-request.py, ./delay-request.yaml 34 | - [mitm-kill-request](#mitm-kill-request): ./mitm-kill-request.py, ./kill-request.yaml 35 | - [mitm-show-header](#mitm-show-header): ./mitm-show-header.py, ./show-header.yaml 36 | - [mitm-check-analytics](#mitm-check-analytics): ./mitm-check-analytics.py, ./check-analytics.yaml 37 | - [mitm-dump-curl](#mitm-dump-curl): ./mitm-dump-curl.py, ./dump-curl.yaml 38 | - [mitm-record](#mitm-record): ./mitm-record.py, ./record-request.yaml 39 | - [mitm-random-outage](#mitm-random-outage): ./mitm-random-outage.py 40 | 41 | All the scripts above can be used with `mitmproxy` and `mitmdump` command: 42 | 43 | ```bash 44 | $ mitmproxy -s .py 45 | ``` 46 | 47 | OR 48 | 49 | ```bash 50 | $ mitmdump -s .py 51 | ``` 52 | 53 | ### mitm-rewrite 54 | 55 | `./mitm-rewrite.py` can return mock JSON response for certain target URLs. 56 | 57 | 1. Run `mitmdump`: 58 | 59 | ```bash 60 | $ mitmdump -s mitm-rewrite.py 61 | ``` 62 | 63 | 2. Check `rewrite-router.yaml`, to link response JSON file, for e.g: 64 | 65 | ```yaml 66 | http://example.com/pass: test_pass 67 | http://example.com/fail: test_fail 68 | ``` 69 | 70 | It means that the response of "http://exmaple.com/pass" will be overwritten by the content in `./response/test_pass.json` file and the response of "http://exmaple.com/fail" will be overwritten by the content in `./response/test_fail.json` file. 71 | 72 | 3. Edit response JSON file to put mock data you want: 73 | 74 | ```json 75 | { 76 | "status": 200, 77 | "header": { ... }, 78 | "content": ... 79 | } 80 | ``` 81 | 82 | - status: http status code, an INT number 83 | - header: http response headers 84 | - content: response body 85 | 86 | The changes in router yaml file and json response files will be applied **on the fly**, no need to restart proxy. Here is an example how it looks like: 87 | 88 | ![mitm-rewrite-example](screenshot/mitm-rewrite-example.jpg) 89 | 90 | **[`^ back to top ^`](#mitm-scripts)** 91 | 92 | --- 93 | 94 | ### mitm-replace 95 | 96 | `./mitm-replace.py` can replace the specific string to another one. `replace-router.yaml` is used to link URL and yaml file in `response` folder. In the response yaml file, the matching string and result strings can be defined as a pair. Don't forget to uncomment URLs in `replace-router.yaml` and make it work on the fly! 97 | 98 | ``` 99 | $ mitmdump -s mitm-replace.py 100 | ``` 101 | 102 | **[`^ back to top ^`](#mitm-scripts)** 103 | 104 | --- 105 | 106 | ### mitm-redirect-host 107 | 108 | `./mitm-redirect-host.py` can redirect the request **host** of URL request to another host. The matching URL and redirect host can be defined in `redirect-requenst.yaml`. Attention: only the host part of request URL will be replaced. 109 | 110 | ```bash 111 | $ mitmdump -s mitm-redirect-host.py 112 | ``` 113 | 114 | **[`^ back to top ^`](#mitm-scripts)** 115 | 116 | --- 117 | 118 | ### mitm-redirect-url 119 | 120 | `./mitm-redirect-url.py` can redirect the whole request to another URL. The matching URL and redirect URL can be defined in `redirect-request.yaml`. 121 | 122 | ```bash 123 | $ mitmdump -s mitm-redirect-url.py 124 | ``` 125 | 126 | **[`^ back to top ^`](#mitm-scripts)** 127 | 128 | --- 129 | 130 | ### mitm-delay-request 131 | 132 | `./mitm-delay-request.py` can delay HTTP/HTTPS request time and response time, in order to simulate the slow network. To configure matching URL and delay time, edit `delay-request.yaml`. 133 | 134 | ```bash 135 | $ mitmdump -s mitm-delay-request.py 136 | ``` 137 | 138 | **[`^ back to top ^`](#mitm-scripts)** 139 | 140 | --- 141 | 142 | ### mitm-kill-request 143 | 144 | `./mitm-kill-request.py` can kill all matching requests. The matching request methods and URls can be defined in `kill-request.yaml`. 145 | 146 | ```bash 147 | $ mitmdump -s mitm-kill-request.py 148 | ``` 149 | 150 | **[`^ back to top ^`](#mitm-scripts)** 151 | 152 | --- 153 | 154 | ### mitm-show-header 155 | 156 | `./mitm-show-header.py` can print out matched request header and response header, with its value. The matching URL and header can be defined in `show-header.yaml`. 157 | 158 | ```bash 159 | $ mitmdump -s mitm-show-header.py | grep '>>\|->' 160 | ``` 161 | 162 | **[`^ back to top ^`](#mitm-scripts)** 163 | 164 | --- 165 | 166 | ### mitm-check-analytics 167 | 168 | `./mitm-check-analytics.py` can display real-time analytics key and value, in order to help checking analytics efficiently. To configure URL and keywords, edit `check-analytics.yaml`. 169 | 170 | 1. Run mitmdump: 171 | 172 | ```bash 173 | $ mitmdump -s mitm-check_analytics.py 174 | ``` 175 | 176 | 2. Visit target web page in clients: browsers or apps. The matched analytics keyword and value will show up in terminal. 177 | 178 | **[`^ back to top ^`](#mitm-scripts)** 179 | 180 | --- 181 | 182 | ### mitm-dump-curl 183 | 184 | `./mitm-dump-curl` can find matching request URL and dump the request to a file in as cURL format. The matching URL and dump folder can be defined in `dump-curl.yaml`. 185 | 186 | ```bash 187 | $ mitmdump -s mitm-dump-curl.py 188 | ``` 189 | 190 | **[`^ back to top ^`](#mitm-scripts)** 191 | 192 | --- 193 | 194 | ### mitm-record 195 | 196 | `./mitm-record.py` can save matching request details (request headers, request body, response headers and response body) to a specific file. The matching URl and dump folder can be defined in `record-request.yaml`. 197 | 198 | ```bash 199 | $ mitmdump -s mitm-record.py 200 | ``` 201 | 202 | **[`^ back to top ^`](#mitm-scripts)** 203 | 204 | --- 205 | 206 | ### mitm-random-outage 207 | 208 | `./mitm-random-outage.py` can simulate sever outage and return 503 code. It will pick randomly the requests to make it 503. The percentage of outage can be changed as the variable `percentage` inside the script. 209 | 210 | ```bash 211 | $ mitmdump -s mitm-random-outage.py 212 | ``` 213 | 214 | **[`^ back to top ^`](#mitm-scripts)** 215 | 216 | --- 217 | 218 | Buy Me A Coffee 219 | --------------------------------------------------------------------------------