Created
December 23, 2018 14:12
-
-
Save 0xiso/b4345e3a3d6d535b389cde103ec332bf to your computer and use it in GitHub Desktop.
松島Extension
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
(() => { | |
if (document.body.innerText.indexOf('あそびすぎ') != -1) { | |
console.log('あそびすぎ') | |
setTimeout(function () { | |
location.reload() | |
}, 1000); | |
return | |
} | |
if (document.body.innerText.indexOf('502 Bad Gateway') != -1) { | |
console.log('502 Bad Gateway') | |
setTimeout(function () { | |
location.reload() | |
}, 1000); | |
return | |
} | |
if (document.body.innerText.indexOf('残念!') != -1) { | |
console.log('残念!') | |
document.querySelector('body > div > main > div > div > form > div:nth-child(3) > div > input').click() | |
return | |
} | |
if (document.body.innerText.indexOf('SECCON') != -1) { | |
console.log(document.body.innerText) | |
alert('flag found') | |
return | |
} | |
function getfilenum(num) { | |
return document.querySelector(`body > div > main > div > div > form > div:nth-child(2) > div:nth-child(${num}) > img`).src.split('/').pop().split('.')[0] | |
} | |
function getcardnum(num) { | |
return Math.floor(num / 4) + 2 | |
} | |
function mode(array) { | |
if (array.length == 0) | |
return null; | |
var modeMap = {}; | |
var maxEl = array[0], maxCount = 1; | |
for (var i = 0; i < array.length; i++) { | |
var el = array[i]; | |
if (modeMap[el] == null) | |
modeMap[el] = 1; | |
else | |
modeMap[el]++; | |
if (modeMap[el] > maxCount) { | |
maxEl = el; | |
maxCount = modeMap[el]; | |
} | |
} | |
return maxEl; | |
} | |
function check(num) { | |
document.querySelector(`body > div > main > div > div > form > div:nth-child(3) > div:nth-child(${num}) > input[type="checkbox"]`).checked = true | |
console.log('checked', num) | |
} | |
let fnum = [getfilenum(1), getfulenum(2), getfulenum(3), getfulenum(4), getfulenum(5)] | |
let cnum = fnum.map(getcardnum) | |
m = mode(cnum) | |
console.log(fnum, cnum, m) | |
if (cnum[0] != m) check(1) | |
if (cnum[1] != m) check(2) | |
if (cnum[2] != m) check(3) | |
if (cnum[3] != m) check(4) | |
if (cnum[4] != m) check(5) | |
document.querySelector('body > div > main > div > div > form > div:nth-child(4) > div > input.btn.btn-success').click() | |
})() |
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
{ | |
"name": "Getting Started Example", | |
"version": "1.0", | |
"description": "Build an Extension!", | |
"manifest_version": 2, | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"http://matsushima.pwn.ja.seccon/play*", | |
"http://matsushima.pwn.ja.seccon/draw" | |
], | |
"js": [ | |
"contentScript.js" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment