diff --git a/tests/evilpot/README.md b/tests/evilpot/README.md index 55b0d364f..1c5f96d3e 100644 --- a/tests/evilpot/README.md +++ b/tests/evilpot/README.md @@ -11,6 +11,7 @@ Evil Pot - 8887: evil server 让扫描器产生误报 困难模式 - 普通模式的基础上对所有请求元素进行拆解计算sha1/md5/base64 + - /etc/passwd和win.ini的内容 - 8888: evil server 让扫描器产生误报 普通模式 - 常见状态码 - 常见报错信息 diff --git a/tests/evilpot/build.ps1 b/tests/evilpot/build.ps1 new file mode 100644 index 000000000..fa0214d40 --- /dev/null +++ b/tests/evilpot/build.ps1 @@ -0,0 +1,26 @@ +$targets = @( + @{GOOS="darwin"; GOARCH="amd64"; Output="evilpot_darwin_amd64"}, + @{GOOS="darwin"; GOARCH="arm64"; Output="evilpot_darwin_arm64"}, + @{GOOS="linux"; GOARCH="386"; Output="evilpot_linux_386"}, + @{GOOS="linux"; GOARCH="amd64"; Output="evilpot_linux_amd64"}, + @{GOOS="linux"; GOARCH="arm64"; Output="evilpot_linux_arm64"}, + @{GOOS="windows"; GOARCH="amd64"; Output="evilpot_windows_amd64.exe"} +) + +foreach ($target in $targets) { + $env:GOOS = $target.GOOS + $env:GOARCH = $target.GOARCH + $output = $target.Output + + Write-Host "Building for $($env:GOOS)/$($env:GOARCH)..." + go build -o $output . + + if ($LASTEXITCODE -eq 0) { + Write-Host "Successfully built $output" + } else { + Write-Host "Failed to build $output" + } +} + +Remove-Item env:GOOS +Remove-Item env:GOARCH diff --git a/tests/evilpot/build.sh b/tests/evilpot/build.sh new file mode 100644 index 000000000..9bb3ff0ae --- /dev/null +++ b/tests/evilpot/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +targets=( + "darwin amd64 evilpot_darwin_amd64" + "darwin arm64 evilpot_darwin_arm64" + "linux 386 evilpot_linux_386" + "linux amd64 evilpot_linux_amd64" + "linux arm64 evilpot_linux_arm64" + "windows amd64 evilpot_windows_amd64.exe" +) + +for target in "${targets[@]}"; do + IFS=' ' read -r -a params <<< "$target" + GOOS=${params[0]} + GOARCH=${params[1]} + OUTPUT=${params[2]} + + echo "Building for $GOOS/$GOARCH..." + GOOS=$GOOS GOARCH=$GOARCH go build -o $OUTPUT + + if [ $? -eq 0 ]; then + echo "Successfully built $OUTPUT" + else + echo "Failed to build $OUTPUT" + fi +done diff --git a/tests/evilpot/evil/evil.go b/tests/evilpot/evil/evil.go index ce1024cdc..f991432c8 100644 --- a/tests/evilpot/evil/evil.go +++ b/tests/evilpot/evil/evil.go @@ -58,6 +58,18 @@ func NewEvilServeMux(hard bool) *http.ServeMux { }) } + if hard { + buf.WriteString("\nroot:x:0:0:root:/root:/bin/bash\n") + buf.WriteString(` + ; for 16-bit app support + [fonts] + [extensions] + [mci extensions] + [files] + [Mail] + MAPI=1`) + } + // 处理 sleep 和 WAITFOR DELAY sleepMatches := sleepRe.FindAllStringSubmatch(unescape, -1) for _, match := range sleepMatches { @@ -218,6 +230,5 @@ func init() { for i := 0; i < 1000; i++ { GenEvilContent(buf, []byte(strconv.Itoa(i))) } - buf.WriteString("\nroot:x:0:0:root:/root:/bin/bash\n") CommonEvilResponse = buf.Bytes() } diff --git a/tests/evilpot/main.go b/tests/evilpot/main.go index 62222e115..ca8dcbffd 100644 --- a/tests/evilpot/main.go +++ b/tests/evilpot/main.go @@ -12,8 +12,29 @@ func main() { evilAddr := flag.String("evil", ":8888", "evil server 监听地址") echoAddr := flag.String("echo", ":8889", "echo server 监听地址") flag.Parse() - go func() { log.Fatalln(evil.ServeEvilServer(*evilHardAddr, true)) }() - go func() { log.Fatalln(evil.ServeEvilServer(*evilAddr, false)) }() - go func() { log.Fatalln(evil.ServeEchoServer(*echoAddr)) }() + + log.Println("Starting servers...") + + go func() { + log.Printf("Starting evil server in hard mode on %s...\n", *evilHardAddr) + if err := evil.ServeEvilServer(*evilHardAddr, true); err != nil { + log.Fatalf("Evil server hard mode failed: %v\n", err) + } + }() + + go func() { + log.Printf("Starting evil server on %s...\n", *evilAddr) + if err := evil.ServeEvilServer(*evilAddr, false); err != nil { + log.Fatalf("Evil server failed: %v\n", err) + } + }() + + go func() { + log.Printf("Starting echo server on %s...\n", *echoAddr) + if err := evil.ServeEchoServer(*echoAddr); err != nil { + log.Fatalf("Echo server failed: %v\n", err) + } + }() + select {} }