MCPcopy
hub / github.com/dreadl0ck/netcap / guessOS

Function guessOS

decoder/stream/ssh/ssh_reader.go:657–679  ·  view source on GitHub ↗

guessOS attempts to guess the OS from the SSH ident string

(ident string)

Source from the content-addressed store, hash-verified

655
656// guessOS attempts to guess the OS from the SSH ident string
657func 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}

Callers 1

searchKexInitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected