Skip to content

Instantly share code, notes, and snippets.

@GeorgeDewar
Last active August 29, 2015 14:00
Show Gist options
  • Save GeorgeDewar/11195367 to your computer and use it in GitHub Desktop.
Save GeorgeDewar/11195367 to your computer and use it in GitHub Desktop.
#!/bin/bash
function usage {
echo Enable or disable CNTLM proxy settings in the current terminal
echo
echo Usage:
echo
echo "source proxy <on / off>"
}
if [ $(basename -- $0) != "bash" ] && [ $(basename -- $0) != "-bash" ]; then
echo -e "${red}You must run vpn using source${NC}"
echo
usage
exit 1
fi
op=$1
if [ "$op" = "off" ]; then
# Remove proxy configuration
unset http_proxy https_proxy ftp_proxy socks_proxy all_proxy
unset HTTP_PROXY HTTPS_PROXY FTP_PROXY SOCKS_PROXY ALL_PROXY
elif [ "$op" = "on" ]; then
# Replace proxy configuration
export http_proxy=http://localhost:3128/
export https_proxy=http://localhost:3128/
export ftp_proxy=ftp://localhost:3128/
export HTTP_PROXY=http://localhost:3128/
export HTTPS_PROXY=http://localhost:3128/
export FTP_PROXY=ftp://localhost:3128/
else
usage
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment