Skip to content

Commit 2dc5abb

Browse files
committed
very simple bad filter
1 parent b03c530 commit 2dc5abb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

cmd/badges/main.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ func main() {
5959
return
6060
}
6161

62+
if filterBad(loc) {
63+
log.Error().Str(uniqueCode, "bfee4bd8").Str("loc", loc.String()).Msg("filter bad")
64+
return
65+
}
66+
6267
appendLocationLog(loc.String())
6368

6469
res, err := process(1, loc)
@@ -99,6 +104,23 @@ func main() {
99104
}
100105
}
101106

107+
func filterBad(loc location) bool {
108+
l := loc.String()
109+
bad := []string{"wp-content.com", "wp-admin.com", ".well-known", "wp-includes.com", ".php"}
110+
count := 0
111+
for _, b := range bad {
112+
if strings.Contains(l, b) {
113+
count++
114+
}
115+
}
116+
117+
if count >= 2 {
118+
return true
119+
}
120+
121+
return false
122+
}
123+
102124
func appendLocationLog(log string) {
103125
locationLogMutex.Lock()
104126
defer locationLogMutex.Unlock()

0 commit comments

Comments
 (0)