Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #by Cyb4FrE3z
- clear
- echo "=================================="
- echo " SETTING PROXY PER SESSION "
- echo "=================================="
- echo
- echo "---------------------------------------"
- echo -e "Choose:
- 1. Set Proxy (for this terminal only)
- 2. Set APT Proxy (You will need to unset later)
- 3. Unset Proxy"
- echo "---------------------------------------"
- echo -ne "Choice: "
- read cho
- if [ "$cho" = "1" ]; then
- echo
- echo "***********************************"
- echo "Setting HTTP, HTTPS and FTP proxy"
- echo " For this terminal only"
- echo "***********************************"
- echo
- echo -ne "Input proxy IP: "
- read proxyip
- echo -ne "Input proxy PORT: "
- read proxyport
- echo
- echo -e "Using $proxyip:$proxyport as proxy settings"
- echo
- echo "A moment please..."
- sleep 2
- echo
- echo -e "Running: export http_proxy=http://$proxyip:$proxyport"
- export http_proxy=http://$proxyip:$proxyport
- sleep 1
- echo -e "Running: export https_proxy=https://$proxyip:$proxyport"
- export https_proxy=http://$proxyip:$proxyport
- sleep 1
- echo -e "Running: export ftp_proxy=ftp://$proxyip:$proxyport"
- export ftp_proxy=http://$proxyip:$proxyport
- sleep 1
- elif [ "$cho" = "2" ]; then
- echo
- echo -ne "Input proxy IP: "
- read proxyip
- echo -ne "Input proxy PORT: "
- read proxyport
- echo
- rm -f /etc/apt/apt.conf.d/10proxy
- echo -e "Acquire::http::Proxy \"http\://$proxyip:$proxyport/\";" >> /etc/apt/apt.conf.d/10proxy
- echo -e "Acquire::https::Proxy \"http://$proxyip:$proxyport/\";" >> /etc/apt/apt.conf.d/10proxy
- echo -e "Acquire::ftp::Proxy \"http://$proxyip:$proxyport/\";" >> /etc/apt/apt.conf.d/10proxy
- echo
- elif [ "$cho" = "3" ]; then
- rm -f /etc/apt/apt.conf.d/10proxy
- else
- echo
- echo "Invalid choice!!"
- fi
- echo
- echo "All Done!! Happy Networking! :) "
- echo " From Cyb4FrE3z"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement