Add recon form fingerprint library and SSRF canary mode.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Score crawl inputs by SSRF-prone field names and register ping-back canaries for operator paste confirmation.
This commit is contained in:
@@ -315,3 +315,19 @@ func TestCloudMetadataProfileSuggestsSSM(t *testing.T) {
|
||||
t.Fatal()
|
||||
}
|
||||
func containsInt(a []int,w int) bool { for _,n:=range a { if n==w {return true} }; return false }
|
||||
|
||||
|
||||
func TestScoreFormFieldFingerprintKeywords(t *testing.T) {
|
||||
score, matches := ScoreFormFieldFingerprint("callback_url", "", "")
|
||||
if score < 14 || !containsStr(matches, "callback") { t.Fatalf("score=%d matches=%v", score, matches) }
|
||||
}
|
||||
|
||||
func TestExtractFormFieldFingerprintsExactNameID(t *testing.T) {
|
||||
fps := ExtractFormFieldFingerprints("http://lab/", `<input name="avatar_url" id="userAvatar">`)
|
||||
if len(fps) == 0 || fps[0].Name != "avatar_url" || fps[0].ID != "userAvatar" { t.Fatalf("%+v", fps) }
|
||||
}
|
||||
|
||||
func TestBuildSSRfCanaryURLForcesHTTPS(t *testing.T) {
|
||||
u := BuildSSRfCanaryURL("http://public.example.com", "abc-123")
|
||||
if !strings.HasPrefix(u, "https://") || !strings.Contains(u, "/recon/ping/abc-123") { t.Fatalf("url=%q", u) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user