Skip to content

Instantly share code, notes, and snippets.

@USA-RedDragon
Created February 21, 2023 18:40
Show Gist options
  • Save USA-RedDragon/c3d78cc62bc443be144b0f9282b4e38e to your computer and use it in GitHub Desktop.
Save USA-RedDragon/c3d78cc62bc443be144b0f9282b4e38e to your computer and use it in GitHub Desktop.
Fuzz test to f*** over some phishing scammers
package main_test
import (
"context"
"net/http"
"net/url"
"strings"
"testing"
"time"
)
func FuzzF(f *testing.F) {
const updateTimeout = 10 * time.Second
f.Fuzz(func(t *testing.T, username string, password string, phone string, userAgent string) {
t.Parallel()
formData := url.Values{
"username": {username},
"password": {password},
"phn": {phone},
"button": {""},
}
ctx, cancel := context.WithTimeout(context.Background(), updateTimeout)
defer cancel()
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://capitexglobal.com.ng/tinkerfcu/Backend/userlog.php", strings.NewReader(formData.Encode()))
if err != nil {
t.Error(err)
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
// Strip any control bytes from the user agent
userAgent = strings.Map(func(r rune) rune {
if r < 32 || r > 126 {
return -1
}
return r
}, userAgent)
req.Header.Add("User-Agent", userAgent)
resp, err := http.DefaultClient.Do(req)
if err != nil {
t.Error(err)
}
if resp.StatusCode != http.StatusOK {
t.Error(resp.StatusCode)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment