├── README.md
└── main.py
/README.md:
--------------------------------------------------------------------------------
1 |
2 | Riot-auth for updated code https://github.com/ohlunaaa/Valorant-auth
3 |
4 |
5 |
6 | Riot-auth is a example to get around riots cloudflare
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | PLease leave a like and follow
20 |
21 |
22 | ---
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import ssl
2 | from typing import Any
3 | from collections import OrderedDict
4 | import requests
5 | from requests.adapters import HTTPAdapter
6 | import pandas
7 | from re import compile
8 | from colorama import Fore
9 | import time
10 |
11 | CIPHERS = [
12 | 'ECDHE-ECDSA-AES128-GCM-SHA256',
13 | 'ECDHE-ECDSA-CHACHA20-POLY1305',
14 | 'ECDHE-RSA-AES128-GCM-SHA256',
15 | 'ECDHE-RSA-CHACHA20-POLY1305',
16 | 'ECDHE+AES128',
17 | 'RSA+AES128',
18 | 'ECDHE+AES256',
19 | 'RSA+AES256',
20 | 'ECDHE+3DES',
21 | 'RSA+3DES'
22 | ]
23 | class URLS:
24 | AUTH_URL = "https://auth.riotgames.com/api/v1/authorization"
25 | REGION_URL = 'https://riot-geo.pas.si.riotgames.com/pas/v1/product/valorant'
26 | VERIFED_URL = "https://email-verification.riotgames.com/api/v1/account/status"
27 | ENTITLEMENT_URL = 'https://entitlements.auth.riotgames.com/api/token/v1'
28 | USERINFO_URL = "https://auth.riotgames.com/userinfo"
29 |
30 |
31 | class SSLAdapter(HTTPAdapter):
32 | def init_poolmanager(self, *a: Any, **k: Any) -> None:
33 | c = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
34 | c.set_ciphers(':'.join(CIPHERS))
35 | k['ssl_context'] = c
36 | return super(SSLAdapter, self).init_poolmanager(*a, **k)
37 |
38 |
39 | class Auth:
40 | def __init__(self, username, password):
41 | self.username = username
42 | self.password = password
43 | self.session = requests.Session()
44 | self.session.headers = OrderedDict({"User-Agent": "RiotClient/58.0.0.4640299.4552318 %s (Windows;10;;Professional, x64)","Accept-Language": "en-US,en;q=0.9","Accept": "application/json, text/plain, */*"})
45 | self.session.mount('https://', SSLAdapter())
46 |
47 | tokens = self.authorize()
48 | if 'x' in tokens:
49 | return
50 | self.access_token = tokens[0]
51 | self.id_token = tokens[1]
52 |
53 | self.base_headers = {'User-Agent': "RiotClient/58.0.0.4640299.4552318 %s (Windows;10;;Professional, x64)",'Authorization': f'Bearer {self.access_token}',}
54 | self.session.headers.update(self.base_headers)
55 |
56 | self.entitlement = self.get_entitlement_token()
57 | self.emailverifed = self.get_emailverifed()
58 |
59 | userinfo = self.get_userinfo()
60 | self.Sub = userinfo[0]
61 | self.Name = userinfo[1]
62 | self.Tag = userinfo[2]
63 | self.creationdata = userinfo[3]
64 | self.typeban = userinfo[4]
65 | self.Region_headers = {'Content-Type': 'application/json', 'Authorization': f'Bearer {self.access_token}'}
66 | self.session.headers.update(self.Region_headers)
67 | self.Region = self.get_Region()
68 | self.p = self.print()
69 | def authorize(self):
70 | data = {"acr_values": "urn:riot:bronze","claims": "","client_id": "riot-client","nonce": "oYnVwCSrlS5IHKh7iI16oQ","redirect_uri": "http://localhost/redirect","response_type": "token id_token","scope": "openid link ban lol_region",}
71 | data2 = {"language": "en_US","password": self.password,"remember": "true","type": "auth","username": self.username,}
72 |
73 | r = self.session.post(url=URLS.AUTH_URL, json = data)
74 |
75 | r = self.session.put(url=URLS.AUTH_URL, json = data2)
76 | data = r.json()
77 | if "access_token" in r.text:
78 | pattern = compile('access_token=((?:[a-zA-Z]|\d|\.|-|_)*).*id_token=((?:[a-zA-Z]|\d|\.|-|_)*).*expires_in=(\d*)')
79 | data = pattern.findall(data['response']['parameters']['uri'])[0]
80 | token = data[0]
81 | token_id = data[1]
82 | return [token,token_id]
83 |
84 | elif "auth_failure" in r.text:
85 | print(F"{Fore.RED}[NOT EXIST] {Fore.RESET} {self.username}:{self.password}")
86 | return "x"
87 |
88 | elif 'rate_limited' in r.text:
89 | print(F"{Fore.YELLOW}[RATE] {Fore.RESET} {self.username}:{self.password}")
90 | time.sleep(40)
91 | return 'x'
92 | else:
93 | ver_code = input(F'{Fore.GREEN}2FA Auth Enabled{Fore.RESET}. Enter the verification code: \n')
94 | authdata = {
95 | 'type': 'multifactor',
96 | 'code': ver_code,
97 | }
98 | r = self.session.put(url=URLS.AUTH_URL, json=authdata)
99 | data = r.json()
100 | if "access_token" in r.text:
101 | pattern = compile('access_token=((?:[a-zA-Z]|\d|\.|-|_)*).*id_token=((?:[a-zA-Z]|\d|\.|-|_)*).*expires_in=(\d*)')
102 | data = pattern.findall(data['response']['parameters']['uri'])[0]
103 | token = data[0]
104 | token_id = data[1]
105 | return [token,token_id]
106 |
107 | elif "auth_failure" in r.text:
108 | print(F"{Fore.RED}[ERROR] {Fore.RESET} {self.username}:{self.password}") # banned (?)
109 | else:
110 | print(F"{Fore.RED}[ERROR] {Fore.RESET} {self.username}:{self.password}")
111 |
112 |
113 | def get_entitlement_token(self):
114 | r = self.session.post(URLS.ENTITLEMENT_URL, json={})
115 | entitlement = r.json()['entitlements_token']
116 | return entitlement
117 |
118 | def get_emailverifed(self):
119 | r = self.session.get(url=URLS.VERIFED_URL,json={})
120 | Emailverifed = r.json()["emailVerified"]
121 | return Emailverifed
122 |
123 | def get_userinfo(self):
124 | r = self.session.get(url=URLS.USERINFO_URL,json={})
125 | data = r.json()
126 | Sub = data['sub']
127 | data1 = data['acct']
128 | Name = data1['game_name']
129 | Tag = data1['tag_line']
130 | time4 = data1['created_at']
131 | time4 = int(time4)
132 | Createdat = pandas.to_datetime(time4,unit='ms')
133 | str(Createdat)
134 | data2 = data['ban']
135 | data3 = data2['restrictions']
136 | typeban = None
137 | if data3 != []:
138 | for x in data3:
139 | type = x['type']
140 | if type == "TIME_BAN":
141 | for y in data3:
142 | lol = y['dat']
143 | exeperationdate = lol['expirationMillis']
144 | time1 = exeperationdate
145 | time1 = int(time1)
146 | Exp = pandas.to_datetime(time1,unit='ms', errors="ignore")
147 | str(Exp)
148 | typeban = "TIME_BAN"
149 | if type == "PERMANENT_BAN":
150 | typeban = "PERMANENT_BAN"
151 | if data3 == [] or "PBE_LOGIN_TIME_BAN" in data3 or "LEGACY_BAN" in data3:
152 | typeban = "None"
153 | return [Sub,Name,Tag,Createdat,typeban]
154 |
155 | def get_Region(self):
156 | json = {"id_token": self.id_token}
157 | r = self.session.put('https://riot-geo.pas.si.riotgames.com/pas/v1/product/valorant',json=json)
158 | data = r.json()
159 | Region = data['affinities']['live']
160 | return Region
161 | def print(self):
162 | print()
163 | print(f"Accestoken: {self.access_token}")
164 | print("-"*50)
165 | print(f"Entitlements: {self.entitlement}")
166 | print("-"*50)
167 | print(f"Userid: {self.Sub}")
168 | print("-"*50)
169 | print(f"Region: {self.Region}")
170 | print("-"*50)
171 | print(f"Name: {self.Name}#{self.Tag}")
172 | print("-"*50)
173 | print(f"Createdat: {self.creationdata}")
174 | print("-"*50)
175 | print(f"Bantype: {self.typeban}")
176 |
177 | Auth(username="",password="")
178 |
--------------------------------------------------------------------------------