forked from gr33n37/gr33n37-ip-changer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathip-changer.sh
executable file
·83 lines (72 loc) · 2.52 KB
/
ip-changer.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
[[ "$UID" -ne 0 ]] && {
echo "Script must be run as root."
exit 1
}
install_packages() {
local distro
distro=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
distro=${distro//\"/}
case "$distro" in
*"Ubuntu"* | *"Debian"*)
apt-get update
apt-get install -y curl tor
;;
*"Fedora"* | *"CentOS"* | *"Red Hat"* | *"Amazon Linux"*)
yum update
yum install -y curl tor
;;
*"Arch"*)
pacman -S --noconfirm curl tor
;;
*)
echo "Unsupported distribution: $distro. Please install curl and tor manually."
exit 1
;;
esac
}
if ! command -v curl &> /dev/null || ! command -v tor &> /dev/null; then
echo "Installing curl and tor"
install_packages
fi
if ! systemctl --quiet is-active tor.service; then
echo "Starting tor service"
systemctl start tor.service
fi
get_ip() {
local url get_ip ip
url="https://checkip.amazonaws.com"
get_ip=$(curl -s -x socks5h://127.0.0.1:9050 "$url")
ip=$(echo "$get_ip" | grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
echo "$ip"
}
change_ip() {
echo "Reloading tor service"
systemctl reload tor.service
echo -e "\033[34mNew IP address: $(get_ip)\033[0m"
}
clear
cat << EOF
____ ____ __________ _ _ __________ ___ ____ ____ _ _ _ _ _ ____ _____ ____
/ ___| _ \|___ /___ /| \ | |___ /___ | |_ _| _ \ / ___| | | | / \ | \ | |/ ___| ____| _ \
| | _| |_) | |_ \ |_ \| \| | |_ \ / / | || |_) |____| | | |_| | / _ \ | \| | | _| _| | |_) |
| |_| | _ < ___) |__) | |\ |___) |/ / | || __/_____| |___| _ |/ ___ \| |\ | |_| | |___| _ <
\____|_| \_\____/____/|_| \_|____//_/ |___|_| \____|_| |_/_/ \_\_| \_|\____|_____|_| \_\
EOF
while true; do
read -rp $'\033[34mEnter time interval in seconds (type 0 for infinite IP changes): \033[0m' interval
read -rp $'\033[34mEnter number of times to change IP address (type 0 for infinite IP changes): \033[0m' times
if [ "$interval" -eq "0" ] || [ "$times" -eq "0" ]; then
echo "Starting infinite IP changes"
while true; do
change_ip
interval=$(shuf -i 10-20 -n 1)
sleep "$interval"
done
else
for ((i=0; i< times; i++)); do
change_ip
sleep "$interval"
done
fi
done