Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Aur0ra-m committed Mar 9, 2023
1 parent c5d0cb2 commit 25fdba4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Example user template template
### Example user template

# IntelliJ project files
.idea
*.iml
out
gen
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ APIKiller-企业API安全保护神</h2>
- 多功能扫描模块
- 越权检测模块,高效精准,支持多情景检测
- 40x bypass 模块
- csrf 检测模块
- CSRF检测模块
- open-redirect 检测模块
- Dos检测模块【谨慎配置,避免出现大量脏数据】
- DoS检测模块【谨慎配置,避免出现大量脏数据】
- 【欢迎大家积极提PR】
- 多功能Filter处理,默认自带多个filter
- 针对性扫描,例如只对 baidu.com域名进行扫描
Expand Down
Empty file added hooks/.gitkeep
Empty file.
20 changes: 17 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,32 @@ func loadConfig(ctx context.Context) context.Context {
}

func loadHooks(ctx context.Context) context.Context {
logger.Infoln("loading hooks")

// except windows os
if runtime.GOOS == "windows" {
logger.Errorln("not support windows operation system")
return ctx
}

logger.Infoln("loading hooks")

// ./hooks directory does not exist
_, err2 := os.Stat("./hooks")
if os.IsNotExist(err2) {
logger.Errorln("target directory does not exist")

// make directory
err := os.Mkdir("./hooks", os.ModePerm)
if err != nil {
panic(err)
}

return ctx
}

// list directory
entries, err := os.ReadDir("./hooks")
if err != nil {
logger.Errorln("loading hooks error: %v", err)
logger.Errorln(fmt.Sprintf("loading hooks error: %v", err))
panic(entries)
}

Expand Down

0 comments on commit 25fdba4

Please # to comment.