Advertisement
Sh3lLDu5T

Set_Terminal_And_APT_Proxy

Mar 4th, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.79 KB | None | 0 0
  1. #!/bin/bash
  2. #by Cyb4FrE3z
  3. clear
  4. echo "=================================="
  5. echo "   SETTING PROXY PER SESSION      "
  6. echo "=================================="
  7. echo
  8. echo "---------------------------------------"
  9. echo -e "Choose:
  10. 1. Set Proxy (for this terminal only)
  11. 2. Set APT Proxy (You will need to unset later)
  12. 3. Unset Proxy"
  13. echo "---------------------------------------"
  14. echo -ne "Choice: "
  15. read cho
  16. if [ "$cho" = "1" ]; then
  17. echo
  18. echo "***********************************"
  19. echo "Setting HTTP, HTTPS and FTP proxy"
  20. echo "    For this terminal only"
  21. echo "***********************************"
  22. echo
  23. echo -ne "Input proxy IP: "
  24. read proxyip
  25. echo -ne "Input proxy PORT: "
  26. read proxyport
  27. echo
  28. echo -e "Using $proxyip:$proxyport  as proxy settings"
  29. echo
  30. echo "A moment please..."
  31. sleep 2
  32. echo
  33. echo -e "Running: export http_proxy=http://$proxyip:$proxyport"
  34. export http_proxy=http://$proxyip:$proxyport
  35. sleep 1
  36. echo -e "Running: export https_proxy=https://$proxyip:$proxyport"
  37. export https_proxy=http://$proxyip:$proxyport
  38. sleep 1
  39. echo -e "Running: export ftp_proxy=ftp://$proxyip:$proxyport"
  40. export ftp_proxy=http://$proxyip:$proxyport
  41. sleep 1
  42. elif [ "$cho" = "2" ]; then
  43. echo
  44. echo -ne "Input proxy IP: "
  45. read proxyip
  46. echo -ne "Input proxy PORT: "
  47. read proxyport
  48. echo
  49. rm -f /etc/apt/apt.conf.d/10proxy
  50. echo -e "Acquire::http::Proxy \"http\://$proxyip:$proxyport/\";" >> /etc/apt/apt.conf.d/10proxy
  51. echo -e "Acquire::https::Proxy \"http://$proxyip:$proxyport/\";" >> /etc/apt/apt.conf.d/10proxy
  52. echo -e "Acquire::ftp::Proxy \"http://$proxyip:$proxyport/\";" >> /etc/apt/apt.conf.d/10proxy
  53. echo
  54. elif [ "$cho" = "3" ]; then
  55. rm -f /etc/apt/apt.conf.d/10proxy
  56. else
  57. echo
  58. echo "Invalid choice!!"
  59. fi
  60. echo
  61. echo "All Done!! Happy Networking! :) "
  62. echo "                From Cyb4FrE3z"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement