Skip to content

Commit

Permalink
[add] 添加evilpot的build脚本,修改难度
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcis-cy committed Jul 4, 2024
1 parent 01deed5 commit 64653ad
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/evilpot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Evil Pot

- 8887: evil server 让扫描器产生误报 困难模式
- 普通模式的基础上对所有请求元素进行拆解计算sha1/md5/base64
- /etc/passwd和win.ini的内容
- 8888: evil server 让扫描器产生误报 普通模式
- 常见状态码
- 常见报错信息
Expand Down
26 changes: 26 additions & 0 deletions tests/evilpot/build.ps1
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions tests/evilpot/build.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 12 additions & 1 deletion tests/evilpot/evil/evil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
}
27 changes: 24 additions & 3 deletions tests/evilpot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}

0 comments on commit 64653ad

Please sign in to comment.