#!/bin/sh # centos 9 PROXYCOUNT=10000 PROXYUSER="ipman" PROXYPASS="crystal" IP6PREFIXLEN=64 STATIC="no" INCTAIL="no" ETHNAME="enp1s0" GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' RED='\033[0;31m' CYAN='\033[0;36m' NC='\033[0m' # No Color eecho() { echo -e "${GREEN}$1${NC}" } eecho "Getting IPv4 ..." IP4=$(curl -4 -s icanhazip.com -m 10) eecho "Getting IPv6 ..." IP6=$(curl -6 -s icanhazip.com -m 10) if [[ $IP6 != *:* ]]; then IP6= fi eecho "IPv4 = ${IP4}. IPv6 = ${IP6}" if [ ! -n "$IP4" ]; then eecho "IPv4 Nout Found. Exit" exit fi while [[ $IP6 != *:* ]] || [ ! -n "$IP6" ]; do eecho "IPv6 Nout Found, Please check environment. Exit" exit # eecho "Invalid IPv6, Please input it manually:" # read IP6 done if [[ $INCTAIL == "yes" ]]; then IP6PREFIX=$(echo $IP6 | rev | cut -f2- -d':' | rev) else if [ $IP6PREFIXLEN -eq 48 ]; then IP6PREFIX=$(echo $IP6 | cut -f1-3 -d':') fi if [ $IP6PREFIXLEN -eq 64 ]; then IP6PREFIX=$(echo $IP6 | cut -f1-4 -d':') fi fi eecho "IPv6 PrefixLen: $IP6PREFIXLEN --> Prefix: $IP6PREFIX" #################### functions #################### gen_data() { array=(1 2 3 4 5 6 7 8 9 0 a b c d e f) ip64() { echo "${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}" } seq 1 $PROXYCOUNT | while read idx; do port=$(($idx+10000)) if [[ $INCTAIL == "yes" ]] ; then suffix=$((($idx)*$INCTAILSTEPS)) suffix=$(printf '%x\n' $suffix) echo "$PROXYUSER/$PROXYPASS/$IP4/$port/$IP6PREFIX:$suffix" else if [[ $IP6PREFIXLEN -eq 64 ]]; then echo "$PROXYUSER/$PROXYPASS/$IP4/$port/$IP6PREFIX:$(ip64):$(ip64):$(ip64):$(ip64)" fi if [[ $IP6PREFIXLEN -eq 48 ]]; then echo "$PROXYUSER/$PROXYPASS/$IP4/$port/$IP6PREFIX:$(ip64):$(ip64):$(ip64):$(ip64):$(ip64)" fi fi done } gen_iptables() { cat <> $NETWORK_FILE EOF } gen_proxy_file() { cat <$WORKDATA gen_3proxy >/usr/local/3proxy/conf/3proxy.cfg gen_iptables >$WORKDIR/boot_iptables.sh gen_ifconfig >$WORKDIR/boot_ifconfig.sh gen_static >$WORKDIR/boot_static.sh BOOTRCFILE="$WORKDIR/boot_rc.sh" REGISTER_LOGIC="bash ${WORKDIR}/boot_ifconfig.sh" if [[ $STATIC == "yes" ]]; then REGISTER_LOGIC="bash ${WORKDIR}/boot_static.sh && systemctl restart network" fi cat >$BOOTRCFILE <>/etc/security/limits.conf <>/etc/rc.local <$PROXYFILE eecho "Done with $PROXYFILE" zip --password $PROXYPASS proxy.zip $PROXYFILE URL=$(curl -s --upload-file proxy.zip https://transfer.sh/ipv6proxy.zip) eecho "Proxy is ready! Format IP:PORT:LOGIN:PASS" eecho "Download zip archive from: ${URL}" eecho "Password: ${PROXYPASS}"