- 1.安装Fiddler4抓包工具
- 因为官方软件下载速度比较慢,所以在360软件库下载安装过程很简单纯粹下一步。
1-1
- 2.设置Fiddler抓取HTTPS数据包。
- 1.安装成功之后,启动Fiddler进入软件界面。
1-2
- 选择tools->options->https和tools->options->connections,然后按下图红线勾上和设置。
1-3
1-4
- 3.完成上述操作之后,要fiddler对ios设备的https通信转包,还要下载https证书,fiddler默认的https证书对ios和android设备不起作用。可能出现弹窗,安装root certificate not successful。所以现在我们需要下载来手动生成证书。双击之后,自动生成证书,然后重新启动fiddler,下载如图所示:
1-5
- 4.要抓取苹果设备的https数据包,必须使fiddler的PC和苹果设备处于同一局域网。小编选择的是在PC上下载WIFI大师,然后用苹果设备连接上PC的WIFI热点。在Fiddler中通过查看PC本机的无线网络IP地址。如图所所标志的红点,例如是192.168.144.1:
1-6
- 5.在苹果设备上连接上WIFI热点,然后设置连接上的WIFI热点的HTTP代理。服务器填写192.168.144.1(即是上一步骤的IP地址),端口即是FIddler默认设置的8888如图所示:
1-7
- 3.完成了上述安装设置之后,FIddler便可以截取设备上的数据包。摩拜单车提供了APP和微信小程序的形式。接下来我们用Fiddler获取摩拜单车小程序的数据包。启动微信小程序摩拜单车,如下图所示:
1-8
{
"code": 0,
"message": "",
"biketype": 0,
"object": [
{
"distId": "8716553834",
"distX": 113.4142452697025,
"distY": 22.4783592035906,
"distNum": 1,
"distance": "41",
"bikeIds": "8716553834#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "7916517766",
"distX": 113.41417330141317,
"distY": 22.47836822434858,
"distNum": 1,
"distance": "45",
"bikeIds": "7916517766#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "7916519370",
"distX": 113.41419828863238,
"distY": 22.478338217567746,
"distNum": 1,
"distance": "46",
"bikeIds": "7916519370#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8716545672",
"distX": 113.41444624074846,
"distY": 22.47924413138211,
"distNum": 1,
"distance": "66",
"bikeIds": "8716545672#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8716024668",
"distX": 113.41460007492316,
"distY": 22.47779710575838,
"distNum": 1,
"distance": "95",
"bikeIds": "8716024668#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8716554099",
"distX": 113.41427520879347,
"distY": 22.477644205805277,
"distNum": 1,
"distance": "114",
"bikeIds": "8716554099#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8620893676",
"distX": 113.4156226249094,
"distY": 22.478363758786166,
"distNum": 1,
"distance": "119",
"bikeIds": "8620893676#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8716533121",
"distX": 113.41536766747214,
"distY": 22.47710986723533,
"distNum": 1,
"distance": "193",
"bikeIds": "8716533121#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8716549326",
"distX": 113.41684593355554,
"distY": 22.47778230097752,
"distNum": 1,
"distance": "259",
"bikeIds": "8716549326#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8620891799",
"distX": 113.41364669427747,
"distY": 22.480952336205316,
"distNum": 1,
"distance": "270",
"bikeIds": "8620891799#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "7916521052",
"distX": 113.41201320576842,
"distY": 22.47972072439544,
"distNum": 1,
"distance": "282",
"bikeIds": "7916521052#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8621236540",
"distX": 113.41201020767474,
"distY": 22.479734724787814,
"distNum": 1,
"distance": "283",
"bikeIds": "8621236540#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8620934431",
"distX": 113.4126610487278,
"distY": 22.480656579073916,
"distNum": 1,
"distance": "292",
"bikeIds": "8620934431#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8716540529",
"distX": 113.41313488560849,
"distY": 22.48081746752051,
"distNum": 1,
"distance": "279",
"bikeIds": "8716540529#",
"biketype": 1,
"type": 0,
"boundary": null
},
{
"distId": "8620846122",
"distX": 113.41152328833927,
"distY": 22.478678827375827,
"distNum": 1,
"distance": "306",
"bikeIds": "8620846122#",
"biketype": 1,
"type": 0,
"boundary": null
}
]
}
- 6.从FIddler获取的数据包可以观察到,摩拜单车获取数据的API地址是。采用是POST的方式获取,需要传递的参数:
1-10