info('=== Chain Status ==='); // Daemon — safe: hardcoded process name, no user input $daemonRunning = $this->isRunning('lethean-testnet-chain-node'); $this->line('Daemon: ' . ($daemonRunning ? 'running' : 'stopped')); if ($daemonRunning) { $info = $rpc->getInfo(); if (! isset($info['_offline'])) { $this->line(" Height: {$info['height']}"); $this->line(" Aliases: {$info['alias_count']}"); $this->line(" TX Pool: {$info['tx_pool_size']}"); $this->line(' PoS: ' . (($info['pos_allowed'] ?? false) ? 'active' : 'inactive')); $this->line(" Difficulty: {$info['pow_difficulty']}"); } else { $this->warn(' RPC unreachable'); } } // Wallet — safe: hardcoded process name $walletRunning = $this->isRunning('lethean-wallet-cli'); $this->line('Wallet: ' . ($walletRunning ? 'running' : 'stopped')); // LNS — safe: hardcoded process name $lnsRunning = $this->isRunning('lns-new'); $this->line('LNS: ' . ($lnsRunning ? 'running' : 'stopped')); return self::SUCCESS; } private function isRunning(string $processName): bool { // Safe: escapeshellarg prevents injection, process names are hardcoded exec("pgrep -f " . escapeshellarg($processName), $output); // @codeCoverageIgnore return ! empty($output); } }