clean useless scripts

This commit is contained in:
heavyrain lee
2019-04-19 08:13:43 +08:00
parent 99a0590c7e
commit ac2d2a530a
7 changed files with 0 additions and 665 deletions
@@ -1,53 +0,0 @@
# -- coding: utf-8 --
import time
import hashlib
import random
import requests
# 签名方法说明
# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。
# 值如下所示。
# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期
# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致
#需要用到requests库,首先要安装pip
#sudo easy_install pip
#然后在安装requests module
#sudo pip install requests
import sys
if len(sys.argv) < 2:
print 'Usage: python gettoken.py userid'
sys.exit()
user = sys.argv[1]
SECRET_KEY = '123456'
URL = 'http://localhost:18080/admin/user/token'
ts = (int(round(time.time() * 1000)))
random.seed(time.time())
nonce = (int(round(random.random() * 100000)))
orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts)
sign = hashlib.sha1(orignSign).hexdigest()
headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'}
payload = {'userId':user}
print 'headers:'
print headers
print
print 'payload:'
print payload
print
r = requests.post(URL, headers = headers, json = payload)
print 'response:'
print(r.status_code)
print r.content
@@ -1,53 +0,0 @@
# -- coding: utf-8 --
import time
import hashlib
import random
import requests
# 签名方法说明
# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。
# 值如下所示。
# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期
# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致
#需要用到requests库,首先要安装pip
#sudo easy_install pip
#然后在安装requests module
#sudo pip install requests
import sys
if len(sys.argv) < 2:
print 'Usage: python getuserinfo.py userid'
sys.exit()
user = sys.argv[1]
SECRET_KEY = '123456'
URL = 'http://localhost/admin/user/info'
ts = (int(round(time.time() * 1000)))
random.seed(time.time())
nonce = (int(round(random.random() * 100000)))
orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts)
sign = hashlib.sha1(orignSign).hexdigest()
headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'}
payload = {'userId':user}
print 'headers:'
print headers
print
print 'payload:'
print payload
print
r = requests.post(URL, headers = headers, json = payload)
print 'response:'
print(r.status_code)
print r.content
@@ -1,55 +0,0 @@
# -- coding: utf-8 --
import time
import hashlib
import random
import requests
# 签名方法说明
# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。
# 值如下所示。
# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期
# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致
#需要用到requests库,首先要安装pip
#sudo easy_install pip
#然后在安装requests module
#sudo pip install requests
import sys
if len(sys.argv) < 4:
print 'Usage: python register.py username password displayname'
sys.exit()
user = sys.argv[1]
pwd = sys.argv[2]
displayname = sys.argv[3]
SECRET_KEY = '123456'
URL = 'http://localhost:18080/admin/user/create'
ts = (int(round(time.time() * 1000)))
random.seed(time.time())
nonce = (int(round(random.random() * 100000)))
orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts)
sign = hashlib.sha1(orignSign).hexdigest()
headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'}
payload = {'name':user, 'password':pwd, 'displayName':displayname}
print 'headers:'
print headers
print
print 'payload:'
print payload
print
r = requests.post(URL, headers = headers, json = payload)
print 'response:'
print(r.status_code)
print r.content