Initial Commit
This commit is contained in:
		| @@ -1 +1 @@ | |||||||
| octosrv.me	2323 | example.com	2323 | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								sshin
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								sshin
									
									
									
									
									
								
							| @@ -1,7 +1,11 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
|  |  | ||||||
| usage() { | usage() { | ||||||
| 	[[ $# -le 1 ]] && echo "Usage: sshin user hostname/last byte of IP address" && echo "sshin -h for more information" || echo "Optional parameters: custom server port" && echo "Example: \"sshin foo bar.com \" will run \"ssh foo@bar.com -p 2323\"" | 	echo "Usage: sshin user hostname/last byte of IP address"  | ||||||
|  | 	echo | ||||||
|  | 	echo "This tools automatically chooses the server port based on the port_association file in ~/local/share/sshin/port_association" | ||||||
|  | 	echo | ||||||
|  | 	echo "Example: \"sshin foo bar.com \" will run \"ssh foo@bar.com -p 2323\"" | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -11,5 +15,12 @@ IP_PREFIX="192.168.1." | |||||||
| re='^[0-9]+$' | re='^[0-9]+$' | ||||||
| command="ssh ${1}@" | command="ssh ${1}@" | ||||||
| shift | shift | ||||||
| [[ $1 =~ $re ]] && command="${command}192.168.1.$2" || port=$(grep ~/.local/share/sshin/port_association $1 | awk '{print $NF}') && command="${command}$1 -p $port" | #[[ $1 =~ $re ]] && command="${command}192.168.1.$2" || port=$(grep $1 ~/.local/share/sshin/port_association | awk '{print $NF}') && command="${command}$1 -p $port" | ||||||
| echo $command | if [[ $1 =~ $re ]] | ||||||
|  | then | ||||||
|  | 	command="${command}192.168.1.$1" | ||||||
|  | else | ||||||
|  | 	port=$(grep $1 ~/.local/share/sshin/port_association | awk '{print $NF}') && command="${command}$1 -p $port" | ||||||
|  | fi | ||||||
|  | #echo $command | ||||||
|  | $command | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user