mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-26 21:21:53 +08:00
修复全部SA1006: fmt.Errorf(i18n)统一使用"%s"前缀
This commit is contained in:
@@ -72,7 +72,7 @@ func ParseIP(host string, filename string, nohosts ...string) ([]string, error)
|
|||||||
sort.Strings(hosts)
|
sort.Strings(hosts)
|
||||||
|
|
||||||
if len(hosts) == 0 {
|
if len(hosts) == 0 {
|
||||||
return nil, fmt.Errorf(i18n.GetText("parser_no_valid_hosts"))
|
return nil, fmt.Errorf("%s", i18n.GetText("parser_no_valid_hosts"))
|
||||||
}
|
}
|
||||||
|
|
||||||
return hosts, nil
|
return hosts, nil
|
||||||
@@ -334,7 +334,7 @@ func looksLikeIPRange(s string) bool {
|
|||||||
func parseIPRangeString(rangeStr string, maxTargets int) ([]string, error) {
|
func parseIPRangeString(rangeStr string, maxTargets int) ([]string, error) {
|
||||||
parts := strings.Split(rangeStr, "-")
|
parts := strings.Split(rangeStr, "-")
|
||||||
if len(parts) != 2 {
|
if len(parts) != 2 {
|
||||||
return nil, fmt.Errorf(i18n.Tr("parser_invalid_ip_range_fmt", rangeStr))
|
return nil, fmt.Errorf("%s", i18n.Tr("parser_invalid_ip_range_fmt", rangeStr))
|
||||||
}
|
}
|
||||||
|
|
||||||
startIPStr := strings.TrimSpace(parts[0])
|
startIPStr := strings.TrimSpace(parts[0])
|
||||||
@@ -342,7 +342,7 @@ func parseIPRangeString(rangeStr string, maxTargets int) ([]string, error) {
|
|||||||
|
|
||||||
startIP := net.ParseIP(startIPStr)
|
startIP := net.ParseIP(startIPStr)
|
||||||
if startIP == nil {
|
if startIP == nil {
|
||||||
return nil, fmt.Errorf(i18n.Tr("parser_invalid_start_ip", startIPStr))
|
return nil, fmt.Errorf("%s", i18n.Tr("parser_invalid_start_ip", startIPStr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理简写格式 (如: 192.168.1.1-100)
|
// 处理简写格式 (如: 192.168.1.1-100)
|
||||||
@@ -353,7 +353,7 @@ func parseIPRangeString(rangeStr string, maxTargets int) ([]string, error) {
|
|||||||
// 处理完整格式 (如: 192.168.1.1-192.168.1.100)
|
// 处理完整格式 (如: 192.168.1.1-192.168.1.100)
|
||||||
endIP := net.ParseIP(endIPStr)
|
endIP := net.ParseIP(endIPStr)
|
||||||
if endIP == nil {
|
if endIP == nil {
|
||||||
return nil, fmt.Errorf(i18n.Tr("parser_invalid_end_ip", endIPStr))
|
return nil, fmt.Errorf("%s", i18n.Tr("parser_invalid_end_ip", endIPStr))
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseIPFullRange(startIP, endIP, maxTargets)
|
return parseIPFullRange(startIP, endIP, maxTargets)
|
||||||
@@ -363,18 +363,18 @@ func parseIPRangeString(rangeStr string, maxTargets int) ([]string, error) {
|
|||||||
func parseIPShortRange(startIPStr, endSuffix string, maxTargets int) ([]string, error) {
|
func parseIPShortRange(startIPStr, endSuffix string, maxTargets int) ([]string, error) {
|
||||||
endNum, err := strconv.Atoi(endSuffix)
|
endNum, err := strconv.Atoi(endSuffix)
|
||||||
if err != nil || endNum > 255 {
|
if err != nil || endNum > 255 {
|
||||||
return nil, fmt.Errorf(i18n.Tr("parser_invalid_ip_end_val", endSuffix))
|
return nil, fmt.Errorf("%s", i18n.Tr("parser_invalid_ip_end_val", endSuffix))
|
||||||
}
|
}
|
||||||
|
|
||||||
ipParts := strings.Split(startIPStr, ".")
|
ipParts := strings.Split(startIPStr, ".")
|
||||||
if len(ipParts) != 4 {
|
if len(ipParts) != 4 {
|
||||||
return nil, fmt.Errorf(i18n.Tr("parser_invalid_ip_fmt", startIPStr))
|
return nil, fmt.Errorf("%s", i18n.Tr("parser_invalid_ip_fmt", startIPStr))
|
||||||
}
|
}
|
||||||
|
|
||||||
prefixIP := strings.Join(ipParts[0:3], ".")
|
prefixIP := strings.Join(ipParts[0:3], ".")
|
||||||
startNum, err := strconv.Atoi(ipParts[3])
|
startNum, err := strconv.Atoi(ipParts[3])
|
||||||
if err != nil || startNum > endNum {
|
if err != nil || startNum > endNum {
|
||||||
return nil, fmt.Errorf(i18n.Tr("parser_invalid_ip_range_val", startIPStr, endSuffix))
|
return nil, fmt.Errorf("%s", i18n.Tr("parser_invalid_ip_range_val", startIPStr, endSuffix))
|
||||||
}
|
}
|
||||||
|
|
||||||
var allIP []string
|
var allIP []string
|
||||||
@@ -395,14 +395,14 @@ func parseIPFullRange(startIP, endIP net.IP, maxTargets int) ([]string, error) {
|
|||||||
start4 := startIP.To4()
|
start4 := startIP.To4()
|
||||||
end4 := endIP.To4()
|
end4 := endIP.To4()
|
||||||
if start4 == nil || end4 == nil {
|
if start4 == nil || end4 == nil {
|
||||||
return nil, fmt.Errorf(i18n.GetText("parser_ipv4_only"))
|
return nil, fmt.Errorf("%s", i18n.GetText("parser_ipv4_only"))
|
||||||
}
|
}
|
||||||
|
|
||||||
startInt := (int(start4[0]) << 24) | (int(start4[1]) << 16) | (int(start4[2]) << 8) | int(start4[3])
|
startInt := (int(start4[0]) << 24) | (int(start4[1]) << 16) | (int(start4[2]) << 8) | int(start4[3])
|
||||||
endInt := (int(end4[0]) << 24) | (int(end4[1]) << 16) | (int(end4[2]) << 8) | int(end4[3])
|
endInt := (int(end4[0]) << 24) | (int(end4[1]) << 16) | (int(end4[2]) << 8) | int(end4[3])
|
||||||
|
|
||||||
if startInt > endInt {
|
if startInt > endInt {
|
||||||
return nil, fmt.Errorf(i18n.GetText("parser_start_gt_end"))
|
return nil, fmt.Errorf("%s", i18n.GetText("parser_start_gt_end"))
|
||||||
}
|
}
|
||||||
|
|
||||||
var ips []string
|
var ips []string
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ func (s *ScanSession) DialTCP(ctx context.Context, network, address string, time
|
|||||||
// 检查发包限制
|
// 检查发包限制
|
||||||
if ok, err := CanSendPacketWith(s.Config, s.State); !ok {
|
if ok, err := CanSendPacketWith(s.Config, s.State); !ok {
|
||||||
LogError(fmt.Sprintf("TCP连接 %s 受限: %s", address, err.Error()))
|
LogError(fmt.Sprintf("TCP连接 %s 受限: %s", address, err.Error()))
|
||||||
return nil, fmt.Errorf(i18n.Tr("network_rate_limited", err.Error()))
|
return nil, fmt.Errorf("%s", i18n.Tr("network_rate_limited", err.Error()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取 dialer
|
// 获取 dialer
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ func NewWinBITSPlugin() *WinBITSPlugin {
|
|||||||
func (p *WinBITSPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinBITSPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ func NewWinIFEOPlugin() *WinIFEOPlugin {
|
|||||||
func (p *WinIFEOPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinIFEOPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ func NewWinLogonPlugin() *WinLogonPlugin {
|
|||||||
func (p *WinLogonPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinLogonPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ func NewWinRegistryPlugin() *WinRegistryPlugin {
|
|||||||
func (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ func NewWinSchTaskPlugin() *WinSchTaskPlugin {
|
|||||||
func (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
ext := strings.ToLower(filepath.Ext(pePath))
|
ext := strings.ToLower(filepath.Ext(pePath))
|
||||||
if ext != ".exe" && ext != ".dll" {
|
if ext != ".exe" && ext != ".dll" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_invalid_pe", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_invalid_pe", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ func NewWinServicePlugin() *WinServicePlugin {
|
|||||||
func (p *WinServicePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinServicePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ func NewWinStartupPlugin() *WinStartupPlugin {
|
|||||||
func (p *WinStartupPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinStartupPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ func NewWinWMIPlugin() *WinWMIPlugin {
|
|||||||
func (p *WinWMIPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
func (p *WinWMIPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||||
pePath := session.Config.WinPEFile
|
pePath := session.Config.WinPEFile
|
||||||
if pePath == "" {
|
if pePath == "" {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.GetText("local_pe_not_specified"))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.GetText("local_pe_not_specified"))}
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(pePath); err != nil {
|
if _, err := os.Stat(pePath); err != nil {
|
||||||
return &plugins.Result{Success: false, Error: fmt.Errorf(i18n.Tr("local_pe_not_found", pePath))}
|
return &plugins.Result{Success: false, Error: fmt.Errorf("%s", i18n.Tr("local_pe_not_found", pePath))}
|
||||||
}
|
}
|
||||||
|
|
||||||
absPath, _ := filepath.Abs(pePath)
|
absPath, _ := filepath.Abs(pePath)
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ func (p *ActiveMQPlugin) identifyService(ctx context.Context, info *common.HostI
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "activemq",
|
Service: "activemq",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "ActiveMQ STOMP")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "ActiveMQ STOMP")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func (p *CassandraPlugin) Scan(ctx context.Context, info *common.HostInfo, sessi
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "cassandra",
|
Service: "cassandra",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ func TestCredentialsConcurrently(
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: serviceName,
|
Service: serviceName,
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_test_creds")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_test_creds")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ func TestCredentialsConcurrently(
|
|||||||
Type: plugins.ResultTypeCredential, // 标记这是凭据测试结果
|
Type: plugins.ResultTypeCredential, // 标记这是凭据测试结果
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: serviceName,
|
Service: serviceName,
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_weak_pass")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_weak_pass")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func (p *ElasticsearchPlugin) Scan(ctx context.Context, info *common.HostInfo, s
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "elasticsearch",
|
Service: "elasticsearch",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ func (p *ElasticsearchPlugin) Scan(ctx context.Context, info *common.HostInfo, s
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "elasticsearch",
|
Service: "elasticsearch",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_weak_pass")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_weak_pass")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ func (p *ElasticsearchPlugin) identifyService(ctx context.Context, info *common.
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "elasticsearch",
|
Service: "elasticsearch",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "Elasticsearch")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "Elasticsearch")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func (p *FindNetPlugin) Scan(ctx context.Context, info *common.HostInfo, session
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "findnet",
|
Service: "findnet",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_port_restriction", "FindNet", "135")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_port_restriction", "FindNet", "135")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func (p *FTPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *co
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "ftp",
|
Service: "ftp",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func (p *KafkaPlugin) Scan(ctx context.Context, info *common.HostInfo, session *
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "kafka",
|
Service: "kafka",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ func (p *KafkaPlugin) identifyService(ctx context.Context, info *common.HostInfo
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "kafka",
|
Service: "kafka",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "Kafka")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "Kafka")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.IncrementTCPSuccessPacketCount()
|
state.IncrementTCPSuccessPacketCount()
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func (p *LDAPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *c
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "ldap",
|
Service: "ldap",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ func (p *MemcachedPlugin) identifyService(ctx context.Context, info *common.Host
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "memcached",
|
Service: "memcached",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "Memcached")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "Memcached")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func (p *MongoDBPlugin) Scan(ctx context.Context, info *common.HostInfo, session
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "mongodb",
|
Service: "mongodb",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ func (p *MongoDBPlugin) mongodbUnauth(ctx context.Context, info *common.HostInfo
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, fmt.Errorf(i18n.Tr("service_not_identified", "MongoDB"))
|
return false, fmt.Errorf("%s", i18n.Tr("service_not_identified", "MongoDB"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkMongoAuth 检查MongoDB认证状态
|
// checkMongoAuth 检查MongoDB认证状态
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func (p *MSSQLPlugin) Scan(ctx context.Context, info *common.HostInfo, session *
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "mssql",
|
Service: "mssql",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ func (p *MSSQLPlugin) identifyService(ctx context.Context, info *common.HostInfo
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "mssql",
|
Service: "mssql",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "MSSQL")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "MSSQL")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func (p *MySQLPlugin) Scan(ctx context.Context, info *common.HostInfo, session *
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "mysql",
|
Service: "mysql",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ func (p *MySQLPlugin) identifyService(ctx context.Context, info *common.HostInfo
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "mysql",
|
Service: "mysql",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "MySQL")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "MySQL")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func (p *Neo4jPlugin) Scan(ctx context.Context, info *common.HostInfo, session *
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "neo4j",
|
Service: "neo4j",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ func (p *Neo4jPlugin) identifyService(ctx context.Context, info *common.HostInfo
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "neo4j",
|
Service: "neo4j",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "Neo4j")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "Neo4j")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func (p *OraclePlugin) Scan(ctx context.Context, info *common.HostInfo, session
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "oracle",
|
Service: "oracle",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func (p *PostgreSQLPlugin) Scan(ctx context.Context, info *common.HostInfo, sess
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "postgresql",
|
Service: "postgresql",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ func (p *PostgreSQLPlugin) identifyService(ctx context.Context, info *common.Hos
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "postgresql",
|
Service: "postgresql",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "PostgreSQL")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "PostgreSQL")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func (p *RabbitMQPlugin) Scan(ctx context.Context, info *common.HostInfo, sessio
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "rabbitmq",
|
Service: "rabbitmq",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ func (p *RabbitMQPlugin) testManagementInterface(ctx context.Context, info *comm
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "rabbitmq",
|
Service: "rabbitmq",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "RabbitMQ")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "RabbitMQ")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ func (p *RDPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *co
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "rdp",
|
Service: "rdp",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_auth_failed")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_auth_failed")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func (p *RsyncPlugin) Scan(ctx context.Context, info *common.HostInfo, session *
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "rsync",
|
Service: "rsync",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ func (p *RsyncPlugin) identifyService(ctx context.Context, info *common.HostInfo
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "rsync",
|
Service: "rsync",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "Rsync")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "Rsync")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ func (a *SMB1Authenticator) Authenticate(ctx context.Context, host string, port
|
|||||||
resultChan <- &AuthResult{
|
resultChan <- &AuthResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
ErrorType: ErrorTypeAuth,
|
ErrorType: ErrorTypeAuth,
|
||||||
Error: fmt.Errorf(i18n.GetText("service_auth_failed")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_auth_failed")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func (p *SMTPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *c
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "smtp",
|
Service: "smtp",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ func (p *SSHPlugin) identifyService(ctx context.Context, info *common.HostInfo,
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "ssh",
|
Service: "ssh",
|
||||||
Error: fmt.Errorf(i18n.Tr("service_not_identified", "SSH")),
|
Error: fmt.Errorf("%s", i18n.Tr("service_not_identified", "SSH")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ func (p *TelnetPlugin) Scan(ctx context.Context, info *common.HostInfo, session
|
|||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
Service: "telnet",
|
Service: "telnet",
|
||||||
Error: fmt.Errorf(i18n.GetText("service_no_credentials")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ func (p *TelnetPlugin) doTelnetAuth(ctx context.Context, info *common.HostInfo,
|
|||||||
resultChan <- &AuthResult{
|
resultChan <- &AuthResult{
|
||||||
Success: false,
|
Success: false,
|
||||||
ErrorType: ErrorTypeAuth,
|
ErrorType: ErrorTypeAuth,
|
||||||
Error: fmt.Errorf(i18n.GetText("service_auth_failed")),
|
Error: fmt.Errorf("%s", i18n.GetText("service_auth_failed")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
Reference in New Issue
Block a user