Guest User

Untitled

a guest
Apr 6th, 2018
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. export http_proxy='http://proxy.test.cz:1234/'
  2.  
  3. OUTPUT_FILE=/tmp/$$.txt
  4. wget -nv --proxy-user=test --proxy-password=test google.com > ${OUTPUT_FILE} 2>&1
  5.  
  6. grep -q '<H1>You cant use internet</H1>' ${OUTPUT_FILE}
  7. if [ "$?" -eq '0' ]
  8. then
  9. echo "Proxy isnt working. " | mail -s "Proxy isnt working" -r "No-reply<no-reply@mail.cz>" test@mail.cz
  10. else
  11. echo "Proxy is working"
  12. fi
  13.  
  14. rm -f /tmp/$$.txt
  15.  
  16. if [ "$?" -eq '0' ]
  17.  
  18. if [ "1" -eq '0' ]
  19.  
  20. if [ $? -eq 0 ]
  21.  
  22. export http_proxy='http://proxy.test.cz:1234/'
  23. URL='www.google.com'
  24.  
  25. wget -q --proxy-user=test --proxy-password=test --spider $URL
  26. if [ $? = 1 ]
  27. then
  28. STATUS= echo "Proxy isn't working"
  29.  
  30. else
  31. STATUS="Proxy is working."
  32. fi
  33. echo $STATUS
  34.  
  35. set_proxies() {
  36. export http_proxy=http://proxy.example.com:998
  37. export HTTP_PROXY=${http_proxy}
  38. export https_proxy=http://proxy.example.com:999
  39. export HTTPS_PROXY=${https_proxy}
  40. export ftp_proxy=http://proxy.example.com:998
  41. export FTP_PROXY=${ftp_proxy}
  42. export socks_proxy=socks://proxy.example.com:9999
  43. export SOCKS_PROXY=${socks_proxy}
  44. export no_proxy=localhost,127.0.0.1,.docker.io,192.168.9.100
  45. export NO_PROXY=${no_proxy}
  46. export ALL_PROXY_NO_FALLBACK=1
  47. export all_proxy=socks5://proxy.example.com:9999
  48. }
  49.  
  50. URL='www.google.com'
  51.  
  52. curl -s -m 2 $URL > /dev/null
  53.  
  54. if [ $? == 0 ] then
  55. STATUS="No Corporate Proxy"
  56. else
  57. set_proxies
  58. STATUS="Behind Corporate proxy"
  59. fi
  60. echo $STATUS
Add Comment
Please, Sign In to add comment