mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-24 20:28:06 +02:00
refactor(dynamic): replace PHP route stubs with framework-aware route replay logic for Laravel and Symfony, enhance helper functions, and update related test fixtures
This commit is contained in:
parent
aaf49acefb
commit
ed398e2834
14 changed files with 835 additions and 345 deletions
|
|
@ -1,40 +1,23 @@
|
|||
<?php
|
||||
// Phase 16 — Laravel-style route, benign sanitised payload.
|
||||
// Laravel-style route, benign sanitised payload.
|
||||
|
||||
namespace Illuminate\Support\Facades {
|
||||
class Route
|
||||
{
|
||||
public static function get(string $path, string $callable)
|
||||
{
|
||||
$GLOBALS['__nyx_route'] = function (string $payload) use ($callable) {
|
||||
[$class, $method] = preg_split('/@|::/', $callable);
|
||||
$controller = new $class();
|
||||
return $controller->$method($payload);
|
||||
};
|
||||
return new class {
|
||||
public function middleware($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
function nyx_register_routes(Router $router): void
|
||||
{
|
||||
$router->get('/run/{payload}', [UserController::class, 'run']);
|
||||
}
|
||||
|
||||
namespace {
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/run', 'UserController@run');
|
||||
|
||||
class UserController
|
||||
{
|
||||
public function run($payload)
|
||||
public function run(string $payload): string
|
||||
{
|
||||
echo "__NYX_SINK_HIT__\n";
|
||||
$cmd = "true " . escapeshellarg($payload);
|
||||
$out = shell_exec($cmd);
|
||||
$out = shell_exec($cmd) ?? '';
|
||||
echo $out;
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue