-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebugtalk.py
More file actions
107 lines (91 loc) · 2.41 KB
/
debugtalk.py
File metadata and controls
107 lines (91 loc) · 2.41 KB
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
99
100
101
102
103
104
105
106
107
import pymysql
import os
import random
import string
import json
import re
# 引入环境变量
backlogin = os.environ["backlogin"] # admin
backpwd = os.environ["backpwd"] # wsy88888
password = os.environ["password"] # wsy888888
env = os.environ["env"]
base_url = os.environ["base_url"]
# 随机整型数字
def random_int(x,y=999999):
return random.randint(x,y)
# 随机浮点型数字
def random_float(x,y=999999,k=4):
return round(random.uniform(x,y),k)
# 随机字符
def random_str(x):
ran_str = ''.join(random.sample(string.ascii_letters + string.digits, x))
return ran_str
# 相加
def sum_two(x, y):
x = float(x)
y = float(y)
return x + y
# 相乘
def mult_two(x,y):
x = float(x)
y = float(y)
return x * y
# 取出最小的币种ID
def extract_change_rate(content_data):
data = json.dumps(content_data)
data_1 = json.loads(data)
# return data_1['data'][3]['change_rate']
l =[]
for x in range(len(data_1)):
s = data_1['data'][x]['change_rate']
l.append(s)
i = l.index(max(l))
return data_1['data'][i]['id']
# 自动递增
def count_num(x):
return x + 1
# 递增
def createCounter():
f = [0]
def increase():
f[0] = f[0] + 1
return f[0]
return increase
range_num = createCounter()
# 抽取权益卡密码
def card_pass(content_data):
x = re.findall("密码:(\w{6})", content_data)
return x[0]
# #创建连接
# conn = pymysql.connect(host="172.16.10.184", port=3313, user="root", password="tW2sDsVzD7Nae1jy",
# db="wsy_blockchain", charset='utf8')
# # 修改为888888
# def insetsql():
# cursor = conn.cursor()
# sql = 'UPDATE rights_card SET card_pass = \'45bdm2I/LOuviIJIvxwJp3eQACqpRYxaQ7n4Ob0upf/9LAg\' ORDER BY card_num DESC LIMIT 1;'
# try:
# # 执行sql语句
# cursor.execute(sql)
# conn.commit()
# except:
# conn.rollback()
# print("sql执行失败!")
# finally:
# cursor.close()
# conn.close()
# print("sql执行成功!")
# #查询权益卡ID
# def selecesql():
# cursor = conn.cursor()
# sql = 'SELECT * FROM rights_card ORDER BY card_num DESC LIMIT 1;'
# try:
# cursor.execute(sql)
# row_1 = cursor.fetchone()
# except:
# conn.rollback()
# print("sql执行失败!")
# finally:
# cursor.close()
# conn.close()
# print("sql执行成功!")
# return row_1[0]