UNPKG

xnet-toolkit

Version:

Professional Network Administration and Security Toolkit

55 lines (42 loc) 1.82 kB
#!/usr/bin/env node const { spawn } = require('child_process'); const path = require('path'); const chalk = require('chalk'); const fs = require('fs'); function checkPythonInstallation() { try { const pythonProcess = spawn('python3', ['--version']); pythonProcess.on('error', () => { console.error(chalk.red('Error: Python 3 is not installed or not in PATH.')); console.log(chalk.yellow('Please install Python 3.6 or later from https://www.python.org/downloads/')); process.exit(1); }); return true; } catch (error) { console.error(chalk.red('Error: Python 3 is not installed or not in PATH.')); console.log(chalk.yellow('Please install Python 3.6 or later from https://www.python.org/downloads/')); process.exit(1); } } function runXnet() { const pythonExecutable = process.platform === 'win32' ? 'python' : 'python3'; const xnetPath = path.join(__dirname, '..', 'xnet_system', 'cli.py'); if (!fs.existsSync(xnetPath)) { console.error(chalk.red(`Error: XNET Python script not found at ${xnetPath}`)); console.log(chalk.yellow('Try reinstalling the package with "npm install -g xnet-toolkit"')); process.exit(1); } const args = [xnetPath, ...process.argv.slice(2)]; const xnetProcess = spawn(pythonExecutable, args, { stdio: 'inherit' }); xnetProcess.on('error', (error) => { console.error(chalk.red(`Error executing XNET: ${error.message}`)); process.exit(1); }); xnetProcess.on('exit', (code) => { process.exit(code || 0); }); } console.log(chalk.blue('XNET - Professional Network Administration & Security Toolkit')); console.log(chalk.gray('© 2025 StasX (Kozosvyst Stas). All rights reserved.\n')); checkPythonInstallation(); runXnet();