Last active
February 16, 2023 07:27
-
-
Save trickymast3r/ffce08db7d3d392a7af8df0541688a89 to your computer and use it in GitHub Desktop.
ipv4-ipv6-proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
random() { | |
tr </dev/urandom -dc A-Za-z0-9 | head -c5 | |
echo | |
} | |
array=(1 2 3 4 5 6 7 8 9 0 a b c d e f) | |
gen64() { | |
ip64() { | |
echo "${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}" | |
} | |
echo "$1:$(ip64):$(ip64):$(ip64):$(ip64)" | |
} | |
install_3proxy() { | |
echo "installing 3proxy" | |
mkdir -p /3proxy | |
cd /3proxy | |
URL="https://github.com/z3APA3A/3proxy/archive/0.9.3.tar.gz" | |
wget -qO- $URL | bsdtar -xvf- | |
cd 3proxy-0.9.3 | |
make -f Makefile.Linux | |
mkdir -p /usr/local/etc/3proxy/{bin,logs,stat} | |
mv /3proxy/3proxy-0.9.3/bin/3proxy /usr/local/etc/3proxy/bin/ | |
wget https://raw.githubusercontent.com/xlandgroup/ipv4-ipv6-proxy/master/scripts/3proxy.service-Centos8 --output-document=/3proxy/3proxy-0.9.3/scripts/3proxy.service2 | |
cp /3proxy/3proxy-0.9.3/scripts/3proxy.service2 /usr/lib/systemd/system/3proxy.service | |
systemctl link /usr/lib/systemd/system/3proxy.service | |
systemctl daemon-reload | |
# systemctl enable 3proxy | |
echo "* hard nofile 999999" >> /etc/security/limits.conf | |
echo "* soft nofile 999999" >> /etc/security/limits.conf | |
echo "net.ipv6.conf.ens3.proxy_ndp=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.all.proxy_ndp=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.default.forwarding=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.all.forwarding=1" >> /etc/sysctl.conf | |
echo "net.ipv6.ip_nonlocal_bind = 1" >> /etc/sysctl.conf | |
sysctl -p | |
systemctl stop firewalld | |
systemctl disable firewalld | |
cd $WORKDIR | |
} | |
gen_3proxy() { | |
cat <<EOF | |
daemon | |
maxconn 2000 | |
nserver 1.1.1.1 | |
nserver 8.8.4.4 | |
nserver 2001:4860:4860::8888 | |
nserver 2001:4860:4860::8844 | |
nscache 65536 | |
timeouts 1 5 30 60 180 1800 15 60 | |
setgid 65535 | |
setuid 65535 | |
stacksize 6291456 | |
flush | |
auth strong | |
users $(awk -F "/" 'BEGIN{ORS="";} {print $1 ":CL:" $2 " "}' ${WORKDATA}) | |
$(awk -F "/" '{print "auth strong\n" \ | |
"allow " $1 "\n" \ | |
"proxy -6 -n -a -p" $4 " -i" $3 " -e"$5"\n" \ | |
"flush\n"}' ${WORKDATA}) | |
EOF | |
} | |
gen_proxy_file_for_user() { | |
cat >proxy.txt <<EOF | |
$(awk -F "/" '{print $3 ":" $4 ":" $1 ":" $2 }' ${WORKDATA}) | |
EOF | |
} | |
upload_proxy() { | |
cd $WORKDIR | |
local PASS=$(random) | |
zip --password $PASS proxy.zip proxy.txt | |
URL=$(curl -F "file=@proxy.zip" https://file.io) | |
echo "Proxy is ready! Format IP:PORT:LOGIN:PASS" | |
echo "Download zip archive from: ${URL}" | |
echo "Password: ${PASS}" | |
} | |
gen_data() { | |
seq $FIRST_PORT $LAST_PORT | while read port; do | |
echo "$(random)/$(random)/$IP4/$port/$(gen64 $IP6)" | |
done | |
} | |
gen_iptables() { | |
cat <<EOF | |
$(awk -F "/" '{print "iptables -I INPUT -p tcp --dport " $4 " -m state --state NEW -j ACCEPT"}' ${WORKDATA}) | |
EOF | |
} | |
gen_ifconfig() { | |
cat <<EOF | |
$(awk -F "/" '{print "ifconfig ens3 inet6 add " $5 "/64"}' ${WORKDATA}) | |
EOF | |
} | |
echo "installing apps" | |
yum -y install gcc net-tools bsdtar zip make >/dev/null | |
install_3proxy | |
echo "working folder = /home/proxy-installer" | |
WORKDIR="/home/proxy-installer" | |
WORKDATA="${WORKDIR}/data.txt" | |
mkdir $WORKDIR && cd $_ | |
IP4=$(curl -4 -s icanhazip.com) | |
IP6=$(curl -6 -s icanhazip.com | cut -f1-4 -d':') | |
echo "Internal ip = ${IP4}. Exteranl sub for ip6 = ${IP6}" | |
echo "How many proxy do you want to create? Example 500" | |
read COUNT | |
FIRST_PORT=10000 | |
LAST_PORT=$(($FIRST_PORT + $COUNT)) | |
gen_data >$WORKDIR/data.txt | |
gen_iptables >$WORKDIR/boot_iptables.sh | |
gen_ifconfig >$WORKDIR/boot_ifconfig.sh | |
chmod +x $WORKDIR/boot_*.sh /etc/rc.local | |
gen_3proxy >/usr/local/etc/3proxy/3proxy.cfg | |
cat >>/etc/rc.local <<EOF | |
systemctl start NetworkManager.service | |
ifup ens3 | |
bash ${WORKDIR}/boot_iptables.sh | |
bash ${WORKDIR}/boot_ifconfig.sh | |
ulimit -n 65535 | |
/usr/local/etc/3proxy/bin/3proxy /usr/local/etc/3proxy/3proxy.cfg & | |
EOF | |
bash /etc/rc.local | |
gen_proxy_file_for_user | |
upload_proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
random() { | |
tr </dev/urandom -dc A-Za-z0-9 | head -c5 | |
echo | |
} | |
array=(1 2 3 4 5 6 7 8 9 0 a b c d e f) | |
gen64() { | |
ip64() { | |
echo "${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}" | |
} | |
echo "$1:$(ip64):$(ip64):$(ip64):$(ip64)" | |
} | |
install_3proxy() { | |
echo "installing 3proxy" | |
mkdir -p /3proxy | |
cd /3proxy | |
URL="https://github.com/z3APA3A/3proxy/archive/0.9.3.tar.gz" | |
wget -qO- $URL | bsdtar -xvf- | |
cd 3proxy-0.9.3 | |
make -f Makefile.Linux | |
mkdir -p /usr/local/etc/3proxy/{bin,logs,stat} | |
mv /3proxy/3proxy-0.9.3/bin/3proxy /usr/local/etc/3proxy/bin/ | |
wget https://raw.githubusercontent.com/xlandgroup/ipv4-ipv6-proxy/master/scripts/3proxy.service-Centos8 --output-document=/3proxy/3proxy-0.9.3/scripts/3proxy.service2 | |
cp /3proxy/3proxy-0.9.3/scripts/3proxy.service2 /usr/lib/systemd/system/3proxy.service | |
systemctl link /usr/lib/systemd/system/3proxy.service | |
systemctl daemon-reload | |
# systemctl enable 3proxy | |
echo "* hard nofile 999999" >> /etc/security/limits.conf | |
echo "* soft nofile 999999" >> /etc/security/limits.conf | |
echo "net.ipv6.conf.$ETHNAME.proxy_ndp=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.all.proxy_ndp=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.default.forwarding=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.all.forwarding=1" >> /etc/sysctl.conf | |
echo "net.ipv6.ip_nonlocal_bind = 1" >> /etc/sysctl.conf | |
sysctl -p | |
systemctl stop firewalld | |
systemctl disable firewalld | |
cd $WORKDIR | |
} | |
gen_3proxy() { | |
cat <<EOF | |
daemon | |
maxconn 2000 | |
nserver 1.1.1.1 | |
nserver 8.8.4.4 | |
nserver 2001:4860:4860::8888 | |
nserver 2001:4860:4860::8844 | |
nscache 65536 | |
timeouts 1 5 30 60 180 1800 15 60 | |
setgid 65535 | |
setuid 65535 | |
stacksize 6291456 | |
flush | |
auth strong | |
users $(awk -F "/" 'BEGIN{ORS="";} {print $1 ":CL:" $2 " "}' ${WORKDATA}) | |
$(awk -F "/" '{print "auth strong\n" \ | |
"allow " $1 "\n" \ | |
"proxy -6 -n -a -p" $4 " -i" $3 " -e"$5"\n" \ | |
"flush\n"}' ${WORKDATA}) | |
EOF | |
} | |
gen_proxy_file_for_user() { | |
cat >proxy.txt <<EOF | |
$(awk -F "/" '{print $3 ":" $4 ":" $1 ":" $2 }' ${WORKDATA}) | |
EOF | |
} | |
upload_proxy() { | |
cd $WORKDIR | |
local PASS=$(random) | |
zip --password $PASS proxy.zip proxy.txt | |
URL=$(curl -F "file=@proxy.zip" https://file.io) | |
echo "Proxy is ready! Format IP:PORT:LOGIN:PASS" | |
echo "Download zip archive from: ${URL}" | |
echo "Password: ${PASS}" | |
} | |
gen_data() { | |
PORT=10000 | |
for ip in $IP6S | |
do | |
echo "$(random)/$(random)/$IP4/$PORT/$ip" | |
PORT=$(expr $PORT + 1) | |
done | |
} | |
gen_iptables() { | |
cat <<EOF | |
$(awk -F "/" '{print "iptables -I INPUT -p tcp --dport " $4 " -m state --state NEW -j ACCEPT"}' ${WORKDATA}) | |
EOF | |
} | |
gen_ifconfig() { | |
cat <<EOF | |
$(awk -F "/" '{print "ifconfig " $ETHNAME " inet6 add " $5 "/" $PREFIXLEN ""}' ${WORKDATA}) | |
EOF | |
} | |
echo "installing apps" | |
yum -y install gcc net-tools bsdtar zip make >/dev/null | |
IP4=$(curl -4 -s cave.x7c.club/ipOnly) | |
IP6=$(curl -6 -s cave.x7c.club/ipOnly | cut -f1-4 -d':') | |
ETHNAME=$(ip -o -6 route show to default | awk '{print $5}') | |
PREFIXLEN=$(ifconfig | grep "$IP6" | awk '{print $4}') | |
install_3proxy | |
echo "working folder = /home/proxy-installer" | |
WORKDIR="/home/proxy-installer" | |
rm -Rf $WORKDIR | |
WORKDATA="${WORKDIR}/data.txt" | |
mkdir $WORKDIR && cd $_ | |
echo "Internal ip = ${IP4}. Exteranl sub for ip6 = ${IP6}" | |
echo "How many proxy do you want to create? Example 500" | |
read COUNT | |
IP6S=$(curl -s 'cave.x7c.club/ipv6?subnet='${IP6}'&total='${COUNT}'') | |
FIRST_PORT=10000 | |
LAST_PORT=$(($FIRST_PORT + $COUNT)) | |
gen_data >$WORKDIR/data.txt | |
gen_iptables >$WORKDIR/boot_iptables.sh | |
gen_ifconfig >$WORKDIR/boot_ifconfig.sh | |
chmod +x $WORKDIR/boot_*.sh /etc/rc.local | |
gen_3proxy >/usr/local/etc/3proxy/3proxy.cfg | |
cat >>/etc/rc.local <<EOF | |
systemctl start NetworkManager.service | |
ifup $ETHNAME | |
bash ${WORKDIR}/boot_iptables.sh | |
bash ${WORKDIR}/boot_ifconfig.sh | |
ulimit -n 65535 | |
/usr/local/etc/3proxy/bin/3proxy /usr/local/etc/3proxy/3proxy.cfg & | |
EOF | |
bash /etc/rc.local | |
gen_proxy_file_for_user | |
upload_proxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment