代码拉取完成,页面将自动刷新
同步操作将从 vitojc/fast-poster 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import sys, getopt
import os
import random
keys = dict()
KEYS_FILE_NAME = "keys.txt"
seed = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def load_keys():
"""
加载KEY列表
@return:
"""
if not os.path.exists(KEYS_FILE_NAME):
return False
with open(KEYS_FILE_NAME) as f:
for line in f:
line = line.strip()
kv = line.split(" ")
keys[kv[0]] = kv[1]
print(f"加载keys列表: {keys}")
return True
def check(accessKey, secretKey):
"""
检查校验key是否正确
@param accessKey:
@param secretKey:
@return:
"""
if not accessKey:
return False
if not secretKey:
return False
return accessKey in keys and keys[accessKey] == secretKey
def save_keys(keys):
"""
保存key列表
@param keys:
@return:
"""
with open(KEYS_FILE_NAME, mode='w') as f:
f.writelines(keys)
def gen_keys(times=1):
"""
生成建列表
@return:
"""
keys = []
print("生成KEY列表")
for i in range(times):
k = rkey()
v = rkey(20)
print(f"accessKey: {k}")
print(f"secretKey: {v}\n")
keys.append(f"{k} {v}\n")
save_keys(keys)
def rkey(len=16, seed=seed):
"""
返回随机字符串
@param len:
@param seed:
@return:
"""
sa = []
for i in range(len):
sa.append(random.choice(seed))
salt = ''.join(sa)
return salt
def init():
help_info = """app.py -k <accessKey> -s <secretKey>"""
if load_keys():
return
# 从参数中获取
argv = sys.argv[1:]
accessKey = None
secretKey = None
try:
opts, args = getopt.getopt(argv, "hk:s:", ["accessKey=", "secretKey="])
except getopt.GetoptError:
print(help_info)
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print(help_info)
sys.exit()
elif opt in ("-k", "--accessKey"):
accessKey = arg
elif opt in ("-s", "--secretKey"):
secretKey = arg
if accessKey and secretKey:
# 保存传进来的key列表
save_keys([f"{accessKey} {secretKey}"])
else:
# 自动生成key列表
gen_keys()
init()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。