Skip to content

Instantly share code, notes, and snippets.

@arainho
Last active March 28, 2020 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arainho/034acec1af97e236171a3c225b80394c to your computer and use it in GitHub Desktop.
Save arainho/034acec1af97e236171a3c225b80394c to your computer and use it in GitHub Desktop.
macOS-Fortress debug script
#!/usr/bin/env bash
echo ''
echo -n "blackhole ... "
export http_proxy=""
if curl -s --head http://localhost:8119/ | head -n1 | grep -E "(200 OK)" --color > /dev/null > /dev/null
then
echo "http://localhost:8119 [✅]"
else
echo "[❌]"
fi
echo -n "squid ... "
export http_proxy=""
if curl -s --head http://localhost:3128/squid-internal-mgr/info | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "http://localhost:3128 [✅]"
else
echo "[❌]"
fi
echo -n "privoxy ... "
export http_proxy=""
if curl -s --head http://localhost:8118 | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "http://localhost:8118 [✅]"
else
echo "[❌]"
fi
echo -n "proxy.pac ... "
export http_proxy=""
if curl -s --head http://localhost/proxy.pac | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "http://localhost/proxy.pac [✅]"
else
echo "[❌]"
fi
echo ''
echo 'proxy.pac --> squid --> privoxy --> blackhole --> internet'
echo -n "use proxy.pac to connect squid ... "
export http_proxy="http://localhost/proxy.pac"
if curl -s --head http://localhost:3128 | head -n1 | grep "200 OK" --color > /dev/null > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "use squid to connect privoxy ... "
if curl --proxy http://localhost:3128 -s --head http://localhost:8118 | head -n1 | grep "200 OK" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "use privoxy to connect blackhole ... "
if curl --proxy http://localhost:8118 -s --head http://localhost:8119 | head -n1 | grep "200 OK" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "use blackhole to connect to github ... "
if curl --proxy http://localhost:8119 -s --head https://github.com | head -n1 | grep "200 OK" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "use privoxy to connect to github ... "
if curl --proxy http://localhost:8118 -s --head https://github.com | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "http://localhost:8118 [✅]"
fi
echo -n "use squid to connect github ... "
if curl --proxy http://localhost:3128 -s --head https://github.com | head -n1 | grep "200 OK" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "use proxy.pac to connect github ... "
export http_proxy="http://localhost/proxy.pac"
if curl -s --head https://github.com | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo ''
echo -n "Privoxy - Privoxy main page ... "
if curl --proxy http://localhost:8118 -s --head http://config.privoxy.org/ | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "Privoxy - View & change the current configuration ... "
if curl --proxy http://localhost:8118 -s --head http://config.privoxy.org/show-status | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "Privoxy - Look up which actions apply to a URL and why ... "
if curl --proxy http://localhost:8118 -s --head http://config.privoxy.org/show-url-info | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "Privoxy - View the request headers ... "
if curl --proxy http://localhost:8118 -s --head http://config.privoxy.org/show-request | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "Privoxy configuration http://p.p/ via squid ... "
export http_proxy="http://localhost:3128"
if curl -s --head http://p.p | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "[✅]"
else
echo "[❌]"
fi
echo -n "Privoxy config http://p.p/ via privoxy ... "
if curl --proxy http://localhost:8118 -s --head http://p.p | head -n1 | grep -E "(200 OK)" --color > /dev/null
then
echo "[✅]"
echo ''
else
echo "[❌]"
echo ''
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment