目標網站
aHR0cDovL3d3dy55bmdwLmNvbS8=
1.呈現狀態
2.分析網站
先複製請求連結的curl看看列印出的結果
列印出的結果不正常,來看看請求頭,裡面有一個'$Cookie',轉場到請求連線的cookies中看看,xincaigou這個值大概就是我們想要的
往上看其他請求,找xincaigou從哪冒出來,在第二個連結請求時由伺服器返回
第二個連結請求,需要第一個連結請求時重定向給它
3.獲取answer
先無引數請求第一個連結,得到下圖將eval函式複製到指令碼片段中,打上斷點,並在控制檯中列印出引數p的值
複製p值到js指令碼中將‘\\’換成‘\’,如下
var _$ = ['\x23\x63\x68\x61\x6c\x6c\x65\x6e\x67\x65',
'\x23\x77\x61\x66\x5f\x61\x6e\x73\x77\x65\x72', '\x23\x43\x68\x61\x6c\x6c\x65\x6e\x67\x65\x46\x6f\x72\x6d'
];
$(_$[0])["\x73\x68\x6f\x77"]();
$(function () {
setTimeout(function () {
var x06dd1a = {};
var x0fcad9;
var x08c924 = 0x0f;
var x01c264 = navigator["\x75\x73\x65\x72\x41\x67\x65\x6e\x74"]["\x74\x6f\x4c\x6f\x77\x65\x72\x43\x61\x73\x65"]();
x08c924 = x08c924 * 0x1d;
(x0fcad9 = x01c264["\x6d\x61\x74\x63\x68"](/msie ([\d.]+)/)) ? x06dd1a["\x69\x65"] = x0fcad9[0x1]
: (x0fcad9 = x01c264["\x6d\x61\x74\x63\x68"](/firefox\/([\d.]+)/))? x06dd1a["\x66\x69\x72\x65\x66\x6f\x78"] = x0fcad9[0x1]
: (x0fcad9 = x01c264["\x6d\x61\x74\x63\x68"](/chrome\/([\d.]+)/))? x06dd1a["\x63\x68\x72\x6f\x6d\x65"] = x0fcad9[0x1]
: (x0fcad9 = x01c264["\x6d\x61\x74\x63\x68"](/opera.([\d.]+)/)) ? x06dd1a["\x6f\x70\x65\x72\x61"] = x0fcad9[0x1]
: (x0fcad9 = x01c264["\x6d\x61\x74\x63\x68"](/version\/([\d.]+).*safari / ))? x06dd1a["\x73\x61\x66\x61\x72\x69"] = x0fcad9[0x1]
: 0x0;
x08c924 = x08c924 + 0x63;
if (x06dd1a["\x69\x65"] || x06dd1a["\x66\x69\x72\x65\x66\x6f\x78"] || x06dd1a["\x63\x68\x72\x6f\x6d\x65"] || x06dd1a["\x6f\x70\x65\x72\x61"] || x06dd1a["\x73\x61\x66\x61\x72\x69"]) {
x08c924 = (x08c924 * 0x3 + 0x7);
if (x08c924 < 0x7b) x08c924 = x08c924 + 0x929;
var x0b515d = $(_$[1]);
if (x08c924 > 0x929) x08c924 = Math["\x66\x6c\x6f\x6f\x72"](x08c924 / 0x7b);
x0b515d["\x76\x61\x6c"](x08c924);
$(_$[2])["\x73\x75\x62\x6d\x69\x74"]()
}
}, 0x3e8)
});
再將上面程式碼複製到AST中去解碼
var _$ = ["#challenge", "#waf_answer", "#ChallengeForm"];
$(_$[0])["show"]();
$(function () {
setTimeout(function () {
var x06dd1a = {};
var x0fcad9;
var x08c924 = 15;
var x01c264 = navigator["userAgent"]["toLowerCase"]();
x08c924 = x08c924 * 29;
(x0fcad9 = x01c264["match"](/msie ([\d.]+)/)) ? x06dd1a["ie"] = x0fcad9[1] : (x0fcad9 = x01c264["match"](/firefox\/([\d.]+)/)) ? x06dd1a["firefox"] = x0fcad9[1] : (x0fcad9 = x01c264["match"](/chrome\/([\d.]+)/)) ? x06dd1a["chrome"] = x0fcad9[1] : (x0fcad9 = x01c264["match"](/opera.([\d.]+)/)) ? x06dd1a["opera"] = x0fcad9[1] : (x0fcad9 = x01c264["match"](/version\/([\d.]+).*safari /)) ? x06dd1a["safari"] = x0fcad9[1] : 0;
x08c924 = x08c924 + 99;
if (x06dd1a["ie"] || x06dd1a["firefox"] || x06dd1a["chrome"] || x06dd1a["opera"] || x06dd1a["safari"]) {
x08c924 = x08c924 * 3 + 7;
if (x08c924 < 123) {
x08c924 = x08c924 + 2345;
}
var x0b515d = $(_$[1]);
if (x08c924 > 2345) {
x08c924 = Math["floor"](x08c924 / 123);
}
x0b515d["val"](x08c924);
$(_$[2])["submit"]();
}
}, 1000);
});
然後再複製解碼後的程式碼到js指令碼中,刪掉有關JQuery的操作,反覆測試,找到需要傳參的值,再刪掉其他無用程式碼,最後形成如下程式碼
function get_answer(a, b, c) {
a = a * b;
a = a + c;
a = a * 3 + 7;
if (a < 123) { a = a + 2345;}
if (a > 2345) {a = Math["floor"](a / 123);}
return a
}
將圖中三個引數轉化一下傳入get_answer中便會得到answer
4.獲取xincaigou
帶上引數answer請求第一個連結便可以獲取到伺服器返回的xincaigou,期間保持會話維持,將cookies的值更新到session中,請求資料連結就可以得到答案