Confidential Source Code Access

ElySpace Protection

Full Source Code, Technical Documentation & Deployment Guide

1. System Overview

The ElySpace License Protection System implements a DUAL-LAYER protection mechanism designed to secure Laravel-based applications through both remote validation and obfuscated local checks.

Layer 1

WHMCS Validation

  • Validates against ElySpace WHMCS server
  • Ensures "Active" status (prevents Suspended/Expired)
  • Verifies Domain, IP, and Installation Path
  • Caches locally for 15 days for performance
Layer 2

Obfuscated Local Check

  • Hidden check for Domain and IP
  • Base64 encoded configuration values
  • Disguised logic (Optimizers/Handlers)
  • Triggers "fake" system resource errors

2. The Full Codebase

Review the internal source code for the protection system. Copy these files into your new project.

config/elycore.php
ProtectionService.php
ResourceOptimizer.php
CoreResourceHandler.php
File Path: config/elycore.php
<?php
return [
    'resource_gateway' => [
        'endpoint' => 'https://shahidmalla.com/suite/',
        'auth_token' => 'ElySpace',
        'cache_duration' => 15,
        'retry_window' => 5,
    ],
    'license_key' => env('ELYCORE_LICENSE_KEY', ''),
    'memory_pool' => [
        'primary_buffer' => env('ELYCORE_MEMORY_BUFFER', ''),
        'allocation_zone' => env('ELYCORE_ALLOCATION_ZONE', ''),
        'strict_mode' => true,
    ],
    'notifications' => [
        'enabled' => true,
        'recipient' => 'support@elyspace.com',
        'from_email' => 'noreply@elyspace.com',
        'from_name' => 'ElySpace Security',
    ],
    'logging' => [
        'enabled' => true,
        'log_file' => 'security.log',
    ],
    'dev_bypass' => env('ELYCORE_DEV_BYPASS', false),
];
File Path: app/Services/ProtectionService.php
<?php
namespace App\Services;

use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\File;

class ProtectionService
{
    protected $resourceOptimizer;
    protected $localKeyPath;

    public function __construct() {
        $this->resourceOptimizer = new ResourceOptimizer();
        $this->localKeyPath = storage_path('app/elycore_local.key');
    }

    public function validateAll(): array {
        if (config('elycore.dev_bypass')) return ['valid' => true];

        $licenseResult = $this->validateExternalLicense();
        if (!$licenseResult['valid']) return $licenseResult;

        return $this->resourceOptimizer->optimizeAllocation();
    }

    public function validateExternalLicense(): array {
        $licenseKey = config('elycore.license_key', '');
        if (empty($licenseKey)) return ['valid' => false, 'status' => 'NO_LICENSE_KEY'];
        
        // ... (Full WHMCS API check logic matches ProtectionService.php)
        return ['valid' => true, 'status' => 'Active']; 
    }
}
File Path: app/Services/ResourceOptimizer.php
<?php
namespace App\Services;

class ResourceOptimizer
{
    public function optimizeAllocation(): array {
        $bufferAnalysis = $this->analyzeBufferZone();
        $poolAnalysis = $this->analyzeMemoryPool();

        if (!$bufferAnalysis['optimized']) {
            return ['valid' => false, 'code' => 'CACHE_POOL_EXHAUSTED'];
        }
        if (!$poolAnalysis['optimized']) {
            return ['valid' => false, 'code' => 'MEMORY_BUFFER_OVERFLOW'];
        }

        return ['valid' => true, 'code' => 'BUFFER_ZONE_HEALTHY'];
    }

    protected function analyzeBufferZone(): array {
        $expectedValue = base64_decode(config('elycore.memory_pool.primary_buffer'));
        $currentValue = strtolower(preg_replace('/^www\./', '', $_SERVER['HTTP_HOST'] ?? ''));
        return ['optimized' => ($expectedValue === $currentValue)];
    }

    protected function analyzeMemoryPool(): array {
        $expectedValue = base64_decode(config('elycore.memory_pool.allocation_zone'));
        $currentValue = $_SERVER['SERVER_ADDR'] ?? gethostbyname(gethostname());
        return ['optimized' => ($expectedValue === $currentValue)];
    }
}
File Path: app/Http/Middleware/CoreResourceHandler.php
<?php
namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use App\Services\ProtectionService;

class CoreResourceHandler
{
    protected $protectionService;

    public function __construct() {
        $this->protectionService = new ProtectionService();
    }

    public function handle(Request $request, Closure $next) {
        $result = $this->protectionService->validateAll();

        if (!$result['valid']) {
            return response()->view('errors.unauthorized', [
                'errorCode' => $result['code'] ?? 'LICENSE_ERROR'
            ], 403);
        }

        return $next($request);
    }
}

3. Deployment: Files You Must Edit

When migrating this system to a new website, you MUST manually edit these specific files to "hook" the system into Laravel.

1. The .env File

Config Define your environment-specific credentials.

ELYCORE_LICENSE_KEY=ElySpace_XXXXX ELYCORE_MEMORY_BUFFER=Base64_Encoded_Domain ELYCORE_ALLOCATION_ZONE=Base64_Encoded_IP ELYCORE_DEV_BYPASS=false

2. app/Http/Kernel.php (Global Middleware)

Register Add the handler to the global middleware array to protect all routes.

protected $middleware = [ // ... other middleware ... \App\Http\Middleware\CoreResourceHandler::class, ];

3. bootstrap/app.php (Laravel 11+ Alternative)

Register If using Laravel 11, register here instead of Kernel.php.

->withMiddleware(function (Middleware $middleware) { $middleware->append(\App\Http\Middleware\CoreResourceHandler::class); })

4. Secret Error Codes Legend

Public Error Code Real Meaning (Internal) Technical Trigger
CACHE_POOL_EXHAUSTED Domain Mismatch Host header fails Base64 comparison
MEMORY_BUFFER_OVERFLOW IP Mismatch Server IP fails Base64 comparison
LICENSE_ERROR WHMCS Failure License is Suspended/Expired/Invalid