1.使用Fiddler进行抓包
设置完成后打开模拟器上的手游和Fiddler进行抓包,此次我们用登录功能作为例子:
注册好游戏账号点击“立即登录”
这时切换到fiddler,如图所示:
图中蓝色部分即为所抓到的登录包
2.用python发送登录请求
代码如下:# -*- coding:utf-8 -*-
import requests
import time
import tools
import json
pid = '1'
dev = '0d001e11875d004903dbabd464d31417'
sversion = '3.5.6'
scut = '1'
gid = '1006609'
mdev =''
version = '0.3.5'
refer = '1_1006609_10913_1022'
gwversion = '1.0.0'
android_id = '2f8d4d3f6c8a4914'
appkey = 'slDMjCNm0na18Jdxq79HgocQTf:GvF/W'
def login(uname, upwd):
url = 'http://s-api.37.com.cn/sdk/login/'
headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; OPPO R11 Plus Build/NMF26X)',
'Host': 's-api.37.com.cn',
'Connection': 'Keep-Alive',
'Accept-Encoding': 'gzip'
# 'Content - Length': '255'
}
t = time.time()
<