MCPcopy Create free account
hub / github.com/Adminisme/ServerScan / fromString

Method fromString

ServerScan Air/package/vscan/vscan.go:98–139  ·  view source on GitHub ↗
(data string)

Source from the content-addressed store, hash-verified

96}
97
98func (p *Probe) fromString(data string) error {
99 var err error
100
101 data = strings.TrimSpace(data)
102 lines := strings.Split(data, "\n")
103 probeStr := lines[0]
104
105 p.parseProbeInfo(probeStr)
106
107 var matchs []Match
108 for _, line := range lines {
109 if strings.HasPrefix(line, "match ") {
110 match, err := p.getMatch(line)
111 if err != nil {
112 continue
113 }
114 matchs = append(matchs, match)
115 } else if strings.HasPrefix(line, "softmatch ") {
116 softMatch, err := p.getSoftMatch(line)
117 if err != nil {
118 continue
119 }
120 matchs = append(matchs, softMatch)
121 } else if strings.HasPrefix(line, "ports ") {
122 p.parsePorts(line)
123 } else if strings.HasPrefix(line, "sslports ") {
124 p.parseSSLPorts(line)
125 } else if strings.HasPrefix(line, "totalwaitms ") {
126 p.parseTotalWaitMS(line)
127 } else if strings.HasPrefix(line, "totalwaitms ") {
128 p.parseTotalWaitMS(line)
129 } else if strings.HasPrefix(line, "tcpwrappedms ") {
130 p.parseTCPWrappedMS(line)
131 } else if strings.HasPrefix(line, "rarity ") {
132 p.parseRarity(line)
133 } else if strings.HasPrefix(line, "fallback ") {
134 p.parseFallback(line)
135 }
136 }
137 p.Matchs = &matchs
138 return err
139}
140
141func (p *Probe) parsePorts(data string) {
142 p.Ports = data[len("ports")+1:]

Callers 1

Calls 9

parseProbeInfoMethod · 0.95
getMatchMethod · 0.95
getSoftMatchMethod · 0.95
parsePortsMethod · 0.95
parseSSLPortsMethod · 0.95
parseTotalWaitMSMethod · 0.95
parseTCPWrappedMSMethod · 0.95
parseRarityMethod · 0.95
parseFallbackMethod · 0.95

Tested by

no test coverage detected