Aimaz/AutoRiddle

< Aimaz

Main Page | Recent changes | Random | Special
Edit this page | Page history | Discuss this page
 


Page type: Uncategorised

So you're trying to edit AberWiki and it wants you to solve mathematical riddles. Riddles? I have a computer so I don't need to do riddles. Install this script with greasemonkey and rid yourself of riddles. Alternatively you could just log into the wiki.

[edit] Shizzle that Riddle!

// ==UserScript==
// @name           AutoRiddle
// @namespace      http://www.aberwiki.org/Aimaz/AutoRiddle
// @description    Shizzle that Riddle!
// @include        http://www.aberwiki.org/index.php?title=*&action=submit
// ==/UserScript==
window.addEventListener('load', 
    function() {
        var answer = document.getElementById("wpCaptchaWord")
        var sum = answer.parentNode.getElementsByTagName("label")[0].innerHTML
        answer.value = eval(sum)
        document.getElementById("editform").submit()
    },
    true
);

[edit] See Also

  1. http://diveintogreasemonkey.org/
  2. http://en.wikipedia.org/wiki/Greasemonkey
  3. http://userscripts.org/
  4. http://en.wikipedia.org/wiki/Eval#Security_risks

[edit] Small note

Beware of using eval and similar in other languages. Not usually a huge security risk with javascript. This should be fairly secure assuming that the include represents the pages it can be used with. Very dangerous if used in PHP, perl or otherwise. Also the riddle sums are so simple it wouldn't take much code to write a small parser for them.

Could try:

window.addEventListener('load', 
    function() {
        var solveme=document.getElementById("wpCaptchaWord");        

        if((match=new RegExp("^([0-9]+) ([+-]) ([0-9]+)$").exec(parentNode.getElementsByTagName("label")[0].innerHTML).length==4)
        {
           solveme.value=Integer.parseInt(match[1])+Integer.parseInt(match[3])*(match[2].equals("+")?1:-1);
           document.getElementById("editform").submit()
        }
    },
    true
);

Not tested this but probably works or barely needs any tweaks to get working. Include the same header. Will probably be a tiny bit more secure.

I made the assumption that if an attacker can modify the captcha then they can probably insert javascript anyway. --Aimaz 09:14, 9 January 2008 (GMT)