首先打开帐号密码登录主页,https://passport.58.com/login,打开开发者工具(F12),开始抓包。
1、随便输入帐号密码,错误的哦。看到一个dologin的提交包。
点击查看提交数据。https://passport.58.com/58/login/pc/dologin 提交方式:post
// 提交协议头 start---
accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
accept-language:zh-CN,zh;q=0.9
cache-control:no-cache
content-type:application/x-www-form-urlencoded
origin:https://passport.58.com
referer:https://passport.58.com/login/?path=https%3A//gz.58.com/&PGTID=0d100000-0000-3844-e7bb-ba38c56e89aa&ClickID=2
user-agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
// 提交协议头 end---
//提交数据
经过分析,重要的只有username 用户名, password 密码,token 、 fingerprint这几个参数。
那么开始找了,ctrl + shift + f 全局搜索。复制 password 粘贴,回车后发现好多,那么 在后面加个 password= 号 这样过滤出来的只有两条,我们看带login的,点击进去,格式化,搜索。
搜索 password = 只有两个结果。全部下断点。再次输入帐号密码,点击登录,会断下来。
查看一下数据。最好记录下来,待会好对比。
鼠标放到 n.encrypt 函数上需要选中后,进入函数内部看一下。
e.prototype.encrypt = function(e, t, n) {
var i = this
, r = 1411093327735 - (new Date).getTime()
, o = (new Date).getTime() + r;
return t && (i.rsaExponent = t),
n && (i.rsaModulus = n),
encryptString(o + encodeURIComponent(e), i.rsaExponent, i.rsaModulus)
}
在 encryptString 位置 下断点。分析这里,o在上面定义了,e就是密码,rsaExponent就是固定的"010001" ,rsaModulus就是 key ,值为:"008baf14121377fc76eaf7794b8a8af17085628c3590df47e6534574efcfd81ef8635fcdc67d141c15f51649a89533df0db839331e30b8f8e4440ebf7ccbcc494f4ba18e9f492534b8aafc1b1057429ac851d3d9eb66e86fce1b04527c7b95a2431b07ea277cde2365876e2733325df04389a9d891c5d36b7bc752140db74cb69f"
在跟进去,全部复制出来调用即可。
复制出来后,自己在下面新写一个function 调用即可,调用函数如下:
function getpwd(pwd)
{
var r = 1411093327735 - (new Date).getTime()
, o = (new Date).getTime() + r;
return encryptString(o + encodeURIComponent(pwd), "010001" , "008baf14121377fc76eaf7794b8a8af17085628c3590df47e6534574efcfd81ef8635fcdc67d141c15f51649a89533df0db839331e30b8f8e4440ebf7ccbcc494f4ba18e9f492534b8aafc1b1057429ac851d3d9eb66e86fce1b04527c7b95a2431b07ea277cde2365876e2733325df04389a9d891c5d36b7bc752140db74cb69f")
}
运行结果如下:
接下来我们开始找 fingerprint ,搜索即可:
看到是在cookie里获取finger_session的值。那么我们就清楚了。可以直接写代码了。