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
23
conn.sh
23
conn.sh
@ -1,5 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
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:"
|
||||
@ -11,6 +17,7 @@ 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
|
||||
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user