Advertisement
opsftw

TrafficGen

May 29th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.39 KB | None | 0 0
  1. #!/usr/bin/php
  2. <?php /* Traffic Genorator by Tux. */ ?>
  3. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  4. * ___________              _____  _____.__                   ________                 *
  5. * \__    ___/___________ _/ ____\/ ____\__| ____            /  _____/  ____   ____    *
  6. *   |    |  \_  __ \__  \\   __\\   __\|  |/ ___\   ______ /   \  ____/ __ \ /    \   *
  7. *   |    |   |  | \// __ \|  |   |  |  |  \  \___  /_____/ \    \_\  \  ___/|   |  \  *
  8. *   |____|   |__|  (____  /__|   |__|  |__|\___  >          \______  /\___  >___|  /  *
  9. *                       \/                     \/                  \/     \/     \/   *
  10. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  11. <?php
  12. error_reporting(0);
  13. require('traffic_files/ua.php');
  14.  
  15. # URL declaration
  16. $url = cin('* Enter the URL: ');
  17.  
  18. # Referer Declaration
  19. $ref = cin('* Referer URL: ');
  20.  
  21. # Times to visit Declaration
  22. $times  = cin('* Number of times to visit: ');
  23.  
  24. $origeonal = $times;
  25. $num       = 1;
  26. $good      = 0;
  27. $bad       = 0;
  28. echo "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n";
  29. echo "* Firing the lasers...                                                                *\n";
  30. echo "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n";
  31. while($times != 0) {
  32.     $ua      = random_user_agent();
  33.     $proxy   = rand_proxy();
  34.     $curl = curl_init($url);
  35.     curl_setopt($curl, CURLOPT_PROXY, $proxy);
  36.     curl_setopt($curl, CURLOPT_USERAGENT, $ua);
  37.     curl_setopt($curl, CURLOPT_URL, $url);
  38.     curl_setopt($curl, CURLOPT_FAILONERROR, true);
  39.     curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  40.     curl_setopt($curl, CURLOPT_AUTOREFERER, true);
  41.     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  42.     $result = curl_exec($curl);
  43.     curl_close($curl);
  44.     if($result) {
  45.         $str = "* $num. $proxy";
  46.         $c   = 86 - strlen($str);
  47.         while($c != 0) {
  48.             $str = "$str ";
  49.             $c   = $c-1;
  50.         }
  51.         echo "$str*\n";
  52.         $good++;
  53.     } else {
  54.         $str = "* $num. There was an error...";
  55.         $str = box_in($str);
  56.         echo "$str*\n";
  57.         $bad++;
  58.     }
  59.     $num++;
  60.     $times = $times - 1;
  61. }
  62. $rate = $good / $origeonal;
  63. $str  = "* \n* Success rate: $rate";
  64. $str  = box_in($str);
  65. echo "$str*\n";
  66. echo "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n";
  67.  
  68.  
  69. function rand_proxy() {
  70.     $html        = file_get_contents('http://localhost/proxyapi/api.php?type=google');
  71.     $proxies     = explode("\n", $html);
  72.     $key         = rand(0,25);
  73.     $proxy       = $proxies[$key];
  74.     while(!check_proxy($proxy)) {
  75.         $key         = rand(0,25);
  76.         $proxy       = $proxies[$key];
  77.     }
  78.     return $proxy;
  79. }
  80.  
  81. function cin($prompt='') {
  82.     echo $prompt;
  83.     $handle = fopen("php://stdin","r");
  84.     return fgets($handle);
  85. }
  86.  
  87. function box_in($string) {
  88.     $c   = 86 - strlen($string);
  89.     while($c != 0) {
  90.         $string = "$string ";
  91.         $c   = $c-1;
  92.     }
  93.     return $string;
  94. }
  95.  
  96. function check_proxy( $proxy /* ip:port */ ) {
  97.     $proxy = explode(':', $proxy);
  98.     $ch = curl_init('http://api.proxyipchecker.com/pchk.php');
  99.     curl_setopt($ch, CURLOPT_POST, 1);
  100.     curl_setopt($ch, CURLOPT_POSTFIELDS,'ip='.$proxy[0].'&port='.$proxy[1]);
  101.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  102.     curl_setopt($ch, CURLOPT_HEADER, 0);
  103.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  104.     $res = explode(';', curl_exec($ch));
  105.     return ($res[0]==false)?false:true;
  106. }
  107. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement