Hi Monks,
I have written simple bruteforcer, as a solve to one javascript challenge
function Check(checksum) { var tab = " azertyuiopqsdfghjklmwxcvbnAZERTYUIOP +QSDFGHJKLMWXCVBN0123456789_$&#@"; var entry = document.forms[1].elements[0].value; var n = entry.length; var sum = 1; for(var i=0;i<n;i++) { var index = tab.indexOf(entry.substring(i,i+1)); sum = sum+(index*n*i)*(index*i*i); } if(sum==checksum) { window.location = entry+".php"; } else { alert("Wrong Pass!! Try Again."); } return false; }
the password equal to the checksum can't be longer then 20 characters, and the checksum tested is 88692589. Anyway I wrote a simple bruteforcer, however i've got no results so far... Here is the code:
$a = '@'; $b = '@'; $c = '@'; $e = '@'; $f = '@'; $g = '@'; $h = '@'; $j = '@'; $k = '@'; $l = '@'; $m = '@'; $p = '@'; $o = '@'; $r = '@'; $s = '@'; $t = '@'; $u = '@'; foreach $r ('a'..'z','A'..'Z','1'..'9','_','$','&','$','#','@',' ') { foreach $s ('a'..'z','A'..'Z','1'..'9','_','$','&','$','#','@',' ' +) { foreach $t ('a'..'z','A'..'Z','1'..'9','_','$','&','$','#','@' +,' ') { $tab = " azertyuiopqsdfghjkl +mwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN0123456789_\$\&\#\@"; $entry = $a . $b . $c . $o . $r . $s . $t; $n = length $entry; $sum = 1; $checksum = 88692589; for($i = 0; $i<$n; $i++) { $index1 = index ( $tab, $sub = su +bstr($entry, $i, 1)); $sum = $sum+($index1 * $n * $i)*($ +index1 * $i * $i); } print "$entry $sum $checksum\n"; if ($sum == $checksum) { print "Got one!\n"; print "password == $entry\n"; die; } } }
It's not the whole code, but I just repeat the same block and add characters to the $entry variable.
any ideas why it doesn't work?
Thanks for any reply
clone

In reply to Simple Bruteforcer not working by clone4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.