mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-25 20:51:52 +08:00
修复全部SA1006: fmt.Errorf(i18n)统一使用"%s"前缀
This commit is contained in:
@@ -26,10 +26,10 @@ func NewWinBITSPlugin() *WinBITSPlugin {
|
||||
func (p *WinBITSPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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)
|
||||
|
||||
@@ -26,10 +26,10 @@ func NewWinIFEOPlugin() *WinIFEOPlugin {
|
||||
func (p *WinIFEOPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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)
|
||||
|
||||
@@ -26,10 +26,10 @@ func NewWinLogonPlugin() *WinLogonPlugin {
|
||||
func (p *WinLogonPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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)
|
||||
|
||||
@@ -28,10 +28,10 @@ func NewWinRegistryPlugin() *WinRegistryPlugin {
|
||||
func (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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)
|
||||
|
||||
@@ -28,14 +28,14 @@ func NewWinSchTaskPlugin() *WinSchTaskPlugin {
|
||||
func (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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))
|
||||
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)
|
||||
|
||||
@@ -28,10 +28,10 @@ func NewWinServicePlugin() *WinServicePlugin {
|
||||
func (p *WinServicePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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)
|
||||
|
||||
@@ -28,10 +28,10 @@ func NewWinStartupPlugin() *WinStartupPlugin {
|
||||
func (p *WinStartupPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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)
|
||||
|
||||
@@ -28,10 +28,10 @@ func NewWinWMIPlugin() *WinWMIPlugin {
|
||||
func (p *WinWMIPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
pePath := session.Config.WinPEFile
|
||||
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 {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user