Skip to content

Commit

Permalink
switched to httpx in order to fix the cf issue (v3.18.3.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
LIL-JABA committed Aug 14, 2024
1 parent 329b20a commit 45060aa
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 95 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requests
colorama
keyboard
InquirerPy
aiohttp
httpx
cloudscraper
clear
requests[socks]
Expand Down
10 changes: 2 additions & 8 deletions src/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ def __init__(self, APtoken: str = "", session: str = "", isDebug=False) -> None:

async def main(self) -> None:
sys.load_assets()
useAP = not self.APtoken == ""
if useAP:
ap = antipublic.AntiPublic(self.APtoken, self.session)
if not ap.test():
print(
"Your AntiPublic token is invalid or the server is down. Please ask the dev for a new one (on our discord server)."
)
useAP = False
useAP = False
authenticate = auth.Auth(self.isDebug)
while True:
if self.isDebug:
Expand Down Expand Up @@ -235,6 +228,7 @@ async def main(
try:
self.threadam = int(
input(

f"input number of threads (min 1 max 5000) (proxies: {self.proxycount}) >>>"
)
)
Expand Down
115 changes: 44 additions & 71 deletions src/codeparts/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
from re import compile
import ssl
import traceback
import cloudscraper
from typing import Any
from datetime import datetime, timedelta
from random import randint

import sys
import asyncio
import requests
import aiohttp
from requests.adapters import HTTPAdapter
import httpx

from . import systems
from .data import Constants
from .systems import Account
from .authclient import AuthClient

syst = systems.system()

Expand Down Expand Up @@ -46,100 +43,76 @@ def __init__(self, isDebug: bool = False) -> None:
async def auth(self, logpass: str = None, username: str = None, password: str = None, proxy=None) -> Account:
account = Account()
try:
account.logpass = str(logpass)
session = requests.Session()
ac = AuthClient()
authsession = await ac.createSession()
scraper = cloudscraper.create_scraper()
account.logpass = logpass
sslcontext = httpx.create_ssl_context()
sslcontext.set_ciphers(Constants.CIPHERS)
sslcontext.set_ecdh_curve(Constants.ECDH_CURVE)
client = httpx.Client(verify=sslcontext, proxy=proxy["http"] if proxy is not None else None)
if username is None:
username = logpass.split(':')[0].strip()
password = logpass.split(':')[1].strip()

try:
# R1
headers = {
"Accept-Encoding": "gzip, deflate, br, zstd",
"User-Agent": "dsadasdasdsa",
"Cache-Control": "no-cache",
"Accept": "application/json",
"User-Agent": (
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X)"
" AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.1502.79 Mobile"
" Safari/537.36"
),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.9",
"Accept-Encoding": "gzip, deflate"
}
body = {
"acr_values": "",
"claims": "",
"client_id": "riot-client",
"code_challenge": "",
"code_challenge_method": "",
"nonce": "dsadasdasdsdsdsddsdsasdasd",
"nonce": "SYXugqaAL5z7U7iioaTW5Q",
"redirect_uri": "http://localhost/redirect",
"response_type": "token id_token",
"scope": "openid link ban lol_region account",
}
# client_cert = 'C:\\Users\\balls\\source\\repos\\valchecker\\certificate.crt'
# cient_key = 'C:\\Users\\balls\\source\\repos\\valchecker\\private.key'
# ssession = aiohttp.ClientSession()
ca_bundle = 'C:\\Users\\balls\\source\\repos\\cacert.pem'

# ssl_context = ssl.create_default_context(cafile=ca_bundle)
# ssl_context.check_hostname = False
# ssl_context.verify_mode = ssl.CERT_NONE

# async with authsession.post(
# Constants.AUTH_URL,
# json=body,
# headers=headers,
# proxy=proxy["http"] if proxy is not None else None
# ) as r:
# debugvalue_raw = await r.text()
# if self.isDebug:
# print(debugvalue_raw)
r = scraper.post(Constants.AUTH_URL, json=body, headers=headers, proxies=proxy)
#print(r.text)
r = client.post(Constants.AUTH_URL, json=body, headers=headers)
debugvalue_raw = r.text
if self.isDebug:
print(r.text)
cookies = r.cookies
scraper.cookies.update(cookies)
print(debugvalue_raw)


# R2
data = {
"type": "auth",
"username": username,
"password": password
"password": password,
"remember": True,
}
# HUGE thanks to https://github.com/sandbox-pokhara/league-client
headers = {
"Accept-Encoding": "gzip, deflate, br, zstd",
"User-Agent": "dsadasdsadas",
"Cache-Control": "no-cache",
"Accept": "application/json",
"User-Agent": (
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X)"
" AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.1502.79 Mobile"
" Safari/537.36"
),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.9",
"Accept-Encoding": "gzip, deflate",
"referer":"https://authenticate.riotgames.com/"
}
# async with authsession.put(
# Constants.AUTH_URL,
# json=data,
# headers=headers,
# proxy=proxy["http"] if proxy is not None else None
# ) as r:
# body = await r.text()
# if self.isDebug:
# print(body)
# data = await r.json()
# r2text = str(await r.text())
r = scraper.put(Constants.AUTH_URL, json=data, headers=headers, proxies=proxy)
r2text = r.text
#input(r2text)
data = r.json()
if self.isDebug:
print(r2text)
await authsession.close()
except aiohttp.ClientResponseError as e:
await authsession.close()
r = client.put(Constants.AUTH_URL, json=data, headers=headers)
body = r.text
input(body)
if self.isDebug:
print(e.status)
account.code = 6
return account
print(body)
data = r.json()
r2text = r.text
client.close()
except Exception as e:
#input(traceback.format_exc())
await authsession.close()
client.close()
if self.isDebug:
print(traceback.format_exc())
print(e)
account.code = 6
return account
if "access_token" in r2text:
Expand Down Expand Up @@ -173,10 +146,10 @@ async def auth(self, logpass: str = None, username: str = None, password: str =
'Authorization': str(f'Bearer {token}'),
})
try:
with session.post(Constants.ENTITLEMENT_URL, headers=headers, json={}, proxies=proxy) as r:
with client.post(Constants.ENTITLEMENT_URL, headers=headers, json={}) as r:
entitlement = r.json()['entitlements_token']
r = session.post(Constants.USERINFO_URL,
headers=headers, json={}, proxies=proxy)
r = client.post(Constants.USERINFO_URL,
headers=headers, json={})
except Exception as e:
account.code = 6
return account
Expand Down Expand Up @@ -256,7 +229,7 @@ async def auth(self, logpass: str = None, username: str = None, password: str =
input()
return account
except Exception as e:
# input(traceback.format_exc())
print(e)
account.errmsg = traceback.format_exc()
account.code = int(2)
return account
24 changes: 12 additions & 12 deletions src/codeparts/authclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

class AuthClient:
RIOT_CLIENT_USER_AGENT = token_urlsafe(111)
CIPHERS13 = str(":".join(
CIPHERS13 = ":".join(
(
"TLS_CHACHA20_POLY1305_SHA256",
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384",
)
))
CIPHERS = str(":".join(
)
CIPHERS = ":".join(
(
"TLS_AES_256_GCM_SHA384",
"TLS_CHACHA20_POLY1305_SHA256",
Expand All @@ -39,8 +39,8 @@ class AuthClient:
"DHE-RSA-AES256-SHA256",
"DHE-RSA-AES128-SHA256",
)
))
SIGALGS = str(":".join(
)
SIGALGS = ":".join(
(
"ecdsa_secp256r1_sha256",
"rsa_pss_rsae_sha256",
Expand All @@ -52,7 +52,7 @@ class AuthClient:
"rsa_pkcs1_sha512",
"rsa_pkcs1_sha1",
)
))
)

def __init__(self) -> None:
self._auth_ssl_ctx = AuthClient.create_riot_auth_ssl_ctx()
Expand All @@ -69,7 +69,7 @@ def __init__(self) -> None:
def create_riot_auth_ssl_ctx() -> ssl.SSLContext:
ssl_ctx = ssl.create_default_context()

addr = int(id(ssl_ctx) + sys.getsizeof(object()))
addr = id(ssl_ctx) + sys.getsizeof(object())
ssl_ctx_addr = ctypes.cast(addr, ctypes.POINTER(ctypes.c_void_p)).contents

libssl: Optional[ctypes.CDLL] = None
Expand All @@ -96,9 +96,9 @@ def create_riot_auth_ssl_ctx() -> ssl.SSLContext:
ssl_ctx.minimum_version = ssl.TLSVersion.TLSv1
ssl_ctx.set_alpn_protocols(["http/1.1"])
ssl_ctx.options |= 1 << 19
# libssl.SSL_CTX_set_ciphersuites(ssl_ctx_addr, AuthClient.CIPHERS13.encode())
# libssl.SSL_CTX_set_cipher_list(ssl_ctx_addr, AuthClient.CIPHERS.encode())
# libssl.SSL_CTX_ctrl(ssl_ctx_addr, 98, 0, AuthClient.SIGALGS.encode())
libssl.SSL_CTX_set_ciphersuites(ssl_ctx_addr, AuthClient.CIPHERS13.encode())
libssl.SSL_CTX_set_cipher_list(ssl_ctx_addr, AuthClient.CIPHERS.encode())
libssl.SSL_CTX_ctrl(ssl_ctx_addr, 98, 0, AuthClient.SIGALGS.encode())

# print([cipher["name"] for cipher in ssl_ctx.get_ciphers()])
return ssl_ctx
Expand All @@ -110,9 +110,9 @@ def __update(
("sub", "user_id"),
("exp", "expires_at"),
),
**kwargs:any,
**kwargs,
) -> None:
predefined_keys = list([key for key in self.__dict__.keys() if key[0] != "_"])
predefined_keys = [key for key in self.__dict__.keys() if key[0] != "_"]

