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

Function parseSSHIdent

decoder/stream/ssh/ssh_reader.go:552–568  ·  view source on GitHub ↗
(ident string)

Source from the content-addressed store, hash-verified

550var regSSHIdent = regexp.MustCompile(`^(SSH-[0-9]\.?[0-9]?)-(.*[[:word:]]*)_([0-9]\.[0-9]?\.?[[:alnum:]]?[[:alnum:]]?)[[:space:]]?([[:alnum:]]*)`)
551
552func parseSSHIdent(ident string) *sshVersionInfo {
553 if m := regSSHIdent.FindStringSubmatch(ident); len(m) > 0 {
554 var os string
555 if len(m) > 4 {
556 os = m[4]
557 }
558
559 return &sshVersionInfo{
560 sshVersion: m[1],
561 productName: m[2],
562 productVersion: m[3],
563 os: os,
564 }
565 }
566
567 return nil
568}
569
570// buildAlgorithmsString creates a summary of the SSH algorithms from KexInit
571func buildAlgorithmsString(init KexInitMsg) string {

Callers 2

processSSHIdentMethod · 0.85
TestParseSSHIdentFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseSSHIdentFunction · 0.68