{"record":{"id":"f135a6e85ed8df91","repo":"shadow1ng/fscan","slug":"portfinger-probe-protocol-invalid","errorCode":null,"errorMessage":"portfinger_probe_protocol_invalid","messagePattern":"portfinger_probe_protocol_invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/portfinger/probe_parser.go","lineNumber":37,"sourceCode":"\n\t// 解析各个字段\n\tdirectiveName := data[:blankIndex]\n\tFlag := data[blankIndex+1 : blankIndex+2]\n\tdelimiter := data[blankIndex+2 : blankIndex+3]\n\tdirectiveStr := data[blankIndex+3:]\n\n\tdirective.DirectiveName = directiveName\n\tdirective.Flag = Flag\n\tdirective.Delimiter = delimiter\n\tdirective.DirectiveStr = directiveStr\n\n\treturn directive\n}\n\n// parseProbeInfo 解析探测器信息，返回错误替代 panic\nfunc (p *Probe) parseProbeInfo(probeStr string) error {\n\tif len(probeStr) < 5 {\n\t\treturn fmt.Errorf(\"%s\", i18n.GetText(\"portfinger_probe_protocol_invalid\"))\n\t}\n\n\t// 提取协议和其他信息\n\tproto := probeStr[:4]\n\tother := probeStr[4:]\n\n\t// 验证协议类型\n\tif proto != \"TCP \" && proto != \"UDP \" {\n\t\treturn fmt.Errorf(\"%s\", i18n.GetText(\"portfinger_probe_protocol_invalid\"))\n\t}\n\n\t// 验证其他信息不为空\n\tif len(other) == 0 {\n\t\treturn fmt.Errorf(\"%s\", i18n.GetText(\"portfinger_probe_name_invalid\"))\n\t}\n\n\t// 解析指令\n\tdirective := p.getDirectiveSyntax(other)","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/core/portfinger/probe_parser.go#L19-L55","documentation":"parseProbeInfo requires a probe definition of at least 5 characters: a 4-byte protocol identifier plus at least one payload character. Shorter strings cannot contain a valid probe header, so this error is returned instead of panicking.","triggerScenarios":"fromString receiving an empty, whitespace-only, or truncated probe line (fewer than 5 chars) when loading the probe database.","commonSituations":"Blank or malformed lines in the probe file being parsed as probes; files truncated by a failed download or bad merge; comment/garbage lines not filtered before parsing.","solutions":["Fix or remove the short/malformed probe line in the probe definitions file.","Restore the original probe database file (re-download the stock definitions).","Pre-filter lines: skip empties and validate a minimum length/known protocol prefix (e.g. 'TCP ', 'UDP ') before calling fromString."],"exampleFix":"// before\nProbeFromString(\"TCP\") // < 5 chars, errors\n// after\nProbeFromString(\"TCP GET / HTTP/1.0\\r\\n\\r\\n\")","handlingStrategy":"validation","validationCode":"func probeLineOK(line string) bool {\n    return len(line) >= 5 && (strings.HasPrefix(line, \"TCP \") || strings.HasPrefix(line, \"UDP \"))\n}","typeGuard":null,"tryCatchPattern":"pr := &Probe{}\nif err := pr.parseProbeInfo(line); err != nil {\n    log.Warnf(\"skipping invalid probe line %q: %v\", line, err)\n    return nil\n}","preventionTips":["Skip blank/comment lines before parsing probes","Verify probe file integrity (size/checksum) after download","Validate each line starts with a known 4-char protocol token"],"tags":["portscan","fingerprint","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}