| const { execSync } = require("child_process"); |
| const readline = require("readline"); |
|
|
| |
| |
| |
| function run(cmd) { |
| try { |
| execSync(cmd, { stdio: "inherit", shell: "/bin/bash" }); |
| } catch (e) { |
| console.error("β Failed:", cmd); |
| } |
| } |
|
|
| |
| |
| |
| 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()); |
| }); |
| }); |
| } |
|
|
| |
| |
| |
| 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): "); |
| } |
|
|
| |
| const cmd = `vpn connect ${country} ${token}`; |
|
|
| run(cmd); |
| } |
|
|
| |
| |
| |
| (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"); |
| } |
| })(); |