Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trim() {
- local var="$*"
- var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
- var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
- echo -n "$var"
- var="acl ip"
- var2=" myip "
- ips=($(hostname -I))
- i=3000
- for ip in "${ips[@]}"
- do
- if [ $ip != "127.0.0.1" ]
- then
- COUNTER=3000
- mystring="$var$i$var2$ip"
- mystring2="tcp_outgoing_address $ip ip$i"
- string1+=" $mystring $mystring2 "
- get_ips+="$ip:#"
- mystring="$var$i$var2$ip"
- mystring2="tcp_outgoing_address $ip ip$i"
- string1+=" $mystring $mystring2 "
- get_ips+="$ip:#"
- sed -i -e "$ i $mystring" "/etc/squid/squid.conf"
- sed -i -e "$ i $mystring2" "/etc/squid/squid.conf"
- echo " $((i++)) "
- fi
- done
- range=5;
- number="";
- for i in {0..03}; do
- r=$RANDOM;
- let "r %= $range";
- number="$number""$r";
- done;
- user="cli"
- user+="$number"
- this=""
- length=8
- char=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z)
- max=${#char[*]}
- for (( i = 1; i <= $length ; i++ ))do
- let rand=${RANDOM}%${max}
- password="${password}${char[$rand]}"
- done
- echo $password
- echo "$user:$password" >> /root/password.txt
- htpasswd -b /etc/squid/passwd $user $password
- echo $ips
- get_final=" ${get_ips//#/$number:$user:$password n}"
- rm -rf /root/ips
- echo "$get_final" >> /root/ips
- sed -r 's/s+//g' /root/ips
- thishost=$(hostname)
- echo $thishost
- rm -rf /root/email
- echo -e "$thishost" >> /root/email
- sed -i 's/./@/' /root/email
- sed -c -i "s/(http_port * *).*/1$number/" /etc/squid/squid.conf
- value=`cat /root/email`
- value2=`cat -e /root/ips`
- trim $get_final
- echo -e $words
- trim $value2
- echo ${value2//[[:blank:]]/}
- service squid restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement