guessOS attempts to guess the OS from the SSH ident string
(ident string)
| 655 | |
| 656 | // guessOS attempts to guess the OS from the SSH ident string |
| 657 | func guessOS(ident string) string { |
| 658 | identLower := strings.ToLower(ident) |
| 659 | |
| 660 | if strings.Contains(identLower, "ubuntu") { |
| 661 | return "Ubuntu Linux" |
| 662 | } else if strings.Contains(identLower, "debian") { |
| 663 | return "Debian Linux" |
| 664 | } else if strings.Contains(identLower, "centos") || strings.Contains(identLower, "rhel") || strings.Contains(identLower, "red hat") { |
| 665 | return "Red Hat/CentOS Linux" |
| 666 | } else if strings.Contains(identLower, "freebsd") { |
| 667 | return "FreeBSD" |
| 668 | } else if strings.Contains(identLower, "windows") { |
| 669 | return "Windows" |
| 670 | } else if strings.Contains(identLower, "cisco") { |
| 671 | return "Cisco IOS" |
| 672 | } else if strings.Contains(identLower, "dropbear") { |
| 673 | return "Embedded Linux" |
| 674 | } else if strings.Contains(identLower, "openssh") { |
| 675 | // Generic OpenSSH - likely Unix/Linux |
| 676 | return "Unix/Linux" |
| 677 | } |
| 678 | return "" |
| 679 | } |