mirror of
				https://github.com/byReqz/conn.git
				synced 2025-10-31 20:21:30 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			3ca589818b
			...
			af97e58888
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | af97e58888 | 
| @@ -1,6 +1,6 @@ | |||||||
| # conn | # conn | ||||||
|  |  | ||||||
| __this branch has been merged into main and is no longer maintained__ | __the script is actively being rewritten on this branch and might not be on a usable state right now__ | ||||||
|  |  | ||||||
| quick and dirty server availability check <br> <br> | quick and dirty server availability check <br> <br> | ||||||
| basically just a way too complex wrapper for nmap and fping <br> | basically just a way too complex wrapper for nmap and fping <br> | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								conn.sh
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								conn.sh
									
									
									
									
									
								
							| @@ -17,6 +17,19 @@ arguments: | |||||||
|   -f / --fast       disable os check |   -f / --fast       disable os check | ||||||
|   -s / --simple     simplify output" |   -s / --simple     simplify output" | ||||||
|  |  | ||||||
|  | show_notfound="[error] argument not found | ||||||
|  |  | ||||||
|  | available arguments: | ||||||
|  |   -h / --help       show help page (this) | ||||||
|  |   -6 / --force-ipv6 force ipv6 portscanning (also forces portscanning) | ||||||
|  |   -4 / --force-ipv4 force ipv4 portscanning (also forces portscanning) | ||||||
|  |   -y / --yes        portscan without asking | ||||||
|  |   -n / --no         dont portscan | ||||||
|  |   -w / --wait       wait for active connection | ||||||
|  |   -u / --update     update the script | ||||||
|  |   -f / --fast       disable os check | ||||||
|  |   -s / --simple     simplify output" | ||||||
|  |  | ||||||
| function check_update { | function check_update { | ||||||
|   if [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/hash) != $(md5sum $0 | cut -c -32) ]] && [[ -z $1 ]] || [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/hash) != $(md5sum $0 | cut -c -32) ]] && [[ $1 != "--update" ]] || [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/hash) != $(md5sum $0 | cut -c -32) ]] && [[ $1 != "-u" ]];then |   if [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/hash) != $(md5sum $0 | cut -c -32) ]] && [[ -z $1 ]] || [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/hash) != $(md5sum $0 | cut -c -32) ]] && [[ $1 != "--update" ]] || [[ $(curl -s https://raw.githubusercontent.com/byReqz/conn/main/hash) != $(md5sum $0 | cut -c -32) ]] && [[ $1 != "-u" ]];then | ||||||
|     echo "#############################################" |     echo "#############################################" | ||||||
| @@ -42,7 +55,7 @@ function run_update { | |||||||
| } | } | ||||||
|  |  | ||||||
| function prepare { | function prepare { | ||||||
|   check_update |   #check_update | ||||||
|   get_args "$@" |   get_args "$@" | ||||||
|   set_argvars $args |   set_argvars $args | ||||||
|   validate $input |   validate $input | ||||||
| @@ -55,7 +68,16 @@ function get_args { | |||||||
|     input=$(echo "$input" | sed "s/$arg//g") |     input=$(echo "$input" | sed "s/$arg//g") | ||||||
|   done |   done | ||||||
|  |  | ||||||
|   #quick fix to prevent nslookups interactive mode being triggered by invalid arguments | # needs work | ||||||
|  | #  argcheck=$(echo $input | grep -o -e " -* " | xargs) | ||||||
|  | #  echo $argcheck | ||||||
|  | #  if [[ -n "$argcheck" ]];then | ||||||
|  | #    for arg in $argcheck; do | ||||||
|  | #      echo "the given argument \""$arg"\" is not known" | ||||||
|  | #    done | ||||||
|  | #  fi | ||||||
|  |  | ||||||
|  |   #quick fix to prevent nslookups interactive mode being triggered by wrong arguments | ||||||
|   #some other places in the code have also gotten a leading space to prevent similar issues |   #some other places in the code have also gotten a leading space to prevent similar issues | ||||||
|   input=$(echo "$input" | tr -d "-") |   input=$(echo "$input" | tr -d "-") | ||||||
| } | } | ||||||
| @@ -100,7 +122,6 @@ function main { | |||||||
|   if [[ $simpleoutput == true ]] && [[ -n $hosts ]];then |   if [[ $simpleoutput == true ]] && [[ -n $hosts ]];then | ||||||
|     echo "-------------------Availability----------------------" |     echo "-------------------Availability----------------------" | ||||||
|     fping $only -e $@ |     fping $only -e $@ | ||||||
|     if [[ $oscheck != "false" ]];then |  | ||||||
|     echo "" |     echo "" | ||||||
|     for host in $@;do |     for host in $@;do | ||||||
|       linuxping=$(nping $only -c1 -p22,222 "$host") |       linuxping=$(nping $only -c1 -p22,222 "$host") | ||||||
| @@ -117,7 +138,6 @@ function main { | |||||||
|         echo "$host seems to be booted into (desktop) Windows" |         echo "$host seems to be booted into (desktop) Windows" | ||||||
|       fi |       fi | ||||||
|     done |     done | ||||||
|     fi |  | ||||||
|     echo "-----------------------------------------------------" |     echo "-----------------------------------------------------" | ||||||
|   else |   else | ||||||
|     for host in $hosts;do |     for host in $hosts;do | ||||||
| @@ -224,6 +244,6 @@ elif [[ "$1" == "-h" ]];then | |||||||
|   check_update |   check_update | ||||||
|   echo "$show_help" |   echo "$show_help" | ||||||
| else | else | ||||||
|   check_update |   #check_update | ||||||
|   echo "$show_help" |   echo "$show_help" | ||||||
| fi | fi | ||||||
		Reference in New Issue
	
	Block a user