Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating detector logic for zenscrape #2316

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions pkg/detectors/zenscrape/zenscrape.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package zenscrape

import (
"context"
"io"
"net/http"
"regexp"
"strings"
Expand Down Expand Up @@ -56,20 +55,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
res, err := client.Do(req)
if err == nil {
defer res.Body.Close()
bodyBytes, err := io.ReadAll(res.Body)
if err != nil {
continue
}
body := string(bodyBytes)

if !strings.Contains(body, "Not enough requests.") {
if (res.StatusCode >= 200 && res.StatusCode < 300) || res.StatusCode == 429 {
s1.Verified = true
} else {
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}

}
}

Expand Down
Loading