Skip to content

Commit

Permalink
Merge pull request #68 from derekperkins/master
Browse files Browse the repository at this point in the history
feat: only find scripts once per url
  • Loading branch information
rverton committed Mar 23, 2023
2 parents 6a48cd0 + eaf1dc2 commit 644151f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webanalyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ func (wa *WebAnalyzer) process(job *Job, appDefs *AppsDefinition) ([]Match, []st
}
}

scripts := doc.Find("script")

for appname, app := range appDefs.Apps {
// TODO: Reduce complexity in this for-loop by functionalising out
// the sub-loops and checks.
Expand Down Expand Up @@ -302,7 +304,7 @@ func (wa *WebAnalyzer) process(job *Job, appDefs *AppsDefinition) ([]Match, []st
}

// check script tags
doc.Find("script").Each(func(i int, s *goquery.Selection) {
scripts.Each(func(i int, s *goquery.Selection) {
if script, exists := s.Attr("src"); exists {
if m, v := findMatches(script, app.ScriptRegex); len(m) > 0 {
findings.Matches = append(findings.Matches, m...)
Expand Down

0 comments on commit 644151f

Please sign in to comment.