Skip to content

Commit

Permalink
fix: 用户提示文案
Browse files Browse the repository at this point in the history
  • Loading branch information
iseki0 committed May 18, 2022
1 parent 4c7c6da commit 44074b1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/scan_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func scanRun(cmd *cobra.Command, args []string) {
totalDep := strconv.Itoa(ctx.ScanResult.DependenciesCount)
totalVuln := strconv.Itoa(ctx.ScanResult.IssuesCompsCount)
t := fmt.Sprint(
"项目扫描成功,依赖数:",
"项目扫描完成,依赖数:",
termenv.String(totalDep).Foreground(termenv.ANSIBrightCyan),
",漏洞数:",
termenv.String(totalVuln).Foreground(termenv.ANSIBrightRed),
Expand Down
2 changes: 1 addition & 1 deletion inspector/binscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func BinScan(ctx *ScanContext) error {
ui.Display(display.MsgError, fmt.Sprint("扫描失败,", e.Error()))
return e
} else {
ui.Display(display.MsgNotice, fmt.Sprintf("项目扫描成功,依赖数:%d,漏洞数:%d\n", r.DependenciesCount, r.IssuesCompsCount))
ui.Display(display.MsgNotice, fmt.Sprintf("项目扫描完成,依赖数:%d,漏洞数:%d\n", r.DependenciesCount, r.IssuesCompsCount))
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions module/go_mod/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ func New() base.Inspector {
func ScanGoProject(dir string, task *base.ScanTask) ([]base.Module, error) {
version, e := execGoVersion()
if e != nil {
task.UI.Display(display.MsgError, fmt.Sprintf("【%s】识别到您的环境中 Go 无法正常运行,可能会导致检测结果不完整,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
task.UI.Display(display.MsgError, fmt.Sprintf("[%s]识别到您的环境中 Go 无法正常运行,可能会导致检测结果不完整,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
return nil, ErrGoEnv
}
if e := execGoModTidy(dir); e != nil {
task.UI.Display(display.MsgError, fmt.Sprintf("【%s】通过 Go获取依赖信息失败,可能会导致检测结果不完整或失败,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
task.UI.Display(display.MsgError, fmt.Sprintf("[%s]通过 Go获取依赖信息失败,可能会导致检测结果不完整或失败,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
logger.Err.Println("go mod tidy execute failed.", e.Error())
return nil, e
}
Expand Down
4 changes: 2 additions & 2 deletions module/gradle/gradle.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (i *Inspector) Inspect(task *base.ScanTask) ([]base.Module, error) {
logger.Debug.Println("gradle inspect dir:", dir)
info, e := evalGradleInfo(dir)
if e != nil {
task.UI.Display(display.MsgError, fmt.Sprintf("【%s】识别到目录下没有 gradlew 文件或您的环境中 Gradle 无法正常运行,可能会导致检测结果不完整,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
task.UI.Display(display.MsgError, fmt.Sprintf("[%s]识别到目录下没有 gradlew 文件或您的环境中 Gradle 无法正常运行,可能会导致检测结果不完整,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
logger.Info.Println("check gradle failed", e.Error())
return nil, e
}
Expand All @@ -54,7 +54,7 @@ func (i *Inspector) Inspect(task *base.ScanTask) ([]base.Module, error) {
for _, projectId := range projects {
depInfo, e := evalGradleDependencies(dir, projectId, info)
if e != nil {
task.UI.Display(display.MsgError, fmt.Sprintf("【%s】通过 Gradle 获取依赖信息失败,可能会导致检测结果不完整或失败,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
task.UI.Display(display.MsgError, fmt.Sprintf("[%s]通过 Gradle 获取依赖信息失败,可能会导致检测结果不完整或失败,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
logger.Info.Println("evalGradleDependencies failed.", projectId, e.Error())
} else {
rs = append(rs, depInfo.BaseModule(filepath.Join(dir, "build.gradle")))
Expand Down
4 changes: 2 additions & 2 deletions module/maven/maven.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ func ScanMavenProject(dir string, task *base.ScanTask) ([]base.Module, error) {
if doMvnScan {
deps, e = scanMvnDependency(dir)
if e != nil {
task.UI.Display(display.MsgError, fmt.Sprintf("【%s】通过 Maven获取依赖信息失败,可能会导致检测结果不完整或失败,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
task.UI.Display(display.MsgError, fmt.Sprintf("[%s]通过 Maven获取依赖信息失败,可能会导致检测结果不完整或失败,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
logger.Err.Printf("mvn scan failed: %+v\n", e)
}
} else {
task.UI.Display(display.MsgError, fmt.Sprintf("【%s】识别到您的环境中 Maven 无法正常运行,可能会导致检测结果不完整,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
task.UI.Display(display.MsgError, fmt.Sprintf("[%s]识别到您的环境中 Maven 无法正常运行,可能会导致检测结果不完整,访问https://www.murphysec.com/docs/quick-start/language-support/ 了解详情", dir))
}
// analyze pom file
{
Expand Down

0 comments on commit 44074b1

Please sign in to comment.