This repository was archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathssh-version
More file actions
executable file
·48 lines (34 loc) · 1.45 KB
/
ssh-version
File metadata and controls
executable file
·48 lines (34 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# +-----------------------------------------------------------------------------------------------------------+
# | Title : ssh-version |
# | Description : Shows version of the SSH server you are connecting to |
# | Author : Sven Wick <sven.wick@gmx.de> |
# | Contributors : Denis Meiswinkel |
# | URL : https://github.com/vaporup/ssh-tools |
# | Based On : http://www.commandlinefu.com/commands/view/1809/get-the-version-of-sshd-on-a-remote-system |
# +-----------------------------------------------------------------------------------------------------------+
ssh_opts=(
-o "BatchMode=yes"
-o "CheckHostIP=no"
-o "StrictHostKeyChecking=no"
-o "ConnectTimeout=16"
-o "PasswordAuthentication=no"
-o "PubkeyAuthentication=no"
)
#
# Usage/Help message
#
function usage() {
cat << EOF
Usage: ${0##*/} [OPTIONS] hostname
Examples:
${0##*/} 127.0.0.1
${0##*/} -p 35007 127.0.0.1
EOF
}
if [[ -z $1 || $1 == "--help" ]]; then
usage
exit 1
fi
SSH_VERSION=$(ssh -vN "${ssh_opts[@]}" "$@" -l ssh-version 2>&1 | grep "remote software version")
echo "${SSH_VERSION#debug1: }"