self.__dict__.update(
(key, val) for key, val in kwargs.items() if key in predefined_keys
Expand Down
4 changes: 3 additions & 1 deletion src/codeparts/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,4 +549,6 @@ class Constants:
PVPNETHEADERSBASE = {
"X-Riot-ClientVersion": "release-01.08-shipping-10-471230",
"X-Riot-ClientPlatform": "ew0KCSJwbGF0Zm9ybVR5cGUiOiAiUEMiLA0KCSJwbGF0Zm9ybU9TIjogIldpbmRvd3MiLA0KCSJwbGF0Zm9ybU9TVmVyc2lvbiI6ICIxMC4wLjE5MDQyLjEuMjU2LjY0Yml0IiwNCgkicGxhdGZvcm1DaGlwc2V0IjogIlVua25vd24iDQp9"
}
}
CIPHERS = "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA:DES-CBC3-SHA"
ECDH_CURVE = "prime256v1"
2 changes: 1 addition & 1 deletion src/local/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"sett": "Loading Settings",
"prox": "Loading Proxies",
"assets": "Loading Assets",
"checker": "loading checker"
"checker": "Loading Checker"
},
"slchecker": {
"capskinsq": "wanna capture skins?",
Expand Down
2 changes: 1 addition & 1 deletion src/system/ver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.18.3.2
3.18.3.3

0 comments on commit 45060aa

Please sign in to comment.