detect cloudflare human check

This commit is contained in:
Jeff Carr 2025-08-22 01:44:16 -05:00
parent 473cf6f9ad
commit 0539e2feee
1 changed files with 12 additions and 6 deletions

View File

@ -5,6 +5,7 @@ package forgepb
import ( import (
"errors" "errors"
"strings"
"time" "time"
"go.wit.com/log" "go.wit.com/log"
@ -62,12 +63,17 @@ func (f *Forge) submitPatchset(pset *Patchset) error {
newpb := NewPatches() newpb := NewPatches()
if err := newpb.Unmarshal(body); err != nil { if err := newpb.Unmarshal(body); err != nil {
log.Infof("forged DID NOT SEND BACK PROTOBUF len(body)=%d %s (TODO: look for failure on cloudflare 'is human' check here)\n", len(body), body[0:100]) cfcheck := string(body[0:100])
log.Infof("TODO: try to identify data here len(body)=%d body[0:40]=%s\n", len(body), body[0:40]) if strings.Contains(cfcheck, "<title>Just a moment...</title>") {
log.Info("BODY START:", body[0:10], string(body[0:10])) return log.Errorf("Cloudflare throttled this attempt to submit. TODO: fix this")
log.Info(string(body)) } else {
if err := newpb.UnmarshalTEXT(body[2:]); err == nil { log.Infof("forged DID NOT SEND BACK PROTOBUF len(body)=%d %s (TODO: look for failure on cloudflare 'is human' check here)\n", len(body), body[0:100])
log.Info("wow, that did work. newpb.Len() =", newpb.Len()) // log.Infof("TODO: try to identify data here len(body)=%d body[0:40]=%s\n", len(body), body[0:40])
// log.Info("BODY START:", body[0:10], string(body[0:10]))
// log.Info(string(body))
// if err := newpb.UnmarshalTEXT(body[2:]); err == nil {
// log.Info("wow, that did work. newpb.Len() =", newpb.Len())
// }
} }
return err return err
} }