const { execSync } = require("child_process"); const readline = require("readline"); // ------------------------- // SAFE RUN FUNCTION // ------------------------- function run(cmd) { try { execSync(cmd, { stdio: "inherit", shell: "/bin/bash" }); } catch (e) { console.error("❌ Failed:", cmd); } } // ------------------------- // INPUT HELPER // ------------------------- function ask(question) { const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); return new Promise(resolve => { rl.question(question, answer => { rl.close(); resolve(answer.trim()); }); }); } // ------------------------- // VPN CONNECT LOGIC // ------------------------- async function vpnConnect(country) { const token = await ask("🔐 Enter JWT token: "); if (!token) { console.log("❌ Token missing"); return; } if (!country) { country = await ask("🌍 Enter country (US/UK/DE): "); } // THIS is what you asked: const cmd = `vpn connect ${country} ${token}`; run(cmd); } // ------------------------- // CLI ROUTER // ------------------------- (async () => { const args = process.argv.slice(2); const command = args[0]; const country = args[1]; if (command === "connect") { await vpnConnect(country); } else { console.log("Usage:"); console.log(" node vpn.js connect US"); } })();