Skip to content

Commit

Permalink
RE ++++
Browse files Browse the repository at this point in the history
  • Loading branch information
qi4L committed Mar 29, 2024
1 parent 4f4e7e0 commit 234b482
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 35 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@

[[English Readme]][url-docen]

作者很久没更新了,就自己改了下,加入漏洞检测,效果如下:

```
-t "127.0.0.1" --exploit --hydra
```

![img效果图.png](assets/img.png)
就加了个漏洞检测。

## 1 简介

Expand Down Expand Up @@ -138,5 +132,9 @@ fofa options:

![WechatIMG996](assets/CDN识别演示.jpg)

### 6.6 漏洞探测

![img_1.png](assets/img_1.png)

[url-doczh]: README
[url-docen]: README_ENG.md
Binary file removed assets/img.png
Binary file not shown.
Binary file added assets/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 27 additions & 16 deletions core/pocScan/lib/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package lib
import (
"KscanPro/app"
"KscanPro/core/pocScan/info"
"KscanPro/core/slog"
"KscanPro/lib/color"
"crypto/md5"
"fmt"
"github.com/google/cel-go/cel"
colorR "github.com/gookit/color"
"math/rand"
"net/http"
"net/url"
Expand Down Expand Up @@ -34,10 +36,10 @@ func CheckMultiPoc(req *http.Request, pocs []*Poc, workers int) {
for task := range tasks {
isVul, _, name := executePoc(task.Req, task.Poc)
if isVul {
fmt.Print(" ")
ret := fmt.Sprintf("└ PocScan, %s, %s, %s", task.Req.URL, task.Poc.Name, name)
ret1 := strings.Split(ret, ",")
color.StrRandomColor(ret1)
red := colorR.BgRed.Render
format := "%-30v %-35v %s"
printStr := fmt.Sprintf(format, task.Req.URL, red("PocSuccess"), color.StrRandomColor(task.Poc.Name+","+name))
slog.Println(slog.DATA, printStr)
}
wg.Done()
}
Expand Down Expand Up @@ -359,24 +361,33 @@ func clusterpoc(oReq *http.Request, p *Poc, variableMap map[string]interface{},
if success {
if rule.Continue {
if p.Name == "poc-yaml-backup-file" || p.Name == "poc-yaml-sql-file" {
fmt.Print(" ")
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)
red := colorR.BgRed.Render
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)
} else {
fmt.Print(" ")
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)
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)
}
continue
}
strMap = append(strMap, tmpMap...)
if i == len(p.Rules)-1 {
fmt.Print(" ")
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)
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, strMap)
//ret1 := strings.Split(ret, ",")
//color.StrRandomColor(ret1)
//防止后续继续打印poc成功信息
return false, nil
}
Expand Down
4 changes: 1 addition & 3 deletions kscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ func Init() {
slog.SetLevel(slog.INFO)
}
//color包初始化
if os.Getenv("KSCAN_COLOR") == "TRUE" {
color.Enabled()
}
color.Enabled()
if app.Args.CloseColor == true {
color.Disabled()
}
Expand Down
18 changes: 9 additions & 9 deletions lib/color/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"runtime"
"strconv"
"strings"
"time"
)

var (
Expand Down Expand Up @@ -259,28 +258,29 @@ func StrMapRandomColor(m map[string]string, printKey bool, importantKey []string
return s[:len(s)-2]
}

func StrRandomColor(chars []string) {
rand.Seed(time.Now().UnixNano())
func StrRandomColor(chars string) string {
str1 := ""
useForegroundColor := false
for _, char := range chars {
parts := strings.Split(chars, ",")
for _, char := range parts {
char1 := char + ", "
if useForegroundColor {
fg := randomFgColor()
colorR.New(fg).Print(char1)
str1 += fg.Render(char1)
} else {
bg := randomBgColor()
colorR.New(bg).Print(char1)
str1 += bg.Render(char1)
}
useForegroundColor = !useForegroundColor
}
fmt.Println()
return str1
}

// 生成随机前景色
func randomFgColor() colorR.Color {
colors := []colorR.Color{
colorR.FgBlack, colorR.FgRed, colorR.FgGreen, colorR.FgYellow,
colorR.FgBlue, colorR.FgMagenta, colorR.FgCyan, colorR.FgWhite,
colorR.FgBlue, colorR.FgMagenta, colorR.FgCyan,
}
return colors[rand.Intn(len(colors))]
}
Expand All @@ -289,7 +289,7 @@ func randomFgColor() colorR.Color {
func randomBgColor() colorR.Color {
colors := []colorR.Color{
colorR.BgBlack, colorR.BgRed, colorR.BgGreen, colorR.BgYellow,
colorR.BgBlue, colorR.BgMagenta, colorR.BgCyan, colorR.BgWhite,
colorR.BgBlue, colorR.BgMagenta, colorR.BgCyan,
}
return colors[rand.Intn(len(colors))]
}
Expand Down

0 comments on commit 234b482

Please sign in to comment.