{"record":{"id":"27a076ac4cc0fd02","repo":"shadow1ng/fscan","slug":"parser-invalid-start-ip-27a076","errorCode":null,"errorMessage":"parser_invalid_start_ip","messagePattern":"parser_invalid_start_ip","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/parsers/parsers.go","lineNumber":352,"sourceCode":"\t}\n\t// 检查 - 前面的部分是否是有效IP\n\tstartPart := s[:idx]\n\treturn net.ParseIP(startPart) != nil\n}\n\n// parseIPRangeString 解析IP范围字符串\nfunc parseIPRangeString(rangeStr string) ([]string, error) {\n\tparts := strings.Split(rangeStr, \"-\")\n\tif len(parts) != 2 {\n\t\treturn nil, fmt.Errorf(\"%s\", i18n.Tr(\"parser_invalid_ip_range_fmt\", rangeStr))\n\t}\n\n\tstartIPStr := strings.TrimSpace(parts[0])\n\tendIPStr := strings.TrimSpace(parts[1])\n\n\tstartIP := net.ParseIP(startIPStr)\n\tif startIP == nil {\n\t\treturn nil, fmt.Errorf(\"%s\", i18n.Tr(\"parser_invalid_start_ip\", startIPStr))\n\t}\n\n\t// 处理简写格式 (如: 192.168.1.1-100)\n\tif len(endIPStr) < 4 || !strings.Contains(endIPStr, \".\") {\n\t\treturn parseIPShortRange(startIPStr, endIPStr)\n\t}\n\n\t// 处理完整格式 (如: 192.168.1.1-192.168.1.100)\n\tendIP := net.ParseIP(endIPStr)\n\tif endIP == nil {\n\t\treturn nil, fmt.Errorf(\"%s\", i18n.Tr(\"parser_invalid_end_ip\", endIPStr))\n\t}\n\n\treturn parseIPFullRange(startIP, endIP)\n}\n\n// parseIPShortRange 解析短格式IP范围\nfunc parseIPShortRange(startIPStr, endSuffix string) ([]string, error) {","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/common/parsers/parsers.go#L334-L370","documentation":"In parseIPRangeString, after splitting, the start part is parsed with net.ParseIP. If it is not a valid IP literal, the function returns 'parser_invalid_start_ip' with the offending string. It means the left side of the '-' range is not a parseable IP address.","triggerScenarios":"parseIPRangeString receiving ranges like 'abc-192.168.1.10' or '192.168.1-192.168.1.5' where strings.TrimSpace(parts[0]) fails net.ParseIP.","commonSituations":"Truncated first octets (forgot a segment), hostnames on the left side of a range, or stray whitespace/characters in scripts generating the target list.","solutions":["Write the start address as a full dotted-quad IPv4, e.g. 192.168.1.1","Remove hostnames — ranges must start with an IP literal","Pre-validate with net.ParseIP(parts[0]) != nil before calling ParseIP"],"exampleFix":"// before\nParseIP(\"192.168.1-192.168.1.5\", \"\")\n// after\nParseIP(\"192.168.1.1-192.168.1.5\", \"\")","handlingStrategy":"validation","validationCode":"func validStartIP(rangeStr string) bool {\n\tparts := strings.Split(rangeStr, \"-\")\n\treturn len(parts) == 2 && net.ParseIP(strings.TrimSpace(parts[0])) != nil\n}","typeGuard":null,"tryCatchPattern":"if !validStartIP(rangeStr) {\n\treturn fmt.Errorf(\"start of %q is not an IP\", rangeStr)\n}\n_, err := parsers.ParseIP(rangeStr, \"\")","preventionTips":["Write the start address as a full dotted-quad IPv4","Never put hostnames on the left side of a range","Check for truncated octets in generated target lists"],"tags":["ip-range","ip-parsing","invalid-input"],"backgroundTag":"invalid-argument-value","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}