Skip to content

Commit

Permalink
Merge pull request #21 from xiaomakuaiz/feat-speedup
Browse files Browse the repository at this point in the history
Feat speedup
  • Loading branch information
phxa1 authored May 31, 2024
2 parents 23e8b59 + 54b69c2 commit 19efb29
Show file tree
Hide file tree
Showing 19 changed files with 1,876 additions and 218 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '>=1.17.0'
go-version: '1.21.4'

- name: install dependencies
run: sudo apt-get install libgl1-mesa-dev xorg-dev

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.52

args: --timeout 5m

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release-gui-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: release blasehttp macos gui

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
macos-gui-releaser:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'

- name: Set up fyne
run: go install fyne.io/fyne/v2/cmd/fyne@latest

- name: build macos
run: |
GOARCH=amd64 fyne package --appID com.chaitin.blazehttp --name blazehttp_amd64 --src ./gui/ --os darwin -icon ../Icon.png
GOARCH=arm64 fyne package --appID com.chaitin.blazehttp --name blazehttp_arm64 --src ./gui/ --os darwin -icon ../Icon.png
- name: Normalise version tag
id: normalise_version
shell: bash
run: |
version=$(echo ${{ github.ref_name }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Normalise artifact name
id: normalise_artifact_name
shell: bash
run: |
tar -cvzf blazehttp_${{ steps.normalise_version.outputs.version }}_darwin_amd64_gui.tar.gz blazehttp_amd64.app
tar -cvzf blazehttp_${{ steps.normalise_version.outputs.version }}_darwin_arm64_gui.tar.gz blazehttp_arm64.app
- name: release gui
uses: softprops/action-gh-release@v1
with:
if: startsWith(github.ref, 'refs/tags/')
files: |
./blazehttp_${{ steps.normalise_version.outputs.version }}_darwin_amd64_gui.tar.gz
./blazehttp_${{ steps.normalise_version.outputs.version }}_darwin_arm64_gui.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/release-gui-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: release blasehttp windows gui

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
windows-gui-releaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'

- name: Set up fyne-cross
run: go install github.com/fyne-io/fyne-cross@latest

- name: build windows
run: fyne-cross windows -app-id cn.chaitin.blazehttp -arch="amd64,arm64" ./gui

- name: Normalise version tag
id: normalise_version
shell: bash
run: |
version=$(echo ${{ github.ref_name }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Normalise artifact name
id: normalise_artifact_name
shell: bash
run: |
mv ./fyne-cross/dist/windows-amd64/blazehttp.exe.zip ./fyne-cross/dist/windows-amd64/blazehttp_${{ steps.normalise_version.outputs.version }}_windows_amd64_gui.zip
mv ./fyne-cross/dist/windows-arm64/blazehttp.exe.zip ./fyne-cross/dist/windows-arm64/blazehttp_${{ steps.normalise_version.outputs.version }}_windows_arm64_gui.zip
- name: release gui
uses: softprops/action-gh-release@v1
with:
if: startsWith(github.ref, 'refs/tags/')
files: |
./fyne-cross/dist/windows-amd64/blazehttp_${{ steps.normalise_version.outputs.version }}_windows_amd64_gui.zip
./fyne-cross/dist/windows-arm64/blazehttp_${{ steps.normalise_version.outputs.version }}_windows_arm64_gui.zip
token: ${{ secrets.GITHUB_TOKEN }}
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.22'

- name: install dependencies
run: sudo apt-get install libgl1-mesa-dev xorg-dev

- name: Run tests
run: go test ./...
Expand All @@ -33,4 +36,4 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CGO_ENABLED: 0
CGO_ENABLED: 0
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ go.work
dist/
output*/
.builds/
build/
build/
fyne-cross
Binary file added Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,63 @@
<h1 align="center">最好用的 WAF 测试工具</h1>
<p align="center">
<img src="./images/blazehttp_cmd.gif">
<img src="./images/gui3.png">
</p>

## 功能特性

* 样本多,总样本**33669**条,白样本33094条,黑样本**576**
* 零配置,一个 URL 即可测试 WAF 的各类指标,无需额外配置样本
* 指标简单,通过检出率,误报率,准确率来衡量 WAF 的综合能力

## 测试指标

| 指标 | 描述 | 统计方法 |
| ---- | ---- | ---- |
| 检出率 | 用来反应 WAF 检测能力的全面性,没有检出即为 ”漏报“。 | 攻击样本拦截数量 |
| 误报率 | 用来反应对正常流量的干扰,不靠谱的结果即为 ”误报“。 | 正常样本拦截数量 |
| 准确率 | 准确率是检出率和误报率的综合指标,避免漏报和误报顾此失彼。 | |
| 检测耗时 | 用来反应 WAF 性能,耗时越大则性能越差。 | |

## 🚛 下载代码
## 安装

### 命令行

提供 windows/linux/MacOS 平台下 amd64 和 arm64 的命令行工具,可[免费下载](https://github.com/chaitin/blazehttp/releases)

下载相应的版本(这里以linux amd64为例)后执行

```bash
# 赋予可执行权限
chmod +x blazehttp_1.0.0_linux_amd64
# 测试对应的网站
./blazehttp_1.0.0_linux_amd64 -t https://demo.waf-ce.chaitin.cn
```

### GUI

提供 windows 和 MacOS 的安装包,可[免费下载](https://github.com/chaitin/blazehttp/releases)

> 如果 MacOS 双击打开报错**不受信任**或者**移到垃圾箱**,执行下面命令后再启动即可:
> ``` bash
> sudo xattr -d com.apple.quarantine blazehttp_1.0.0_darwin_arm64.app
> ```
## 源码构建
### 🚛 下载代码
``` bash
git clone https://github.com/chaitin/blazehttp.git && cd blazehttp
```
## 🚀 一键运行
### 🚀 一键运行

``` bash
bash build.sh && ./build/blazehttp -t http://127.0.0.1:8008
```

## 🕹️ 靶机服务
### 🕹️ 靶机服务

``` bash
docker run -d -p 8080:80 --name hello_waf -d co0ontty/hello_waf:latest
Expand Down
Loading

0 comments on commit 19efb29

Please sign in to comment.