first upload

This commit is contained in:
Leon Vita 2022-08-29 16:50:26 +00:00
parent 19e56ba12a
commit b237b1de8c
2 changed files with 81 additions and 0 deletions

75
gen.sh Normal file
View File

@ -0,0 +1,75 @@
#!/usr/bin
ips=("10.10.11.1/24" "10.10.12.1/24" "192.168.1.1/24")
echo -e "Please Put The Client Ip Address With Subnet:\r"
echo -e "The Ip Please:\r"; read user_input
sleep 1
#Checking IPS
echo "Checking.....";sleep 1
check_ip () {
for ip in "${ips[@]}"
do
if [[ "$ip" == "$user_input" ]];then
echo "ip exist"
ip_checked= return 1
fi
done
#Checking if the ip net exist do this:
if [[ $i -ne 1 ]]
then
echo "Ip Accepted:";echo "Your Config will be generate in seconds."
sleep 2
gen
fi
}
gen () {
#gen keys for Clinet:
wg genkey | tee privatekey | wg pubkey > publickey
#___________________________________________________
#Create file for config the clinet.
#Request Check Function From ips.sh
touch vpn.conf;echo "[Interface]" >> vpn.conf;echo "Address = $user_input" >> vpn.conf
echo "PrivateKey = $(cat privatekey)" >> vpn.conf
echo -e "Would You Like To Have DNS:\r:";echo "[1=yes] or [2=no]"
yes=1;no=2
read answer
if [ $answer -eq 1 ];then
echo -e "Which DNS Would You Like To Have:\r";read DNS
echo "DNS = $DNS" >> vpn.conf
elif [ $answer -eq 2 ];then
echo "Ok Continue....."
else
echo "Oops Wrong input the code will continue....."
fi
echo "Adding peer......";sleep 2
echo "[Peer]">>vpn.conf;
echo "PublicKey = M6T+PwMTUhr6BJFGu7OY0she6Z2laPkZKCQWE0HRahE=">> vpn.conf
echo "Endpoint = 176.58.109.31:7000">> vpn.conf
echo "Please add allow ips with subnet Ex:10.10.11.1/24:"
echo -e "Input Your Allow IPS :\r";read allow
echo "AllowedIPs= $allow ">> vpn.conf
echo "PersistentKeepalive = 25" >> vpn.conf
echo "Would You Like To Have This Config On QR-Code Or File:"
qr=1
file=2
echo -e "QR-code Press 1:\nFile Press 2:\n"
if [ $qr -eq 1 ];then
qrencode -t ansiutf8 < . qr-scan-me.conf
echo "Please scan this code with wireguard-app"
elif [ $file -eq 2 ];then
echo "Your file is ready"
else
echo "Oops wrong input"
fi
#cleaning files
echo "Cleaning....";sleep 1
rm privatekey publickey
echo "Done generating config:"
}
check_ip

6
test.sh Normal file
View File

@ -0,0 +1,6 @@
echo -ne '##### (33%)\n'
sleep 1
echo -ne '############# (66%)\n'
sleep 1
echo -ne '####################### (100%)\n'
echo -ne '\n'