Code :<?php //**************************************************************************************************** //**************************************************************************************************** //*** *** //*** permet le transfer d un serveur de jeux au serveur Http *** //*** utilise un connexion FTP vias PHP *** //*** Donc il est necessaire de donner le login et le pass (risque donc le Hack ) *** //*** *** //*** intere aussi la notion de Bzip2 ( system de compression compatible zip *** //*** fort pratique pour hl2 et ses mods *** //*** *** //*** a place dans le repertoir http/Mirror *** //*** *** //*** ex: *** //*** site ftp site web *** //*** /logs /logs/index.php (pour liste les fichier du site ftp ) *** //*** *** //*** *** //*** *** //*** *** //*** *** //*** *** //*** *BAD-BOYS* | Cleaner (oY0) *** //*** bad.boys.tream@gmail.org *** //**************************************************************************************************** //**************************************************************************************************** //**************************************************************************************************** //****************************************************************************************************
$ftp_server = 'ftp.votreFTP.net'; $ftp_user_name = 'server *****'; $ftp_user_pass = ******; $dir_game = "/games/halflife_source/cstrike";
$monrepwww = "/www"; // sv_downloadurl http://votresite.com/cstrike/ //$monrepwww = "/www/cstrike"; // sv_downloadurl http://votresite.com/www/cstrike/ //$monrepwww = "/www"; // sv_downloadurl
//**************************************************************************************************** //****************************************************************************************************
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <body bgcolor = "#E3E2F5"> <A Href ="..">____________</A><Br> ';
$phpver = phpversion(); if ($phpver >= '4.0.4pl1' && strstr($HTTP_USER_AGENT,'compatible')) { if (extension_loaded('zlib')) { ob_end_clean(); ob_start('ob_gzhandler'); } } else if ($phpver > '4.0') { if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) { if (extension_loaded('zlib')) { $do_gzip_compress = TRUE; ob_start(); ob_implicit_flush(0); //header('Content-Encoding: gzip'); } } }
$phpver = explode(".", $phpver); $phpver = "$phpver[0]$phpver[1]"; if ($phpver >= 41) { $PHP_SELF = $_SERVER['PHP_SELF']; }
if (!ini_get("register_globals")) { import_request_variables('GPC'); }
############################################################# #--------------- Base64 sanitize by Waraxe ----------------- if(isset($admin)) { $admin = base64_decode($admin); $admin = addslashes($admin); $admin = base64_encode($admin); }
if(isset($user)) { $user = base64_decode($user); $user = addslashes($user); $user = base64_encode($user); } #############################################################
if (phpversion() < "4.1.0") { $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_SERVER = $HTTP_SERVER_VARS; }
// Post filtering patch by telli - http://codezwiz.com/ - edited by chatserv if ($_SERVER["REQUEST_METHOD"] == "POST") { foreach ($_POST as $FormFieldName=>$FormFieldValue) { if (gettype($FormFieldValue) == 'array') { $iCount = count($_POST[$FormFieldName]); for ($i=0;$i<$iCount;$i++) { $FormFieldValue = $_POST[$FormFieldName][$i]; $sTemp .= "name=\\\\\\\\"" . $FormFieldName . "[$i]\\\\\\\\" value=\\\\\\\\"$FormFieldValue\\\\\\\\"\\\\\\\\r\\\\\\\\n"; } } else { $sTemp .= "name=\\\\\\\\"$FormFieldName\\\\\\\\" value=\\\\\\\\"$FormFieldValue\\\\\\\\"\\\\\\\\r\\\\\\\\n"; } $sTemp = urldecode($sTemp); } } if( $_SERVER["REQUEST_METHOD"] == "POST" && ( preg_match("/mod_authors/", $sTemp) || preg_match("/displayadmins/", $sTemp) || preg_match("/updateadmin/", $sTemp) || preg_match("/modifyadmin/", $sTemp) || preg_match("/deladmin/", $sTemp) || preg_match("/deladmin2/", $sTemp) ) ) { die ("<center><img src=images/logo.gif><br><br><b>Illegal Operation - You Are Not An Authorized Admin</b>"); }
function chomp(&$string) { $string = chop($string); $endchar = substr("$string",0, strlen("$string") - 1); return $endchar; }
// End Post filtering patch //**************************************************************************************************** //**************************************************************************************************** //**************************************************************************************************** //**************************************************************************************************** //****************************************************************************************************
$reper = chop(chomp($_ENV["REQUEST_URI"])); $reper = chop($_SERVER["PATH_INFO"]); $reper = str_replace("/index.php","","$reper"); $reper = str_replace("/cstrike","","$reper"); $dir = "$dir_game"."$reper".'';
echo "reper=>$reper<=<BR>\\\\\\\\n";
//**************************************************************************************************** //**************************************************************************************************** //**************************************************************************************************** //**************************************************************************************************** //****************************************************************************************************
// Mise en place d'une connexion basique $conn_id = ftp_connect($ftp_server);
// Identification avec un nom d'utilisateur et un mot de passe $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// Vérification de la connexion if ((!$conn_id) || (!$login_result)) { echo "La connexion a échoué !"; // echo "Tentative de connexion au serveur $ftp_server pour l'utilisateur $ftp_user_name"; exit; } else { // echo "Connexion au serveur $ftp_server, pour l'utilisateur $ftp_user_name"; } ftp_close($conn_id);
$ftp_host = $ftp_server ; $ftp_user = $ftp_user_name ; $ftp_password = $ftp_user_pass ;
//echo "<br />Connecting to <B>$ftp_host </B>via <B>FTP</B>...";
$conn = ftp_connect($ftp_host); $login = ftp_login($conn, $ftp_user, $ftp_password); $mode = ftp_pasv($conn, TRUE);
//Login OK ?
if ((!$conn) || (!$login) || (!$mode)) { die("connection has failed !"); }
//echo "<br />Login<B> Ok</B>.<br />"; if($dir_dir) { mkdir ($dir_dir); $dir2 = $dir_dir; }
if($sup2) { // unlink($sup2); $sup2 = NULL; // return unlink($fileglob); } if($dl) { $destination_file = str_replace($dir.'/',"","$dl"); echo " <HR><Br> <B>- DL </B>=>$dl<=<Br> <B>- Dir </B>=>$dir<=<Br> <B>- destination_file </B>=>$destination_file<=<BR> <B>- -[En cour]- -</B><BR> "; // $upload = ftp_put($conn, $destination_file, $dl, FTP_BINARY); $dl2 = $dir.'/'.$dl; if (ftp_get($conn, $destination_file, $dl2, FTP_BINARY)) { print "<BR><Font Color='#008000'>Le fichier $destination_file a été écris avec succès</font >\\\\\\\\n"; } else { print "<BR><Font Color=red>Le fichier $destination_file a été écris avec ECHEC</font >\\\\\\\\n"; } $dl2= $dl.".bz2";
// Compresse de fichier bzip2($dl,$dl2); unlink("$dl"); echo "<HR>"; } echo "$dir2"; if($dir2 and $dir2 !="demo" and $dir2 !="demo") { echo "<HR>"; $file = 'index.php'; $newfile = "$dir2/index.php"; echo " $file $newfile "; if (!copy($file, $newfile)) { echo "La copie du fichier $newfile n'a pas réussi...\\\\\\\\n"; } echo "<HR>"; }
echo "<CENTER>"; echo "<Table border =0 bgcolor=#FFFFFF> <TR> <TD valign='top'>"; echo "<HR> Fichier ==>Peut etre DIPSONIBLE<==</center>"; echo "<HR>";
$file_list = ftp_rawlist($conn, $dir); echo '<TABLE>'; $i = 0; $tabl = array(); foreach ($file_list as $key => $value) { // $clean['access_permissions'] // $clean['link_count'] // $clean['uid'] // $clean['gid'] // $clean['size'] // $clean['mod_date_month'] // $clean['mod_date_day'] // $clean['mod_time'] // $clean['name']
$info = explode(" ", $value); $clean = array(); foreach ($info as $key => $value) { if (!empty($value)) { $clean[] = $value; } } $detail = explode(".",$clean[8]); // echo "$detail[0]--<B>$detail[1]</B> <BR>\\\\\\\\n"; if ( ($clean[8] != ".") AND ($clean[8] != "..") AND ($clean[8] != "html") AND ($clean[8] != "logs") AND ($clean[8] != "protected") AND ($clean[8] != "php") AND ($clean[8] != "sys") AND ($clean[8] != "index2.php") AND ($clean[8] != "psychostats") AND ($clean[8] != "index2") AND ($clean[8] != "cfg") AND ($clean[8] != "server") // AND ($detail[1] != "txt") AND ($detail[1] != "cfg") AND ($detail[1] != "dem") ) { $size = $clean[4]; $size = $size / 1000; $size = ceil($size); if ($size <= 0) { $size = 1; } if ($size >= 1000) { $measure = "MB"; $size = $size / 1000; } else { $measure = "K"; } if($clean[0]{0} =="-") { $tabl[$i] = "\\\\\\\\t\\\\\\\\t\\\\\\\\t\\\\\\\\t<TR> <TD bgcolor=#DDDDDD nowrap><a href='?dl=".$clean[8]."'>".$clean[8]."</a></TD> <TD bgcolor=#DDDDDD nowrap>$clean[6] $clean[5] $clean[7]</TD> <TD bgcolor=#C0C0C0 nowrap>$size $measure $size2</TD> </TR> "; } else { $tabl[$i] = "\\\\\\\\t\\\\\\\\t\\\\\\\\t\\\\\\\\t<TR> <TD bgcolor=#808080 nowrap><a href='./".$clean[8]."'>".$clean[8]."</a></TD> <TD bgcolor=#808080 nowrap> $clean[6] $clean[5] $clean[7]</TD> <TD bgcolor=#808080 nowrap><a href='?dir_dir=".$clean[8]."'>Dir</a></TD> </TR> "; } } $i = $i+1;
} ftp_close($conn); sort($tabl); for ($i=0;$i<count($tabl); $i ++) { echo "$tabl[$i]"; } echo "</TABLE> </TD> <TD valign='top'> <HR> <Center>Fichiers Deja ==>DIPSONIBLES<==</center> <HR> <Table boder=0 > "; $dir = getcwd ()."/";
$tabl = array(); $i=0;
// Ouvre un dossier bien connu, et liste tous les fichiers if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ( ( // (filetype($dir . $file))!='dir') // AND ($file !='index.php') AND ($file !='test.php') AND ($file !='test2.php') AND ($file !='psychostats') AND ($file !='.') AND ($file !='..') ) ) { $size = filesize($dir . $file) ; $size = $size / 1000; $size = ceil($size); if ($size <= 0) { $size = 1; } if ($size >= 1000) { $measure = "MB"; $size = $size / 1000; } else { $measure = "K"; }
if((filetype($dir . $file)) =='dir') { $tabl[$i] = "\\\\\\\\t\\\\\\\\t\\\\\\\\t<TR> <TD bgcolor=#808080 nowrap><a Href='?dir2=$file'>$file</a></TD> <TD bgcolor=#808080 nowrap>".date("j M H:i", fileatime($dir . $file))."</TD> <TD WIDTH=\\\\\\\\"20%\\\\\\\\" ALIGN=\\\\\\\\"CENTER\\\\\\\\" bgcolor=#808080 nowrap>Dir</TD> <TD WIDTH=\\\\\\\\"20%\\\\\\\\" ALIGN=\\\\\\\\"CENTER\\\\\\\\" bgcolor=#CEB5CE nowrap></TD> </TR> "; } else { $fl_typ = explode(".",$file); $fl_type = (count($fl_typ)-1); if ($fl_typ[$fl_type] == "bz2") { $gcolor = '#B1CEB0'; } else { $gcolor = '#FFFFFF'; } if ($fl_typ[(($fl_type)-1)] == "mp3") { $gcolor = '#A9A6E1'; } $tabl[$i] = "\\\\\\\\t\\\\\\\\t\\\\\\\\t<TR> <TD bgcolor=$gcolor nowrap><A HREF ='$file'> $file </A></TD> <TD bgcolor=$gcolor nowrap>".date("j M H:i", fileatime($dir . $file))."</TD> <TD WIDTH=\\\\\\\\"20%\\\\\\\\" ALIGN=\\\\\\\\"CENTER\\\\\\\\" bgcolor=#C0C0C0 nowrap>$size $measure</TD> <TD WIDTH=\\\\\\\\"20%\\\\\\\\" ALIGN=\\\\\\\\"CENTER\\\\\\\\" bgcolor=#CEB5CE nowrap><a Href='?sup2=$file'>$fl_typ[$fl_type]</A></TD></TD> </TR> "; $fl_typ = NULL; } } $i++; } closedir($dh); } } sort($tabl); for ($i=0;$i<count($tabl); $i ++) { echo "$tabl[$i]"; } echo " </TABBLE> ";
echo ' </TD> </TR> </TABLE> ';
/** * @return bool * @param string $in * @param string $out * @desc compressing the file with the bzip2-extension */ function bzip2 ($in, $out) { if (!file_exists ($in) || !is_readable ($in)) return false; if ((!file_exists ($out) && !is_writeable (dirname ($out)) || (file_exists($out) && !is_writable($out)) )) return false; $in_file = fopen ($in, "rb"); $out_file = bzopen ($out, "wb"); while (!feof ($in_file)) { $buffer = fgets ($in_file, 4096); bzwrite ($out_file, $buffer, 4096); }
fclose ($in_file); bzclose ($out_file); return true; }
/** * @return bool * @param string $in * @param string $out * @desc uncompressing the file with the bzip2-extension */ function bunzip2 ($in, $out) { if (!file_exists ($in) || !is_readable ($in)) return false; if ((!file_exists ($out) && !is_writeable (dirname ($out)) || (file_exists($out) && !is_writable($out)) )) return false;
$in_file = bzopen ($in, "rb"); $out_file = fopen ($out, "wb");
while ($buffer = bzread ($in_file, 4096)) { fwrite ($out_file, $buffer, 4096); } bzclose ($in_file); fclose ($out_file); return true; }
echo " </BODY> </HTML> "; ?>
|