-
Notifications
You must be signed in to change notification settings - Fork 2
/
activate.py
93 lines (58 loc) · 1.88 KB
/
activate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import json
import httpx
import time
import random
import logger
def remove(string):
return string.replace(" ", "")
with open("config.json") as data:
config = json.load(data)
apikey = config['sms-activate-apikey']
country = config['sms-activate-country']
operator = config['sms-activate-operator']
sms_api = 'https://api.sms-activate.org/stubs/handler_api.php?'
sms_api2 = 'https://sms-activate.ru/stubs/handler_api.php?'
def buynumber():
while True:
try:
number = httpx.post(
sms_api + f'action=getNumber&api_key={apikey}&service=ds&forward=0&country={country}')
if ':' in number.text:
phonenumber = '+' + number.text.split(':')[2]
id = number.text.split(':')[1]
orderdata = {
"number": phonenumber,
"id": id
}
return orderdata
else:
logger.log("No Number Available")
time.sleep(2)
continue
except:
continue
def checkforsms(orderdata):
countdown = 30
id = orderdata['id']
Nope = "no"
payload = {'api_key': apikey,"id":id, 'action': 'getStatus'}
while (countdown):
response = httpx.get(sms_api2,params=payload)
time.sleep(1)
countdown -= 1
time.sleep(1)
if response.text != "STATUS_WAIT_CODE":
stres = str(response.text)
w = stres.split(":")
res = w[1]
newcode = res
return newcode
else:
continue
return Nope
def cancel(orderdata):
id = orderdata['id']
status = httpx.post(sms_api2 + f'action=setStatus&api_key={apikey}&id={id}&status=6')
def finish(orderdata):
id = orderdata['id']
status = httpx.post(sms_api2 + f'action=setStatus&api_key={apikey}&id={id}&status=6')