2023-05-05 22:28:45 +00:00
|
|
|
#!/bin/sh
|
2023-05-18 05:26:44 +00:00
|
|
|
# ipv6 clone helper script - developed by acidvegas (https://git.acid.vegas/random)
|
2023-05-05 22:28:45 +00:00
|
|
|
interface='eth0'
|
2023-05-18 05:26:44 +00:00
|
|
|
subnet='2607:5300:201:3000:'
|
2023-05-05 22:28:45 +00:00
|
|
|
|
2023-05-18 05:26:44 +00:00
|
|
|
rnd() {
|
|
|
|
echo $(tr -dc 'A-F0-9' < /dev/urandom | head -c4)
|
2023-05-05 22:28:45 +00:00
|
|
|
}
|
|
|
|
|
2023-05-18 05:26:44 +00:00
|
|
|
usage() {
|
|
|
|
echo "v6 add <num> | generate & add <nun> ipv6 addresses (saved to ~/.v6.log)"
|
|
|
|
echo "v6 del | delete all ipv6 addresses created by this script"
|
2023-05-05 22:28:45 +00:00
|
|
|
}
|
|
|
|
|
2023-05-18 05:26:44 +00:00
|
|
|
if [ "$#" = '2' ]; then
|
|
|
|
if [ "$1" = 'add' ]; then
|
|
|
|
for i in $(seq $2); do
|
|
|
|
address = "$subnet:$(rnd):$(rnd):$(rnd):$(rnd)"
|
|
|
|
sudo ip addr add $address dev $1
|
|
|
|
echo $address
|
|
|
|
echo $address >> .v6.log
|
|
|
|
done
|
|
|
|
elif [ "$1" = 'del' ]; then
|
|
|
|
while IFS= read -r address; do
|
|
|
|
sudo ip addr del $address dev $interface
|
|
|
|
done < .v6.log
|
|
|
|
rm .v6.log
|
|
|
|
else
|
|
|
|
usage
|
|
|
|
else
|
|
|
|
usage
|
|
|
|
fi
|