SHARE
TWEET

Untitled

a guest May 25th, 2016 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function curl($url,$post=""){
  4.  
  5.     //echo $url;
  6.     $c=curl_init();
  7.     curl_setopt($c, CURLOPT_URL, $url);
  8.     curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0');
  9.     curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
  10.     curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
  11.     curl_setopt($c, CURLOPT_TIMEOUT, 35);
  12.     curl_setopt($c, CURLOPT_COOKIEJAR, './cookies/test.txt');
  13.     curl_setopt($c, CURLOPT_COOKIEFILE, './cookies/test.txt');
  14.     //curl_setopt($c, CURLOPT_PROXY, 'socks5://localhost:9999');
  15.     if($post!=""){
  16.         curl_setopt($c, CURLOPT_POST, 1);
  17.         curl_setopt($c, CURLOPT_POSTFIELDS, $post);
  18.     }
  19.     curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  20.     $rez=curl_exec($c);
  21.  
  22.     return $rez;
  23.  
  24. }
  25. $rez=curl('http://site.com/login.php');
  26. file_put_contents('page_1.html', $rez);
  27. preg_match_all("/var.*=\"\";var .*=\"(.*?)\"/", $rez, $m); //Cautam carnatu` de hex
  28. $unhexed = pack('H*', $m[1][1]); //unhex
  29.  
  30. echo $unhexed;//debug
  31. preg_match_all('/"GET","\/_Incapsula_Resource\?SWHANEDL=(.*?)"/', $unhexed, $m); //Cautam codul acela
  32. var_dump($m); //debug
  33.  
  34. $rez=curl('http://site.com/_Incapsula_Resource?SWHANEDL='.$m[1][0]); //Facem un request cu acel cod dupa acest request ar trebui sa avem cookie-urile potrivite
  35. file_put_contents('page_2.html', $rez);
  36.  
  37. $rez=curl('http://site.com/login.php'); //pagina initiala
  38.  
  39. file_put_contents('page_3.html', $rez);
  40. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top