search

package
v0.0.0-...-8851a85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = cobra.Command{
	Use:   "search",
	Short: "Searching of signature files",
	Long:  color.GreenString(helpLong),
	Run: func(cmd *cobra.Command, args []string) {
		code = os.Getenv("FEATURE_CODE")
		path = os.Getenv("SOURCE_DIR")
		scan.Exec(func() error {
			scanner := &scan.Scanner{
				Path:    path,
				Code:    code,
				Matcher: new(scan.Md5Matcher),
			}
			restca := make([]scan.ResultElement, 10)
			if res, err := scanner.Search(code); err != nil {
				return err
			} else {
				for _, v := range res {
					restca = append(restca, scan.ResultElement{
						Path:   v.Path,
						Line:   "0",
						Column: "0",
						Msg:    fmt.Sprintf("匹配文件路径为:%v", v.Path),
						Rule:   "",
						Refs:   []scan.Ref{},
					})
				}
				scan.SaveFile("result.json", scanner, restca)
			}
			return nil
		})
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL