diff options
| author | Xe Iaso <me@xeiaso.net> | 2025-04-02 20:00:07 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-02 20:00:07 -0400 |
| commit | b3848e7a4171642e5813a372675b17df45befa46 (patch) | |
| tree | a7a0efc6263c4af705a2f36556374d66387856ee /lib/anubis.go | |
| parent | f9e2a18cf86f4b33766b483694926670a2134ec8 (diff) | |
| parent | 266d8c0cc25f9d93ea7da87eb199bc87e41c653e (diff) | |
| download | anubis-Xe/imessage-scraper-bypass.tar.xz anubis-Xe/imessage-scraper-bypass.zip | |
Merge branch 'main' into Xe/imessage-scraper-bypassXe/imessage-scraper-bypass
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'lib/anubis.go')
| -rw-r--r-- | lib/anubis.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/anubis.go b/lib/anubis.go index 1b2ebfc..732d2c3 100644 --- a/lib/anubis.go +++ b/lib/anubis.go @@ -145,14 +145,13 @@ func New(opts Options) (*Server, error) { } type Server struct { - mux *http.ServeMux - next http.Handler - priv ed25519.PrivateKey - pub ed25519.PublicKey - policy *policy.ParsedConfig - opts Options - DNSBLCache *decaymap.Impl[string, dnsbl.DroneBLResponse] - ChallengeDifficulty int + mux *http.ServeMux + next http.Handler + priv ed25519.PrivateKey + pub ed25519.PublicKey + policy *policy.ParsedConfig + opts Options + DNSBLCache *decaymap.Impl[string, dnsbl.DroneBLResponse] } func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { @@ -441,9 +440,9 @@ func (s *Server) PassChallenge(w http.ResponseWriter, r *http.Request) { } // compare the leading zeroes - if !strings.HasPrefix(response, strings.Repeat("0", s.ChallengeDifficulty)) { + if !strings.HasPrefix(response, strings.Repeat("0", rule.Challenge.Difficulty)) { s.ClearCookie(w) - lg.Debug("difficulty check failed", "response", response, "difficulty", s.ChallengeDifficulty) + lg.Debug("difficulty check failed", "response", response, "difficulty", rule.Challenge.Difficulty) templ.Handler(web.Base("Oh noes!", web.ErrorPage("invalid response")), templ.WithStatus(http.StatusForbidden)).ServeHTTP(w, r) failedValidations.Inc() return |
