-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcreate_proxy.sh
69 lines (60 loc) · 2.42 KB
/
create_proxy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
echo "[1] - Installing updates"
apt update && apt upgrade
echo "[2] - Setting up a proxy server"
yes | apt install dante-server
yes | apt install curl
echo "[3] - Getting a network profile"
ext_interface () {
for interface in /sys/class/net/*
do
[[ "${interface##*/}" != 'lo' ]] && \
ping -c1 -W2 -I "${interface##*/}" 87.240.190.72 >/dev/null 2>&1 && \
printf '%s' "${interface##*/}" && return 0
done
}
echo "[4] - Adding a config server"
echo "logoutput: stderr" > /etc/danted.conf
for ((i = 7000; i <= 7010; i++))
do
echo "internal: $(ext_interface) port = $i" >> /etc/danted.conf
echo "[5] - Adding rules to the server"
iptables -A INPUT -p tcp --dport "$i" -j ACCEPT
ufw allow "$i"/tcp
done
echo "external: $(ext_interface)" >> /etc/danted.conf
echo "socksmethod: username" >> /etc/danted.conf
echo "user.privileged: root" >> /etc/danted.conf
echo "user.unprivileged: nobody" >> /etc/danted.conf
echo "user.libwrap: nobody" >> /etc/danted.conf
echo " client pass {" >> /etc/danted.conf
echo " from: 0.0.0.0/0 to: 0.0.0.0/0" >> /etc/danted.conf
echo " log: connect error" >> /etc/danted.conf
echo "}" >> /etc/danted.conf
echo "socks pass {" >> /etc/danted.conf
echo " from: 0.0.0.0/0 to: 0.0.0.0/0" >> /etc/danted.conf
echo " log: connect error" >> /etc/danted.conf
echo "}" >> /etc/danted.conf
echo "[6] - Create a user"
read -p "Enter user name: " user
read -p "Enter user password: " pass
useradd -s /bin/false ${user}
echo "$user:$pass" | chpasswd
echo "[7] - Restarting the server service"
systemctl restart danted
systemctl enable danted
echo "[8] - Checking proxy availability"
for ((i = 7000; i <= 7010; i++))
do
curl --socks5 ${user}:${pass}@$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1):${i} ident.me; echo
done
echo "[9] - For manual testing"
for ((i = 7000; i <= 7010; i++))
do
echo "curl --socks5 ${user}:${pass}@$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1):${i} ident.me; echo"
done
echo "[!] Your proxy list"
for ((i = 7000; i <= 7010; i++))
do
echo "${user}:${pass}@$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1):${i}"
done
echo "[10] - DONE!!!"