diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1418e3..782378c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: with: distribution: goreleaser version: latest - args: "release --clean --debug -f .github/conf/.goreleaser.yml" + args: "release --clean -f .github/conf/.goreleaser.yml" workdir: . env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/core/pocScan/lib/check.go b/core/pocScan/lib/check.go index a6e7d7d..fa9740c 100644 --- a/core/pocScan/lib/check.go +++ b/core/pocScan/lib/check.go @@ -5,14 +5,17 @@ import ( "Qscan-G/core/pocScan/info" "Qscan-G/core/slog" "Qscan-G/lib/color" + "Qscan-G/lib/misc" "crypto/md5" "fmt" "github.com/google/cel-go/cel" colorR "github.com/gookit/color" + "github.com/lcvvvv/stdio/chinese" "math/rand" "net/http" "net/url" "regexp" + "strconv" "strings" "sync" "time" @@ -36,10 +39,24 @@ func CheckMultiPoc(req *http.Request, pocs []*Poc, workers int) { for task := range tasks { isVul, _, name := executePoc(task.Req, task.Poc) if isVul { - red := colorR.BgRed.Render - format := "%-30v %-35v %s" - printStr := fmt.Sprintf(format, task.Req.URL, red("PocSuccess"), color.StrRandomColor(task.Poc.Name+","+name)) + printStr := fmt.Sprintf("%-30v %-35v %s", task.Req.URL, colorR.BgRed.Render("PocSuccess"), color.StrRandomColor(task.Poc.Name+","+name)) slog.Println(slog.DATA, printStr) + m := make(map[string]string) + sourceMap := misc.CloneMap(m) + if cw := app.Setting.OutputCSV; cw != nil { + sourceMap["URL"] = task.Req.URL.String() + sourceMap["Keyword"] = "PocSuccess" + sourceMap["POC"] = task.Poc.Name + "," + name + delete(sourceMap, "Header") + delete(sourceMap, "Cert") + delete(sourceMap, "Response") + delete(sourceMap, "Body") + sourceMap["Digest"] = strconv.Quote(sourceMap["Digest"]) + for key, value := range sourceMap { + sourceMap[key] = chinese.ToUTF8(value) + } + cw.Push(sourceMap) + } } wg.Done() } @@ -365,17 +382,43 @@ func clusterpoc(oReq *http.Request, p *Poc, variableMap map[string]interface{}, format := "%-30v %-35v %s" printStr := fmt.Sprintf(format, req.Url.Scheme, red("PocSuccess"), color.StrRandomColor(req.Url.Host+","+req.Url.Path+","+p.Name)) slog.Println(slog.DATA, printStr) - //ret := fmt.Sprintf("└ PocScan, %s://%s%s, %s", req.Url.Scheme, req.Url.Host, req.Url.Path, p.Name) - //ret1 := strings.Split(ret, ",") - //color.StrRandomColor(ret1) + m := make(map[string]string) + sourceMap := misc.CloneMap(m) + if cw := app.Setting.OutputCSV; cw != nil { + sourceMap["URL"] = req.Url.Scheme + sourceMap["Keyword"] = "PocSuccess" + sourceMap["POC"] = req.Url.Host + "," + req.Url.Path + "," + p.Name + delete(sourceMap, "Header") + delete(sourceMap, "Cert") + delete(sourceMap, "Response") + delete(sourceMap, "Body") + sourceMap["Digest"] = strconv.Quote(sourceMap["Digest"]) + for key, value := range sourceMap { + sourceMap[key] = chinese.ToUTF8(value) + } + cw.Push(sourceMap) + } } else { red := colorR.BgRed.Render format := "%-30v %-35v %s %v" printStr := fmt.Sprintf(format, req.Url.Scheme, red("PocSuccess"), color.StrRandomColor(req.Url.Host+","+req.Url.Path+","+p.Name+","), tmpMap) slog.Println(slog.DATA, printStr) - //ret := fmt.Sprintf("└ PocScan, %s://%s%s, %s, %v", req.Url.Scheme, req.Url.Host, req.Url.Path, p.Name, tmpMap) - //ret1 := strings.Split(ret, ",") - //color.StrRandomColor(ret1) + m := make(map[string]string) + sourceMap := misc.CloneMap(m) + if cw := app.Setting.OutputCSV; cw != nil { + sourceMap["URL"] = req.Url.Scheme + sourceMap["Keyword"] = "PocSuccess" + sourceMap["POC"] = req.Url.Host + "," + req.Url.Path + "," + p.Name + delete(sourceMap, "Header") + delete(sourceMap, "Cert") + delete(sourceMap, "Response") + delete(sourceMap, "Body") + sourceMap["Digest"] = strconv.Quote(sourceMap["Digest"]) + for key, value := range sourceMap { + sourceMap[key] = chinese.ToUTF8(value) + } + cw.Push(sourceMap) + } } continue } @@ -385,9 +428,22 @@ func clusterpoc(oReq *http.Request, p *Poc, variableMap map[string]interface{}, format := "%-30v %-35v %s %v" printStr := fmt.Sprintf(format, req.Url.Scheme, red("PocSuccess"), color.StrRandomColor(req.Url.Host+","+req.Url.Path+","+p.Name+","), tmpMap) slog.Println(slog.DATA, printStr) - //ret := fmt.Sprintf("└ PocScan, %s://%s%s, %s, %v", req.Url.Scheme, req.Url.Host, req.Url.Path, p.Name, strMap) - //ret1 := strings.Split(ret, ",") - //color.StrRandomColor(ret1) + m := make(map[string]string) + sourceMap := misc.CloneMap(m) + if cw := app.Setting.OutputCSV; cw != nil { + sourceMap["URL"] = req.Url.Scheme + sourceMap["Keyword"] = "PocSuccess" + sourceMap["POC"] = req.Url.Host + "," + req.Url.Path + "," + p.Name + delete(sourceMap, "Header") + delete(sourceMap, "Cert") + delete(sourceMap, "Response") + delete(sourceMap, "Body") + sourceMap["Digest"] = strconv.Quote(sourceMap["Digest"]) + for key, value := range sourceMap { + sourceMap[key] = chinese.ToUTF8(value) + } + cw.Push(sourceMap) + } //防止后续继续打印poc成功信息 return false, nil } diff --git a/core/pocScan/ms17010.go b/core/pocScan/ms17010.go index 506c5a6..1c0a2dc 100644 --- a/core/pocScan/ms17010.go +++ b/core/pocScan/ms17010.go @@ -3,6 +3,9 @@ package pocScan import ( "Qscan-G/app" "Qscan-G/core/pocScan/lib" + "Qscan-G/core/slog" + "Qscan-G/lib/color" + "Qscan-G/lib/misc" "crypto/aes" "crypto/cipher" "encoding/base64" @@ -10,6 +13,9 @@ import ( "encoding/hex" "errors" "fmt" + colorR "github.com/gookit/color" + "github.com/lcvvvv/stdio/chinese" + "strconv" "strings" "time" ) @@ -32,8 +38,8 @@ var key = "0123456789abcdef" func MS17010(info *app.HostInfo) error { err := MS17010Scan(info) if err != nil { - errlog := fmt.Sprintf("[-] Ms17010 %v %v", info.Host, err) - fmt.Println(errlog) + //errlog := fmt.Sprintf("[-] Ms17010 %v %v", info.Host, err) + //fmt.Println(errlog) } return err } @@ -133,8 +139,23 @@ func MS17010Scan(info *app.HostInfo) error { //fmt.Printf("%s\tMS17-010\t(%s)\n", ip, os) //if runtime.GOOS=="windows" {fmt.Printf("%s\tMS17-010\t(%s)\n", ip, os) //} else{fmt.Printf("\033[33m%s\tMS17-010\t(%s)\033[0m\n", ip, os)} - result := fmt.Sprintf("[+] MS17-010 %s\t(%s)", ip, os) - fmt.Println(result) + printStr := fmt.Sprintf("%-30v %-35v %s", ip+":445", colorR.BgRed.Render("MS17010Success"), color.StrRandomColor(os)) + slog.Println(slog.DATA, printStr) + m := make(map[string]string) + sourceMap := misc.CloneMap(m) + if cw := app.Setting.OutputCSV; cw != nil { + sourceMap["URL"] = ip + ":445" + sourceMap["Keyword"] = "存在" + delete(sourceMap, "Header") + delete(sourceMap, "Cert") + delete(sourceMap, "Response") + delete(sourceMap, "Body") + sourceMap["Digest"] = strconv.Quote(sourceMap["Digest"]) + for key, value := range sourceMap { + sourceMap[key] = chinese.ToUTF8(value) + } + cw.Push(sourceMap) + } defer func() { //if common.SC != "" { // MS17010EXP(info)