Last active
March 27, 2023 11:27
-
-
Save robCrawford/ecbc60705d8b76f7eb9815922f8dfa7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
chrome-e2e() { | |
# Opens Chrome with web security turned off | |
# `$1` is the url to visit on launch | |
# `$2` is optional Chrome app name override e.g. Chromium | |
browser="${2:-Google Chrome}" | |
set -x | |
open -n -a "$browser" "$1" --args --ignore-certificate-errors --ignore-urlfetcher-cert-requests --disable-web-security --allow-insecure-localhost --user-data-dir=/tmp/chrome | |
} | |
chrome-proxy() { | |
# Starts mitm proxy and opens Chrome with proxy config | |
# https://github.com/mitmproxy/mitmproxy | |
# `$1` is the url to visit on launch | |
# `$2` is the path to a mitm python file e.g. `~/mitm/response.py` | |
# `$3` is optional Chrome app name override e.g. Chromium | |
if [[ -z "$1" ]]; then | |
echo "Error: please provide url!" | |
elif [[ -z "$2" ]]; then | |
echo "Error: please provide path to .py file!" | |
else | |
browser="${3:-Google Chrome}" | |
port="8888" | |
set -x | |
open -n -a "$browser" "$1" --args --ignore-certificate-errors --ignore-urlfetcher-cert-requests --disable-web-security --allow-insecure-localhost --user-data-dir=/tmp/chrome --proxy-server="http://0.0.0.0:$port" && mitmdump --set ssl_insecure=true -p $port -s "$2" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment