extractSoftwareVersion extracts the software version from SSH ident string
(ident string)
| 643 | |
| 644 | // extractSoftwareVersion extracts the software version from SSH ident string |
| 645 | func extractSoftwareVersion(ident string) string { |
| 646 | // SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5 |
| 647 | // Extract the part after SSH-x.x- |
| 648 | parts := strings.SplitN(ident, "-", 3) |
| 649 | if len(parts) >= 3 { |
| 650 | // Return everything after SSH-2.0- |
| 651 | return parts[2] |
| 652 | } |
| 653 | return "" |
| 654 | } |
| 655 | |
| 656 | // guessOS attempts to guess the OS from the SSH ident string |
| 657 | func guessOS(ident string) string { |