function escape(input) {
//100分
//热个身:不能更简单了!
input = input.replace(/script/g, '_');
return input;
}
function escape(input) {
//200分
//嗯,要成为一名合格的Xsser必须要掌握基础的Javascript
input = input.replace(/[&+!>\\]|tring|val|set|lert/gi, '_');
return '<challenge1>' + input + '</challenge1>';
}
function escape(input) {
//200分
//跨过的人都知道这很常见!
input = input.replace(/mbed|cript|on.+=/ig, '_');
input = input.split('#');
var output = '';
for (var i in input) {
output += '\n<split id="undefined" name="' + input[i].slice(0, 12) + '">'
}
return output;
}
function escape(input) {
//200分
//ben总经常教导Xsser:知识面要广
//小考验,并不难
input = input.replace(/on.+?=|>/gi, "_");
if(input.split('"').length > 2){
return '';
}
else{
return '<embed allowscriptaccess=always src="http://mall.aliapp.com/prompt.swf'+input+'"></embed>';
}
}
function escape(input) {
//200分
//据说从这题开始,做题的姿势要很猥琐才能 PASS
input = input.replace(/[!&+'">\\]|tring|lert/gi, '_');
return '<challenge2>' + input + '</challenge2>';
}
function escape(input) {
//300分
//跨站跨的好,技巧少不了!
input = input.replace(/[=\(]|28|40|->/g, '_');
return '<!--' + input;
}
function escape(input) {
//300分
//乱花渐欲迷人眼..
var evil = function (str, callback) {
if(str.length < 15) {
if(str.length < 10)
callback(null, str.length)
else callback(null, str)
}
else callback('len error');
}
var i = -8;
input = input.replace(/[^a-zA-Z1-9()']/ig, '');
setTimeout(evil(input, function (e, r) {
i += r;
setTimeout(evil(input, function (r, e) {
i += r;
}), 1000);
}), 1000);
return '<script>alert(\'' + i + '\')</script> ';
}
function escape(input) {
//300分
//学会了见缝插针,字符数限制神马的都是浮云
input = input.replace(/[<>]/ig, '');
var a = input.match(/onerror/ig);
var b = input.match(/'/ig)?
input.match(/'/ig).length
:0
;
var c = input.length;
if ( (a || (b != 4) || c) > 1 && (a || (b != 4) || c) <= 30 ) {
return '<img src=\'' + input + '\>';
}
else {
return 'invalid input';
}
}
function escape(input) {
//300分
//如果你通过了前面所有关卡,那么恭喜你,你已经掌握了跨站的基本姿势
//接下来用这题证明你走向猥琐流的决心
input = input.split('#');
input[0] = input[0].replace(/[5-9!&+'">\\\/]/g, '_');
input[0] = input[0].replace(/lert|op|rent|tion|cat/gi, '_');
input[1] = input[1].replace(/[^0-9]/g, '_');
return '<challengeX>' + input[0] + '</challengeX>' + input[1];
}
function escape(input) {
//300分
//检验自己是否是一名合格的Xsser的绝好机会!
input = input.replace(/[%!&+'">\\\/]/g, '');
input = input.replace(/tring|lert|ncat/gi, '_');
return '<challengeS>' + input + '</challengeS>';
}
function escape(input) {
//300分
//成为一名Xsser总是要走不少弯路
//但有什么比自己尝试出来更开心呢
try {
input = input.replace(/=/ig, '').replace(/cr.pt/ig, '$\'');;
input = input.match(/<script>.*</script> /)[0];
input = input.replace(/>/g, '');
return input;
}
catch(e) {
input = input.replace(/script/ig, '').toUpperCase().toLowerCase();
return 'error: ' + input;
}
}
function escape(input) {
//300分
//浏览器都说崩溃了!T.T
input = input.replace(/[!&%'">\\\/]/g, '');
input = input.replace(/tring|tion|op|rent|ner|lert/gi, '_');
return '<alert>' + input + '</alert>';
}
function escape(input) {
//400分
//过滤得一点都不多。。
input = input.replace(/[;\\\/<>a-zA-Z]/g, "_").slice(0,1500);
return "<script>[][([![]]+[])[++[++[++[[]][+[]]][+[]]][+[]]]+([]+{})[++[[]][+[]]]+([!![]]+[])[++[[]][+[]]]+([!![]]+[])[+[]]]"+input+"</script> ";
}
function escape(input) {
//400分
//当你回过头来发现自己跑到了这么远,你已经成功了
//再努力一一点就做出来了!
input = input.replace(/[\\'"]/g, '\\$&');
return "<embed name='lso' allowscriptaccess=always " +
"src=http://mall.aliapp.com/lso.swf " +
"type='application/x-shockwave-flash'><\/embed>" +
"<script>" +
"setTimeout(\"document['lso'].save('" + input +
"');document['lso'].read()\", 1000);" +
"</script> ";
}
function escape(input) {
//500分
//字幕君看到了这么长的代码选择了闭嘴
var p = new DOMParser();
var ret = p.parseFromString(input, 'text/html');
var buffer = ret.body;
buffer.innerHTML = input;
// remove script
filterDom(buffer, 'script', processScript);
// remove frame
filterDom(buffer, 'iframe', processFrame);
filterDom(buffer, 'frame', processFrame);
// remove plugin
filterDom(buffer, 'embed', processEmbed);
filterDom(buffer, 'object', processObject);
filterDom(buffer, 'applet', processApplet);
return '<script src=/game/xss/hook.js></script> ' + buffer.innerHTML;
function filterDom(container, tag, callback) {
var arr = container.getElementsByTagName(tag);
for (var i = arr.length - 1; i >= 0; i--) {
callback(arr[i]);
}
}
function processScript(el) {
el.type = 'text/template';
}
function processFrame(el) {
el.sandbox = '';
}
function processEmbed(el) {
el.setAttribute('type', 'application/x-shockwave-flash');
el.setAttribute('allowScriptAccess', 'never');
}
function processObject(el) {
var arr = el.getElementsByTagName('param');
if (arr.length == 0) {
processEmbed(el);
}
else {
var found;
for (var i = arr.length - 1; i >= 0; i--) {
var param = arr[i];
if (/allowScriptAccess/i.test(param.name)) {
el.removeChild(param);
found = true;
}
}
if (!found) {
var param = document.createElement('param');
param.name = 'allowScriptAccess';
param.value = 'never';
newNode.appendChild(param);
}
}
var newNode = el.cloneNode(true);
el.parentNode.replaceChild(newNode, el);
}
function processApplet(el) {
el.parentNode.removeChild(el);
}
}