所有加密,使用的数据都写在接口里
奥体整个后台也进行了重构,这套代码也使用不了了
现在的加密方式,完全看不懂
例:
这种加密没源码,想破脑袋也破解不了的
所使用的模块:request和re
工具:pycharm和fiddler
微信小程序:苏州奥体
// 选场地
changdi_url = "https://sapb.szosc.cn/index.php/wxplace/place/pay"
date = {
'price': '30',
'fieldtype': '羽毛球场地',
'homename': '体育馆名称',
'field': '11:00-12:00|2021-09-07 11:00:00|6|30,12:00-13:00|2021-09-07 12:00:00|6|30',
'openid': '自己的id',
'unionid': '自己的id',
'limit': '1.0000',
'agree': '1'
}
response = requests.post(url=changdi_url, data=date)
//获取返回值信息
response_text = response.text
//通过正则匹配对应值
outtradeno = re.findall('(name="outtradeno" value=")(.*)(" /)', response_text)[0][1]
ordtotal_fee = re.findall('(name="ordtotal_fee" value=")(.*)(" /)', response_text)[0][1]
homename = re.findall('(name="homename" value=")(.*)(" /)', response_text)[0][1]
fieldtype = re.findall('(name="fieldtype" value=")(.*)(" /)', response_text)[0][1]
fieldnum = re.findall('(name="fieldnum" value=")(.*)(" /)', response_text)[0][1]
starttime = re.findall('(name="starttime" value=")(.*)(" /)', response_text)[0][1]
bookinfo = re.findall('(name="bookinfo" value=")(.*)("/)', response_text)[0][1]
uid = re.findall('(name="uid" value=")(.*)("/)', response_text)[0][1]
paid = re.findall('(name="paid" value=")(.*)(" /)', response_text)[0][1]
limit = re.findall('(name="limit" value=")(.*)("/)', response_text)[0][1]
dttoken = re.findall('(name="dttoken" value=")(.*)("/)', response_text)[0][1]
yhq = re.findall('(name="yhq" value=")(.*)("/)', response_text)[0][1]
yhqid = re.findall('(name="yhqid" value=")(.*)("/)', response_text)[0][1]
payType = re.findall('(name="payType" value=")(.*)(" /)', response_text)[0][1]
vipCode = re.findall('(name="vipCode" value=")(.*)(" /)', response_text)[0][1]
outTradeNo = re.findall('(name="outTradeNo" value=")(.*)(" /)', response_text)[0][1]
totalFee = re.findall('(name="totalFee" value=")(.*)(" /)', response_text)[0][1]
balanceMethod = re.findall('(name="balanceMethod" value=")(.*)(" /)', response_text)[0][1]
cashAmount = re.findall('(name="cashAmount" value=")(.*)(" /)', response_text)[0][1]
//加密方法
def md5_encrypt(code):
m = hashlib.md5()
m.update(code.encode("utf-8"))
sign = "123" + m.hexdigest()
return sign
//拼接原数据
sign_old = "wxopenid" + outtradeno + bookinfo + paid + "Sport2021"
//调用
sign = md5_encrypt(sign_old)
//将第一步返回数据,放到付款接口的参数里面
pay_url = "https://sapb.szosc.cn/index.php/yinlian/index/pay"
data = {
'bookholder': '姓名',
'mobile': '电话',
"idno": '',
'outtradeno': outtradeno,
'ordtotal_fee': ordtotal_fee,
'homename': homename,
'fieldtype': fieldtype,
'wxopenid': wxopenid,
'unionid': unionid,
'fieldnum': fieldnum,
'starttime': starttime,
'bookinfo': bookinfo,
'uid': uid,
'paid': paid,
'limit': limit,
'dttoken': dttoken,
'yhq': yhq,
'yhqid': yhqid,
'sign': sign,
'payType': payType,
'vipCode': vipCode,
'outTradeNo': outTradeNo,
'totalFee': totalFee,
'balanceMethod': balanceMethod,
'cashAmount': cashAmount,
'groupName': '',
'merchantCode': '',
'groupVipId': ''
}
resp = requests.post(url=pay_url, data=data)