コード例 #1
0
test_core.tlog(privatekey)
test_core.tlog("生成的密钥 public key")
test_core.tlog(publickey)
# quit()

publickey = publickey.decode()
# publickey = base64.b64encode(publickey).decode() # 在 POST 模式下可有可无
postData = {
    'appkey': jsonfiledata["appkey"],
    'devtype': "debug",
    'devdevice': platform.architecture(),
    'devos': platform.system(),
    'devosver': platform.platform(),
    'publickey': publickey
}
url = jsonfiledata["url"]+"nyaencryption.php"
resArr = test_core.postarray(
    url, postData, True, default_public_key, privatekey,0)
test_core.tlog("保存到数据文件 ...")
jsonfiledata["publickey"] = resArr['publickey']
jsonfiledata["privatekey"] = privatekey.decode()
jsonfiledata["apptoken"] = resArr['apptoken']
jsonfiledata["updatetime"] = [resArr['time'],
                              resArr['timestamp'], resArr['timezone']]
jsonfiledata["encrypt"] = resArr['encrypt']
lines = json.dumps(jsonfiledata)
f = open("testconfig.json", "w")
f.write(lines)
f.close()
test_core.tok("完成。")
コード例 #2
0
# -*- coding:utf-8 -*-
import test_core
test_core.title("加密 I/O 测试")
uurl = "http://127.0.0.1/NyarukoLogin/tests/conntest.php"
udataarr = {'testkey1': "testval1", 'testkey2': "testval2"}
test_core.postarray(uurl, udataarr, True)
コード例 #3
0
# -*- coding:utf-8 -*-
import test_core
import webbrowser
import demjson
test_core.title("获得验证码测试")
f = open("testconfig.json", 'r')
lines = f.read()
f.close()
jsonfiledata = demjson.decode(lines)
if jsonfiledata["url"] == "":
    test_core.terr("错误: 'testconfig.json' 配置不完全。")
    exit()
uurl = jsonfiledata["url"] + "nyacaptcha.php"
udataarr = {}
img = test_core.postarray(uurl, udataarr, True)["img"]
webbrowser.open(img)