Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
解决乱码和运行不稳定问题
  • Loading branch information
aeverj committed Aug 24, 2023
1 parent c09dc73 commit 6cf5821
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions pkg/runner/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func Run() {
// Check if the folder named "result" exist
os.Mkdir("result", 0766)
nfs, err := os.OpenFile(options.OutputFile, os.O_RDWR|os.O_CREATE, 0666)
// BOM header, solve excel garbled problem
nfs.WriteString("\xEF\xBB\xBF")
if err != nil {
log.Fatalf("can not create file, err is %+v", err)
}
Expand Down
17 changes: 7 additions & 10 deletions pkg/wappalyzer/getFinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func hasapp(cdata *weblive.CollyData, wapp *wappalyzer) []string {

}
}
if app.Cookies != nil {
if app.Cookies != nil && len(cdata.Cookies) > 0 {
patterns := parsePatterns(app.Cookies)
for cookieName, _ := range patterns {
cookieNameLowerCase := strings.ToLower(cookieName)
Expand All @@ -176,7 +176,7 @@ func hasapp(cdata *weblive.CollyData, wapp *wappalyzer) []string {
}
}
}
if app.Scripts != nil {
if app.Scripts != nil && cdata.Scripts != nil {
patterns := parsePatterns(app.Scripts)
for _, v := range patterns {
for _, pattrn := range v {
Expand All @@ -190,16 +190,14 @@ func hasapp(cdata *weblive.CollyData, wapp *wappalyzer) []string {
}
}
}
if app.Meta != nil {
if app.Meta != nil && len(cdata.Meta) > 0 {
patterns := parsePatterns(app.Meta)
for metaName, v := range patterns {
for metaName, _ := range patterns {
metaNameLowerCase := strings.ToLower(metaName)
for _, patten := range v {
if value, ok := cdata.Meta[metaNameLowerCase]; ok && patten.regex.Match([]byte(value)) {
result = appendResult(app, result)
}
_, ok := cdata.Meta[metaNameLowerCase]
if ok {
result = appendResult(app, result)
}

}
}
}
Expand Down Expand Up @@ -234,7 +232,6 @@ func Init() *wappalyzer {
}

func (wapp *wappalyzer) Analyze(cData *weblive.CollyData) (result *weblive.Website) {

website := &weblive.Website{}
website.Url = cData.Url
website.StatusCode = cData.StatusCode
Expand Down

0 comments on commit 6cf5821

Please sign in to comment.