Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Pragma-directive: no-cache");
- header("Cache-directive: no-cache");
- header("Cache-control: no-cache");
- header("Pragma: no-cache");
- header("Expires: 0");
- $userid = '832960'; // User id from cookie
- $password = ''; // Password from cookie
- function encodeURIComponent($str) {
- $revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
- return strtr(rawurlencode($str), $revert);
- }
- function CURL($url, $settings = null, $posts = null, $cookies = null, $cb = null) // Renew function to a class (for default cookies/ and others)
- {
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_TIMEOUT, 20);
- if (!empty($settings) && is_array($settings))
- {
- curl_setopt_array($curl, $settings);
- }
- if (!empty($posts) && is_array($posts))
- {
- $postsdata = http_build_query($posts);
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $postsdata);
- }
- if (!empty($cookies) && is_array($cookies))
- {
- $cookiesdata = http_build_query($cookies, null, ';');
- curl_setopt($curl, CURLOPT_COOKIE, $cookiesdata);
- }
- $data = curl_exec($curl);
- if (is_callable($cb))
- {
- $cb($curl, $data);
- }
- curl_close($curl);
- return $data;
- }
- if (!empty($_SERVER['HTTP_REFERER']))
- {
- $cookie_file = './rz_cookies.cjar';
- $referer_cookies = array();
- $referer_page = CURL(
- $_SERVER['HTTP_REFERER'], // referer
- array(
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_HEADER => true,
- CURLOPT_COOKIEJAR => $cookie_file,
- CURLOPT_COOKIEFILE => $cookie_file,
- CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
- ),
- null,
- array(
- 'rz_userid' => $userid,
- 'rz_password' => $password
- ),
- function($curl, $content) use ($referer_cookies) {
- $header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
- $headers = substr($content, 0, $header_size);
- if (preg_match_all('/Set-Cookie:(?<cookie>\s{0,}.*)$/im', $content, $cookies))
- {
- foreach ($cookies['cookie'] as $cookie)
- {
- preg_match('/(?P<name>[^=]*)=(?P<value>[^;]*)(.*?expires=(?P<expires>[^;]*)|).*?path=(?P<path>[^;]*).*?domain=(?P<domain>[^\s;]*).*?$/im', $cookie, $match);
- $referer_cookies[$match['name']] = $match['value'];
- }
- }
- }
- );
- if (preg_match('/content.incapsula.com\/jsTest.html/', $referer_page))
- {
- header('X-Debug-Validate: 0');
- // request validation simulation start \\
- // PART #1 \\
- $incap_test_result = 'navigator%3Dobject,navigator.vendor%3DGoogle%20Inc.,opera%3DReferenceError%3A%20opera%20is%20not%20defined,ActiveXObject%3DReferenceError%3A%20ActiveXObject%20is%20not%20defined,navigator.appName%3DNetscape,plugin%3Ddll,webkitURL%3Dfunction,navigator.plugins.length%3D%3D0%3Dfalse,_phantom%3DReferenceError%3A%20_phantom%20is%20not%20defined'; // Google Chrome Versie 40.0.2214.111 m localhost result
- $incap_session_cookies = array_filter($referer_cookies, function($v, $key) {
- return preg_match('/^incap_ses_/', $key);
- });
- if (empty($incap_session_cookies))
- {
- header('X-Debug-Validate: 1');
- exit;
- }
- $incap_session_cookies = array_values($incap_session_cookies);
- $digests = array_fill(0, count($incap_session_cookies), 'undefined');
- for ($i = 0; $i < $incap_session_cookies; $i++)
- {
- $result = 0;
- $data = $incap_test_result + $incap_session_cookies[$i];
- for ($j = 0; $j < strlen($data); $j++)
- {
- $result += ord($data[$j]);
- }
- $digests[i] = $result;
- }
- $incap_test_result = $incap_test_result . ',digests=' . implode(',', $digests);
- if (!preg_match('/document\.createElement\("img"\)\.src\="(.*)+"\+Math\.random\(\)/', $referer_page, $match))
- {
- header('X-Debug-Validate: 2');
- exit;
- }
- $resource = $match[1];
- header('X-Debug-Resource: ' . $resource);
- CURL(
- 'http://forum.ragezone.com' . $resource . time(),
- array(
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT']
- ),
- null,
- array(
- '___utmvc' => $incap_test_result
- )
- );
- // request http://forum.ragezone.com/_Incapsula.... with encoded cookie + incap_ses cookie
- // PART #2 \\
- if (!preg_match('/var b="(.*)+";/', $referer_page, $match))
- {
- header('X-Debug-Validate: 3');
- exit;
- }
- $hexdata = $match[1];
- $js_code = '';
- for ($i = 0; $i < strlen($hexdata); $i += 2)
- {
- $hex = substr($hexdata, $i, $i + 2);
- $js_code .= chr(hex2dec($hex));
- }
- $timing = ['s:5','c:10','r:15'];
- $status = 'complete';
- // onunload url
- if (!preg_match('/document\.createElement\("img"\)\.src="(.*)+"\+encodeURIComponent\(/', $js_code, $match))
- {
- header('X-Debug-Validate: 4');
- exit;
- }
- $onunload_url = $match[1] . encodeURIComponent($status . '(' . implode(',', $timing) . ')');
- if (!preg_match('/xhr\.open\("GET","(.*)+",false\);/', $js_code, $match))
- {
- header('X-Debug-Validate: 5');
- exit;
- }
- $xhr_url = $match[1];
- // PART #3 \\
- CURL(
- 'http://content.incapsula.com/jsTest.html',
- array(
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT']
- )
- );
- // PART #4 \\
- CURL(
- $xhr_url,
- array(
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT']
- )
- );
- sleep(15);
- CURL(
- $onunload_url,
- array(
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT']
- )
- );
- //header('Location: https://www.jospiek.nl/image.php');
- //exit;
- $referer_page = CURL(
- $_SERVER['HTTP_REFERER'], // referer
- array(
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_COOKIEJAR => $cookie_file,
- CURLOPT_COOKIEFILE => $cookie_file,
- CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT']
- ),
- null,
- array(
- 'rz_userid' => $userid,
- 'rz_password' => $password
- )
- );
- // request referer page again!
- }
- else
- {
- header('X-Debug-Validate: -1');
- }
- }
- else
- {
- $referer_page = 'x]';
- }
- header('X-Debug: 0');
- header('Content-Type: image/png');
- if (preg_match('/\/\/forum.ragezone.com\/f/', $_SERVER['HTTP_REFERER']) && preg_match('/<ol class="commalist">/', $referer_page))
- {
- header('X-Debug: 1');
- $usernames = array();
- if (preg_match_all('/<li><a class="username" href="http:\/\/forum\.ragezone\.com\/members\/[0-9]+\.html">(.*?)<\/a>(, |\+, |)<\/li>/', $referer_page, $matches))
- {
- foreach ($matches[1] as $username)
- {
- $username = str_replace(' ', '', strip_tags($username));
- array_push($usernames, $username);
- }
- }
- $im = imagecreatetruecolor(400,100);
- $almostblack = imagecolorallocate($im,254,254,254);
- imagefill($im,0,0,$almostblack);
- $black = imagecolorallocate($im,0,0,0);
- $white = imagecolorallocate($im,255,255,255);
- $xd = imagecolorallocate($im,50,51,4);
- imagecolortransparent($im,$almostblack);
- imagettftext($im, 10, 0, 10, 20, $black, './arial.ttf', "People on this thread: \r\n" . chunk_split(implode(', ', $usernames), 60));
- imagepng($im);
- imagedestroy($im);
- }
- else
- {
- echo file_get_contents('http://www.shedworx.com/files/images/error.png');
- }
- // Generate the PHPGD image!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement