mirror of
https://github.com/byReqz/conn.git
synced 2024-11-22 00:53:14 +00:00
adding updater
This commit is contained in:
parent
256a92ebdc
commit
c287d5ec65
33
conn.sh
33
conn.sh
@ -1,6 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
while [ ! -n "$1" ]; do
|
||||
version=19
|
||||
if [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/version) > "$version" ]] && [[ -z $1 ]] || [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/version) > "$version" ]] && [[ $1 != "--update" ]] || [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/version) > "$version" ]] && [[ $1 != "-u" ]];then
|
||||
echo "#############################################"
|
||||
echo -e "\e[4mnote: newer version detected, use -u to update\e[0m"
|
||||
echo "#############################################"
|
||||
echo ""
|
||||
fi
|
||||
while [ ! -n "$1" ]; do
|
||||
echo "Usage: $0 (options) <ip>"
|
||||
echo "Options:"
|
||||
echo " -m/--multi -- test multiple ips / disable portscan"
|
||||
@ -11,9 +17,10 @@ while [ ! -n "$1" ]; do
|
||||
echo " -n/--no -- dont portscan"
|
||||
echo " -p/--portscan -- same as -y"
|
||||
echo " -w/--wait -- wait for active connection"
|
||||
echo " -u/--update -- update the script to the newest version"
|
||||
exit
|
||||
done
|
||||
while [ ! -z "$1" ]; do
|
||||
done
|
||||
while [ ! -z "$1" ]; do
|
||||
if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]];then
|
||||
echo "Usage: $0 (options) <ip> (y/n)"
|
||||
echo "Options:"
|
||||
@ -25,6 +32,7 @@ while [ ! -z "$1" ]; do
|
||||
echo " -n/--no -- dont portscan"
|
||||
echo " -p/--portscan -- same as -y"
|
||||
echo " -w/--wait -- wait for active connection"
|
||||
echo " -u/--update -- update the script to the newest version"
|
||||
exit
|
||||
elif [[ $1 == "-m" ]] || [[ "$1" == "--multi" ]];then
|
||||
echo "multi-ip mode, portscan disabled"
|
||||
@ -73,6 +81,19 @@ while [ ! -z "$1" ]; do
|
||||
fping -6 -c 4 $2
|
||||
echo "------------------------------------------------"
|
||||
exit
|
||||
elif [[ $1 == "-u" ]] || [[ "$1" == "--update" ]];then
|
||||
if [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/version) > "$version" ]];then
|
||||
wget -O $0 --quiet "https://raw.githubusercontent.com/byReqz/conn/main/conn.sh"
|
||||
echo "#############################################"
|
||||
echo -e "\e[4mscript has been updated to the newest version\e[0m"
|
||||
echo "#############################################"
|
||||
exit
|
||||
elif [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/version) < "$version" ]];then
|
||||
echo "#############################################"
|
||||
echo "no newer version found"
|
||||
echo "#############################################"
|
||||
exit
|
||||
fi
|
||||
elif [[ "$1" == "-w" ]] || [[ "$1" == "--wait" ]];then
|
||||
echo "-w used, waiting for active connection"
|
||||
echo "checking connection status for $2"
|
||||
@ -142,5 +163,5 @@ while [ ! -z "$1" ]; do
|
||||
else
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user