Skip to content

Commit

Permalink
[+]v1.72发布,感谢nali~~~
Browse files Browse the repository at this point in the history
  • Loading branch information
lcvvvv committed Apr 24, 2022
1 parent 49002c1 commit a87a1c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions core/cdn/cdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@ package cdn
import (
"kscan/core/slog"
"kscan/lib/qqwry"
"os"
"path/filepath"
"strings"
)

var database *qqwry.QQwry

const filename = "./qqwry.dat"
var filename = "qqwry.dat"
var path = getRealPath()

func Init() {
d, err := qqwry.NewQQwry(filename)
d, err := qqwry.NewQQwry(GetPath())
if err != nil {
slog.Println(slog.WARN, "qqwry init err:", err)
return
}
database = d
}

func GetPath() string {
return path + "/" + filename
}

func DownloadQQWry() error {
return qqwry.Download(filename)
return qqwry.Download(GetPath())
}

func FindCDN(query string) (bool, string, error) {
Expand All @@ -38,3 +45,9 @@ func Find(query string) (string, error) {
}
return result.String(), err
}

func getRealPath() string {
dir, _ := os.Executable()
path := filepath.Dir(dir)
return path
}
2 changes: 1 addition & 1 deletion kscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func InitKscan() {
gonmap.InitAppBannerDiscernConfig(app.Setting.Host, app.Setting.Path, app.Setting.Proxy, app.Setting.Timeout)
//CDN检测初始化
if app.Setting.CloseCDN == false {
if misc.FileIsExist("./qqwry.dat") == false {
if misc.FileIsExist(cdn.GetPath()) == false {
slog.Printf(slog.WARN, "未检测到qqwry.dat,将关闭CDN检测功能,如需开启,请执行kscan --download-qqwry下载该文件")
app.Setting.CloseCDN = true
} else {
Expand Down

0 comments on commit a87a1c8

Please sign in to comment.