Penulis Topik: [Golang] trik bikin "random" http.Header  (Dibaca 346 kali)

Offline descrates

  • Pro500
  • ******
  • Tulisan: 548
  • Reputation: 5072
    • Lihat Profil
[Golang] trik bikin "random" http.Header
« pada: Pebruari 14, 2017, 12:22:05 PM »
Golang memang sangat powerfull buat bikin tool web service
dan juga buat stressing/benchmark (termasuk DDoS)

berikut ini potongan kodenya, simple tapi powerfull


package main

import (
   "math/rand"
   "net"
   "net/http"
   "os"
   "os/signal"
   "strconv"
   "crypto/tls"
   "flag"
   "fmt"
   "time"
   "runtime"
// dst, dll, dsb

var (
   headersWordlists []string = []string{
   "#OpIsrael",
   "Pokemon Go&lang=all&stop_spam=0&stop_porn=0",
   "US Election",
   "MU",
   "WheresHillary?src=tren",
   "La Liga",
   "Bundesliga",
   }
   headersReferers []string = []string{
   "http://www.google.com/?q=",
   "http://www.usatoday.com/search/results?q=",
   }
   headersUseragents []string = []string{
   "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.1 (KHTML, like Gecko) Chrome/4.0.219.6 Safari/532.1",
   "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)",
   "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729)",
   "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Win64; x64; Trident/4.0)",
   "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; .NET CLR 2.0.50727; InfoPath.2)",
   }

)

func MyHeader(host string) *http.Header {
   hdr := http.Header{}

   hdr.Add("User-Agent", headersUseragents[rand.Intn(len(headersUseragents))])
   hdr.Add("Referer", headersReferers[rand.Intn(len(headersReferers))]+headersWordlists[rand.Intn(len(headersWordlists))])
   hdr.Add("Keep-Alive", strconv.Itoa(rand.Intn(800)+100))
   hdr.Add("Host", host)

   return &hdr
}
TASKKILL /F /IM SMĪ”RTP.exe /T

Win7 32bit [kernel patch] --- 2x2,8GHz Intel --- 8GB RAM DDR3 --- 512MB 9600M GT NVidia --- Iron 15 beta --- Opera Mini Proxies

other OS: Lucid Puppy, XP SP2 [custom], XP SP3, Win7 64bit, Tails