Skip to content

Instantly share code, notes, and snippets.

@cloakd
Created February 16, 2024 10:11
Show Gist options
  • Save cloakd/a2b92ee797483e8697402dc5656660d4 to your computer and use it in GitHub Desktop.
Save cloakd/a2b92ee797483e8697402dc5656660d4 to your computer and use it in GitHub Desktop.
RollBar_TrackSpam
package main
import (
"bytes"
"fmt"
"github.com/google/uuid"
"log"
"math/rand"
"net/http"
"time"
)
func main() {
c := &http.Client{Timeout: 2 * time.Second}
uri := ""
for {
time.Sleep(time.Duration(rand.Intn(1)) * time.Second)
send(c, uri)
}
}
func send(c *http.Client, uri string) {
req, _ := http.NewRequest("POST", uri, bytes.NewBuffer([]byte(payload())))
req.Header.Set("authorization", "Basic {GRAB_KEY}")
resp, err := c.Do(req)
if err != nil {
log.Fatal(err)
}
if resp.StatusCode != 200 {
log.Fatal(resp.Status)
}
log.Println("OK")
}
func payload() string {
originalTimestamp := time.Now().Format(time.RFC3339)
sentAt := time.Now().Format(time.RFC3339)
sessionId := 1708021431085 + rand.Intn(100000000000)
phantomExtId := generateString(32)
userId := generateAlphaString(64)
messageId := uuid.New().String()
anonymousId := uuid.New().String()
return fmt.Sprintf(`{
"channel": "web",
"context": {
"app": {
"build": "1.0.0",
"name": "RudderLabs JavaScript SDK",
"namespace": "com.rudderlabs.javascript",
"version": "2.21.0"
},
"traits": {
"appVersion": "24.1.0",
"displayLanguage": "en-GB",
"hasSolanaAddress": true,
"hasEthereumAddress": true,
"hasBitcoinAddress": true,
"accountType": "privateKey",
"isReadOnly": false,
"enabledChains": "Solana"
},
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "2.21.0"
},
"os": {
"name": "",
"version": ""
},
"screen": {
"density": 0,
"width": 0,
"height": 0,
"innerWidth": 0,
"innerHeight": 0
},
"sessionId": %v,
"campaign": {},
"page": {
"path": "/popup.html",
"referrer": "$direct",
"referring_domain": "",
"search": "",
"title": "Phantom Wallet",
"url": "chrome-extension://%s/popup.html",
"tab_url": "chrome-extension://%s/popup.html#",
"initial_referrer": "$direct",
"initial_referring_domain": ""
}
},
"type": "track",
"messageId": "%s",
"originalTimestamp": "%s",
"anonymousId": "%s",
"userId": "%s",
"event": "onExploreSearchItemClickedByUser",
"properties": {
"explore": {
"itemDetails": {
"position": 1,
"title": "FluxBeam",
"id": "dapp_3058cff9-aaec-49d4-a645-e697a75f543c"
}
}
},
"integrations": {
"All": true
},
"sentAt": "%s"
}`,
sessionId,
phantomExtId,
phantomExtId,
messageId,
originalTimestamp,
anonymousId,
userId,
sentAt,
)
}
func generateString(length int) string {
const letters = "abcdefghijklmnopqrstuvwxyz"
b := make([]byte, length)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}
func generateAlphaString(length int) string {
const letters = "abcdefghijklmnopqrstuvwxyz0123456789"
b := make([]byte, length)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment