· 4 years ago · Jun 27, 2021, 02:06 AM
1from readsettings import ReadSettings
2import requests
3import json
4import time
5
6config = ReadSettings("Config.json")
7
8token = config['api_key']
9country = config["country"]
10operator = config['operator']
11
12def request5SimNumber():
13 headers = {
14 'Authorization': 'Bearer ' + token,
15 'Content-Type': 'application/json',
16 }
17 #5sim Part
18 print("[+] Requesting phone number..")
19 response = requests.get('https://5sim.net/v1/user/buy/activation/' + country + '/' + operator + '/' + "blizzard", headers=headers)
20 try:
21 data = json.loads(response.text)
22 id = data['id']
23 phoneNumberr = data['phone']
24 print("Phone Request Info:")
25 print('Phone Number: ' + str(phoneNumberr))
26 print('Phone Price: ' + str(data['price']))
27 return data
28 except:
29 if(response.status_code == 401):
30 raise Exception("[5Sim.net] API Key Invalid!")
31 else:
32 raise Exception("[Exception] Caught Exception while requesting 5Sim Number: {}".format(response.text))
33
34def waitFor5SimCode(id):
35 headers = {
36 'Authorization': 'Bearer ' + token,
37 'Content-Type': 'application/json',
38 }
39 codeInp = ""
40 while(requests.get('https://5sim.net/v1/user/check/' + str(id), headers=headers)):
41 response = requests.get('https://5sim.net/v1/user/check/' + str(id), headers=headers)
42 data = json.loads(response.text)
43 if(data['status'] == "RECEIVED"):
44 print("[!] Waiting for code")
45 if(data['sms']):
46 codeInp = data['sms'][0]['code']
47 break
48 elif(data['status'] == "PENDING"):
49 print("[!] Waiting for phone setup..")
50 time.sleep(2)
51 else:
52 print("Something went wrong: STATUS: " + data['status'])
53 print("[+] Got SMS Code: " + codeInp)
54 return codeInp
55
56data = request5SimNumber()
57id = data['id']
58phoneNumberr = data['phone']
59if(id):
60 code = waitFor5SimCode(id)
61 if(code):
62 print(code)
63
64###########CONFIG.json##############
65{
66 "api_key": "",
67 "country": "russia",
68 "operator": "any"
69}
70