寫爬蟲的時(shí)候,只能需要模擬登錄。有些網(wǎng)站可以直接用POST明文密碼登錄,但有價(jià)值的網(wǎng)站通常會(huì)加密密碼,然后發(fā)送。理解JS加密是必要的。
今天,我們先來看看優(yōu)酷的登錄加密。需要的工具:開發(fā)人員工具所在的瀏覽器、JS調(diào)試工具。我用360瀏覽器和鬼JS調(diào)試工具7.0。是的,首先打開優(yōu)酷,然后打開開發(fā)者工具。
用戶名隨意丟失手機(jī)號(hào)碼的話,密碼是123456。接受吧
你看。倒數(shù)第二個(gè)是登錄請(qǐng)求。點(diǎn)擊是get請(qǐng)求。拖到底部可以看到這個(gè)。
很明顯,密碼是加密的。然后我們搜索了密碼這個(gè)關(guān)鍵詞。
點(diǎn)擊確認(rèn)是否有有效信息,前兩個(gè)發(fā)現(xiàn)沒有有用信息,打開第三個(gè)。
直接Ctrl F搜索password關(guān)鍵字,發(fā)現(xiàn)有79個(gè)。愚蠢的方法是逐個(gè)降低斷點(diǎn)或分析內(nèi)容。
有Loginsubmit。命名上是提交登錄的意思。這里應(yīng)該就是這里。可以在這里下斷點(diǎn)。
我們回到優(yōu)酷登錄界面點(diǎn)擊登錄
網(wǎng)頁被斷下來了,我們看到出現(xiàn)了陰影部分t=””這是變量t的值,我們按下F10繼續(xù)下一步,
被加密的密碼出現(xiàn)了,那么這一行就是加密的過程。我們現(xiàn)在打開JS調(diào)試工具,
提示這個(gè),那我們就來找一下I,把鼠標(biāo)放在上面:
點(diǎn)開這個(gè)function I(e),把相關(guān)的代碼復(fù)制進(jìn)去,運(yùn)行得到
與結(jié)果是一樣的。
Js代碼:
function G(e) {
return Z(Q(X(e)))
}
function Q(e) {
return ee(ie(J(e), 8 * e.length))
}
var ii = 0
function Z(e) {
for (var i, o = ii ? "0123456789ABCDEF" : "0123456789abcdef", t = "", r = 0; r < e.length; r++)
i = e.charCodeAt(r),
t += o.charAt(i >>> 4 & 15) + o.charAt(15 & i);
return t
}
function X(e) {
for (var i, o, t = "", r = -1; ++r < e.length; )
i = e.charCodeAt(r),
o = r + 1 < e.length ? e.charCodeAt(r + 1) : 0,
55296 <= i && i <= 56319 && 56320 <= o && o <= 57343 && (i = 65536 + ((1023 & i) << 10) + (1023 & o),
r++),
i <= 127 ? t += S(i) : i <= 2047 ? t += S(192 | i >>> 6 & 31, 128 | 63 & i) : i <= 65535 ? t += S(224 | i >>> 12 & 15, 128 | i >>> 6 & 63, 128 | 63 & i) : i <= 2097151 && (t += S(240 | i >>> 18 & 7, 128 | i >>> 12 & 63, 128 | i >>> 6 & 63, 128 | 63 & i));
return t
}
function J(e) {
for (var i = Array >> 2), o = 0; o < i.length; o++)
i[o] = 0;
for (var o = 0; o < 8 * e.length; o += 8)
i[o >> 5] |= (255 & e.charCodeAt(o / 8)) << o % 32;
return i
}
function ee(e) {
for (var i = "", o = 0; o < 32 * e.length; o += 8)
i += S(e[o >> 5] >>> o % 32 & 255);
return i
}
function ie(e, i) {
e[i >> 5] |= 128 << i % 32,
e[14 + (i + 64 >>> 9 << 4)] = i;
for (var o = 1732584193, t = -271733879, r = -1732584194, n = 271733878, s = 0; s < e.length; s += 16) {
var a = o
, l = t
, c = r
, d = n;
o = te(o, t, r, n, e[s + 0], 7, -680876936),
n = te(n, o, t, r, e[s + 1], 12, -389564586),
r = te(r, n, o, t, e[s + 2], 17, 606105819),
t = te(t, r, n, o, e[s + 3], 22, -1044525330),
o = te(o, t, r, n, e[s + 4], 7, -176418897),
n = te(n, o, t, r, e[s + 5], 12, 1200080426),
r = te(r, n, o, t, e[s + 6], 17, -1473231341),
t = te(t, r, n, o, e[s + 7], 22, -45705983),
o = te(o, t, r, n, e[s + 8], 7, 1770035416),
n = te(n, o, t, r, e[s + 9], 12, -1958414417),
r = te(r, n, o, t, e[s + 10], 17, -42063),
t = te(t, r, n, o, e[s + 11], 22, -1990404162),
o = te(o, t, r, n, e[s + 12], 7, 1804603682),
n = te(n, o, t, r, e[s + 13], 12, -40341101),
r = te(r, n, o, t, e[s + 14], 17, -1502002290),
t = te(t, r, n, o, e[s + 15], 22, 1236535329),
o = re(o, t, r, n, e[s + 1], 5, -165796510),
n = re(n, o, t, r, e[s + 6], 9, -1069501632),
r = re(r, n, o, t, e[s + 11], 14, 643717713),
t = re(t, r, n, o, e[s + 0], 20, -373897302),
o = re(o, t, r, n, e[s + 5], 5, -701558691),
n = re(n, o, t, r, e[s + 10], 9, 38016083),
r = re(r, n, o, t, e[s + 15], 14, -660478335),
t = re(t, r, n, o, e[s + 4], 20, -405537848),
o = re(o, t, r, n, e[s + 9], 5, 568446438),
n = re(n, o, t, r, e[s + 14], 9, -1019803690),
r = re(r, n, o, t, e[s + 3], 14, -187363961),
t = re(t, r, n, o, e[s + 8], 20, 1163531501),
o = re(o, t, r, n, e[s + 13], 5, -1444681467),
n = re(n, o, t, r, e[s + 2], 9, -51403784),
r = re(r, n, o, t, e[s + 7], 14, 1735328473),
t = re(t, r, n, o, e[s + 12], 20, -1926607734),
o = ne(o, t, r, n, e[s + 5], 4, -378558),
n = ne(n, o, t, r, e[s + 8], 11, -2022574463),
r = ne(r, n, o, t, e[s + 11], 16, 1839030562),
t = ne(t, r, n, o, e[s + 14], 23, -35309556),
o = ne(o, t, r, n, e[s + 1], 4, -1530992060),
n = ne(n, o, t, r, e[s + 4], 11, 1272893353),
r = ne(r, n, o, t, e[s + 7], 16, -155497632),
t = ne(t, r, n, o, e[s + 10], 23, -1094730640),
o = ne(o, t, r, n, e[s + 13], 4, 681279174),
n = ne(n, o, t, r, e[s + 0], 11, -358537222),
r = ne(r, n, o, t, e[s + 3], 16, -722521979),
t = ne(t, r, n, o, e[s + 6], 23, 76029189),
o = ne(o, t, r, n, e[s + 9], 4, -640364487),
n = ne(n, o, t, r, e[s + 12], 11, -421815835),
r = ne(r, n, o, t, e[s + 15], 16, 530742520),
t = ne(t, r, n, o, e[s + 2], 23, -995338651),
o = se(o, t, r, n, e[s + 0], 6, -198630844),
n = se(n, o, t, r, e[s + 7], 10, 1126891415),
r = se(r, n, o, t, e[s + 14], 15, -1416354905),
t = se(t, r, n, o, e[s + 5], 21, -57434055),
o = se(o, t, r, n, e[s + 12], 6, 1700485571),
n = se(n, o, t, r, e[s + 3], 10, -1894986606),
r = se(r, n, o, t, e[s + 10], 15, -1051523),
t = se(t, r, n, o, e[s + 1], 21, -2054922799),
o = se(o, t, r, n, e[s + 8], 6, 1873313359),
n = se(n, o, t, r, e[s + 15], 10, -30611744),
r = se(r, n, o, t, e[s + 6], 15, -1560198380),
t = se(t, r, n, o, e[s + 13], 21, 1309151649),
o = se(o, t, r, n, e[s + 4], 6, -145523070),
n = se(n, o, t, r, e[s + 11], 10, -1120210379),
r = se(r, n, o, t, e[s + 2], 15, 718787259),
t = se(t, r, n, o, e[s + 9], 21, -343485551),
o = ae(o, a),
t = ae(t, l),
r = ae(r, c),
n = ae(n, d)
}
return Array(o, t, r, n)
}
function oe(e, i, o, t, r, n) {
return ae(le(ae(ae(i, e), ae(t, n)), r), o)
}
function te(e, i, o, t, r, n, s) {
return oe(i & o | ~i & t, e, i, r, n, s)
}
function re(e, i, o, t, r, n, s) {
return oe(i & t | o & ~t, e, i, r, n, s)
}
function ne(e, i, o, t, r, n, s) {
return oe(i ^ o ^ t, e, i, r, n, s)
}
function se(e, i, o, t, r, n, s) {
return oe(o ^ (i | ~t), e, i, r, n, s)
}
function ae(e, i) {
var o = (65535 & e) + (65535 & i);
return (e >> 16) + (i >> 16) + (o >> 16) << 16 | 65535 & o
}
function le(e, i) {
return e << i | e >>> 32 - i
}
function test(aa){
return G(aa);
}
1.《優(yōu)酷登錄加密JS分析》援引自互聯(lián)網(wǎng),旨在傳遞更多網(wǎng)絡(luò)信息知識(shí),僅代表作者本人觀點(diǎn),與本網(wǎng)站無關(guān),侵刪請(qǐng)聯(lián)系頁腳下方聯(lián)系方式。
2.《優(yōu)酷登錄加密JS分析》僅供讀者參考,本網(wǎng)站未對(duì)該內(nèi)容進(jìn)行證實(shí),對(duì)其原創(chuàng)性、真實(shí)性、完整性、及時(shí)性不作任何保證。
3.文章轉(zhuǎn)載時(shí)請(qǐng)保留本站內(nèi)容來源地址,http://f99ss.com/gl/3140990.html