-
-
Save os0x/58f4bd47dbee20d1b950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function solve(src) { | |
var _src = src.split('<script>'); | |
var text = _src[1] && _src[1].match(/\[[^\]]+\]/); | |
if (!text) return console.log(src); | |
var list = JSON.parse(text); | |
var answer = new Array(list.length); | |
list.forEach(function(item, i){ | |
if (answer[i]) return; | |
var f = list.indexOf(item, i+1); | |
if (f !== -1) { | |
answer[i] = f; | |
answer[f] = i; | |
} | |
}); | |
var form=document.getElementById('solve'); | |
var x = new XMLHttpRequest(); | |
x.open(form.method, form.action, true); | |
x.onload = function(){ | |
setTimeout(function(){ | |
solve(x.responseText); | |
}, 1000); | |
}; | |
x.onerror = function(){ | |
console.log(x); | |
}; | |
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); | |
x.send('answer='+answer.join(',')); | |
} | |
solve(document.documentElement.innerHTML); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment