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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from android_event.android_script import allEvent
import random
import requests
import socket
import struct
import time
import datetime
#向短链发送点击数据
#测试环境
URL = 'http://10.3.20.42:8083/tkio/j2M3Yra?callback=__CALLBACK__'
appkey = '77611aaa17bcaafe889e3fac2c3e6855'
# event = 'ry_wake'
nowTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
s = 0
w = 0
for _ in range(1):
print("开始时间"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
#随机生成12为数组
i = ''.join(str(random.choice(range(10))) for _ in range(12))
#i = '9845632344'
#随机生成ip
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
#ip = '148.206.254.57'
try:
parms = {
#'androidid'18888888888:a,
'imei': i,
'ip': ip,
#'cid': '2093'
#'subchannel': '123456789',
#'aid': '54676',
#'siteid': '68793',
#'csite': '4355743'
}
#timeout可以超时四秒
p = requests.get(url=URL,params=parms,timeout=10)
print('imei:',i)
print("ip:",ip)
print('success:',s)
#print('androidid:',a)
s=s+1
except Exception as err:
print(err)
print('wrong:',w)
print('imei:', i)
print("ip:",ip)
#print('androidid', a)
w=w+1
#continue
time.sleep(5)
try:
allEvent().installUpload(i, ip, appkey)
except Exception:
print('install_wrong:', w)
w = w + 1
# continue
# time.sleep(1)
# try:
# allEvent().registerEvent(i, ip, appkey)
# except Exception as e:
# print('注册_wrong:', w)
# print(e)
# continue
# # time.sleep(1)
# try:
# allEvent().loginEvent(i, ip, appkey)
# except Exception:
# print('登录_wrong:', w)
# continue
# # time. sleep(3)
# try:
# allEvent().payEvent(i, ip, appkey)
# except Exception as err:
# print(err)
# print('付费_wrong:', w)
print("结束时间" + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))