Commit 77297dc2 by sikang

add gw script

parent 4a4fcb77
import requests
import json
import string
import random
import glob, os
import sys
path = "../../../gradle.properties"
gw_url=os.popen('. ../../../gradle.properties\necho "${gateway_url}"').read().replace('\n', '')
print(gw_url)
gateway = requests.get(gw_url).json()
print(gateway)
with open(path, "r") as f:
lines = f.readlines()
with open(path, "w") as f_w:
for line in lines:
if "base_url=" in line:
line = "base_url=\"%s\"\n"%(gateway['rest'][0])
elif "harvest_ip=" in line:
harvester=gateway['harvester'][0].split(":")
line = "harvest_ip=\"%s\"\n"%(harvester[0]+harvester[1])
elif "harvest_port=" in line:
line = "harvest_port=%s\n"%(gateway['harvester'][0].split(":")[2])
elif "gateway_ip=" in line:
line = "gateway_ip=\"%s\"\n"%(gateway['gateway'][1])
elif "repayment_h5=" in line:
line = "repayment_h5=\"%s\"\n"%(gateway['repay'][0])
elif "admin_host=" in line:
line = "admin_host=\"%s\"\n"%(gateway['admin'][0])
elif "agreement_url=" in line:
line = "agreement_url=\"%s\"\n"%(gateway['privacy'][0])
f_w.write(line)
...@@ -21,6 +21,7 @@ echo "18、加固" ...@@ -21,6 +21,7 @@ echo "18、加固"
echo "19、混淆api" echo "19、混淆api"
echo "20、更新GP状态" echo "20、更新GP状态"
echo "21、获取签名秘钥散列" echo "21、获取签名秘钥散列"
echo "22、更新gateway"
echo -n "请输入指令编号:" echo -n "请输入指令编号:"
read commod read commod
...@@ -165,6 +166,11 @@ then ...@@ -165,6 +166,11 @@ then
. gradle.properties . gradle.properties
keytool -exportcert -alias ${signing_keyAlias} -keystore "app/${signing_certificate}" -storepass "${signing_keyAlias}" | openssl sha1 -binary | openssl base64 keytool -exportcert -alias ${signing_keyAlias} -keystore "app/${signing_certificate}" -storepass "${signing_keyAlias}" | openssl sha1 -binary | openssl base64
elif (($commod == '22'))
then
cd res
chmod a+x update_gateway.py
python update_gateway.py
elif (($commod == '10000')) elif (($commod == '10000'))
then then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment