From c553f9347cb5b53ae03bc5c7fd60ea886425216b Mon Sep 17 00:00:00 2001 From: InfoSec <1241112575@qq.com> Date: Fri, 15 Apr 2022 18:04:37 +0800 Subject: [PATCH] Add files via upload --- Linux_scripts/set_proxy.sh | 115 +++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Linux_scripts/set_proxy.sh diff --git a/Linux_scripts/set_proxy.sh b/Linux_scripts/set_proxy.sh new file mode 100644 index 0000000..a3dda57 --- /dev/null +++ b/Linux_scripts/set_proxy.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +function menu() +{ +echo -e "\033[1;31m ______________________________________________________________________________\033[0m" +echo -e "\033[1;31m| |\033[0m" +echo -e "\033[1;31m|______________________________________________________________________________|\033[0m" + +cat </dev/null; then + if [ $VALID_CHECK == "yes" ]; then + echo "ip $ip available!" + return 0 + else + echo "ip $ip not available!" + return 1 + fi + else + echo "ip format error! The setting will be wrong." + return 1 + fi +} +while true ; do + read -p "Please enter IP: " IP + check_ip $IP + [ $? - eq 0 ] && break +done + +! + +:</dev/null ;then + echo "port $port is number." + else + echo "port format error! the setting will be wrong." + fi +} +while true ; do + read -p "Please enter IP: " IP + check_ip $IP + [ $? - eq 0 ] && break +done + +! + +function set_proxy(){ +:<> /etc/profile + # echo "export https_proxy=https://$ip:$port" >> /etc/profile + echo "export http_proxy=http://$ip_port" >> /etc/profile + echo "export https_proxy=https://$ip_port" >> /etc/profile + check_proxy + +} + + +function check_proxy(){ + source /etc/profile + echo "...system proxy is below!...." + echo $http_proxy && echo $https_proxy + echo "...checking system proxy !..." + curl cip.cc + sleep 5 + exit +} + + +function empty_proxy(){ + sed -i '/http/d' /etc/profile + source /etc/profile + echo "...system proxy is empty!..." + echo $http_proxy && echo $https_proxy + +} +menu \ No newline at end of file