Skip to content

Instantly share code, notes, and snippets.

@teknogeek
Last active March 8, 2019 02:52
Show Gist options
  • Save teknogeek/7bec04f3897d7141ed47503b5da96c98 to your computer and use it in GitHub Desktop.
Save teknogeek/7bec04f3897d7141ed47503b5da96c98 to your computer and use it in GitHub Desktop.
Add this to your .bashrc to make a command to restart chrome without that pesky XSS auditor
# launch chromium with or without proxy
function chromium() {
if [[ "$#" -eq 0 || "$#" -gt 2 ]]; then
echo
echo "Usage: chromium [port] [enable xss Auditor]"
echo " example:"
echo " $ chromium 8080 1 - runs Chromium listening on 8080 and XSS Auditor enabled"
return
fi
# default settings
xss_auditor=""
port=""
# update this to your system specific path
chromium_path=/Applications/Chromium.app/Contents/MacOS/Chromium
# check that proxy port isn't set to 80
if [ "$1" -ne 80 ]; then
port="--proxy-server=127.0.0.1:$1"
else
echo "Proxy port cannot be 80"
return
fi
# ensure that there's 2 arguments before deciding to disable the XSS auditor
if [ "$#" -eq 2 ]; then
# if it's 0 or 1
if [[ "$2" -eq 0 || "$2" -eq 1 ]]; then
if [ "$2" -eq 0 ]; then
xss_auditor="--disable-xss-auditor"
fi
else
# bad value otherwise
echo "Enable/Disable XSS Auditor argument must be 0 or 1"
return
fi
fi
echo "[+] running $chromium_path $port $xss_auditor"
# start Chromium
bash -c "nohup sh -c '$chromium_path $port $xss_auditor' > /dev/null &"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment