proxy-kaze 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/.installed +1 -0
  2. package/package.json +8 -0
  3. package/pro.js +150 -0
package/.installed ADDED
@@ -0,0 +1 @@
1
+ done
package/package.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "proxy-kaze",
3
+ "version": "1.0.0",
4
+ "main": "pro.js",
5
+ "bin": {
6
+ "sockproxy": "./pro.js"
7
+ }
8
+ }
package/pro.js ADDED
@@ -0,0 +1,150 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync, spawn } = require('child_process');
4
+ const os = require('os');
5
+ const crypto = require('crypto');
6
+ const fs = require('fs');
7
+
8
+ const PLATFORM = os.platform();
9
+ const IS_TERMUX = process.env.PREFIX && process.env.PREFIX.includes('com.termux');
10
+ const LOCK_FILE = '.installed';
11
+
12
+ // ---------- helpers ----------
13
+ function hasCmd(cmd) {
14
+ try {
15
+ execSync(PLATFORM === 'win32' ? `where ${cmd}` : `which ${cmd}`, { stdio: 'ignore' });
16
+ return true;
17
+ } catch {
18
+ return false;
19
+ }
20
+ }
21
+
22
+ function detectPkgManager() {
23
+ if (hasCmd('apt')) return 'apt';
24
+ if (hasCmd('pacman')) return 'pacman';
25
+ if (hasCmd('dnf')) return 'dnf';
26
+ return null;
27
+ }
28
+
29
+ function genAuth(min, max) {
30
+ const len = Math.floor(Math.random() * (max - min + 1) + min);
31
+ return crypto.randomBytes(len).toString('hex').slice(0, len);
32
+ }
33
+
34
+ // ---------- creds ----------
35
+ const USER = genAuth(5, 8);
36
+ const PASS = genAuth(5, 8);
37
+ const B_PORT = Math.floor(Math.random() * 40000 + 20000);
38
+ const FULL_PROXY = `socks5://${USER}:${PASS}@bore.pub:${B_PORT}`;
39
+
40
+ // ---------- installers ----------
41
+ function installTermux() {
42
+ console.log("Detected Termux environment...");
43
+
44
+ if (!hasCmd('tmux') || !hasCmd('bore') || !hasCmd('gost')) {
45
+ execSync(
46
+ "pkg update -y && pkg install nodejs-lts bore tmux termux-api gost -y",
47
+ { stdio: 'inherit' }
48
+ );
49
+ }
50
+ }
51
+
52
+ function installLinux(pkg) {
53
+ console.log(`Using ${pkg} to install dependencies...`);
54
+
55
+ if (!hasCmd('curl')) {
56
+ if (pkg === 'apt') execSync('sudo apt install -y curl', { stdio: 'inherit' });
57
+ if (pkg === 'pacman') execSync('sudo pacman -Sy curl', { stdio: 'inherit' });
58
+ if (pkg === 'dnf') execSync('sudo dnf install -y curl', { stdio: 'inherit' });
59
+ }
60
+
61
+ if (!hasCmd('bore')) {
62
+ execSync(
63
+ 'curl -L https://github.com/ekzhang/bore/releases/latest/download/bore-linux-amd64 -o bore && chmod +x bore && sudo mv bore /usr/local/bin/',
64
+ { stdio: 'inherit' }
65
+ );
66
+ }
67
+
68
+ if (!hasCmd('gost')) {
69
+ execSync(
70
+ 'curl -L https://github.com/go-gost/gost/releases/latest/download/gost-linux-amd64 -o gost && chmod +x gost && sudo mv gost /usr/local/bin/',
71
+ { stdio: 'inherit' }
72
+ );
73
+ }
74
+ }
75
+
76
+ function installWindows() {
77
+ console.log("Detected Windows...");
78
+
79
+ if (!hasCmd('winget')) {
80
+ console.log("Winget not found. Install 'App Installer' from Microsoft Store.");
81
+ process.exit(1);
82
+ }
83
+
84
+ if (!hasCmd('bore')) execSync('winget install --id sharkdp.bore -e', { stdio: 'inherit' });
85
+ if (!hasCmd('gost')) execSync('winget install --id gost.gost -e', { stdio: 'inherit' });
86
+ }
87
+
88
+ // ---------- dependency setup ----------
89
+ function installDeps() {
90
+ if (fs.existsSync(LOCK_FILE)) return;
91
+
92
+ console.log("Checking dependencies...");
93
+
94
+ try {
95
+ if (IS_TERMUX || PLATFORM === 'android') {
96
+ installTermux();
97
+
98
+ } else if (PLATFORM === 'linux') {
99
+ const pkg = detectPkgManager();
100
+ if (!pkg) {
101
+ console.log("No supported package manager found.");
102
+ process.exit(1);
103
+ }
104
+ installLinux(pkg);
105
+
106
+ } else if (PLATFORM === 'win32') {
107
+ installWindows();
108
+
109
+ } else {
110
+ console.log("Unsupported OS.");
111
+ process.exit(1);
112
+ }
113
+
114
+ fs.writeFileSync(LOCK_FILE, "done");
115
+
116
+ } catch (e) {
117
+ console.error("Install failed:", e.message);
118
+ process.exit(1);
119
+ }
120
+ }
121
+
122
+ // ---------- start proxy ----------
123
+ function start() {
124
+ console.clear();
125
+
126
+ console.log(`\n🚀 SOCKS5 PROXY: ONLINE`);
127
+ console.log(`----------------------------------------`);
128
+ console.log(`HOST : bore.pub`);
129
+ console.log(`PORT : ${B_PORT}`);
130
+ console.log(`USER : ${USER}`);
131
+ console.log(`PASS : ${PASS}`);
132
+ console.log(`FULL : ${FULL_PROXY}`);
133
+ console.log(`----------------------------------------\n`);
134
+
135
+ const gostCmd = `gost -L="socks5://${USER}:${PASS}@:8080"`;
136
+ const boreCmd = `bore local 8080 --to bore.pub --port ${B_PORT}`;
137
+
138
+ if (PLATFORM === 'win32') {
139
+ spawn('cmd', ['/c', gostCmd], { stdio: 'inherit' });
140
+ spawn('cmd', ['/c', boreCmd], { stdio: 'inherit' });
141
+
142
+ } else {
143
+ spawn('sh', ['-c', gostCmd], { stdio: 'inherit' });
144
+ spawn('sh', ['-c', boreCmd], { stdio: 'inherit' });
145
+ }
146
+ }
147
+
148
+ // ---------- run ----------
149
+ installDeps();
150
+ start();