fightertunnel 1.0.5
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.
- package/README.md +73 -0
- package/check/checkSSH.js +41 -0
- package/check/checkShadowsocks.js +41 -0
- package/check/checkTrojan.js +41 -0
- package/check/checkVLESS.js +41 -0
- package/check/checkVMess.js +41 -0
- package/create/createSSH.js +44 -0
- package/create/createShadowsocks.js +44 -0
- package/create/createTrojan.js +44 -0
- package/create/createVLESS.js +44 -0
- package/create/createVMess.js +44 -0
- package/delete/deleteSSH.js +45 -0
- package/delete/deleteShadowsocks.js +45 -0
- package/delete/deleteTrojan.js +45 -0
- package/delete/deleteVLESS.js +45 -0
- package/delete/deleteVMess.js +45 -0
- package/index.js +58 -0
- package/package.json +12 -0
- package/renew/renewSSH.js +44 -0
- package/renew/renewShadowsocks.js +44 -0
- package/renew/renewTrojan.js +44 -0
- package/renew/renewVLESS.js +44 -0
- package/renew/renewVMess.js +44 -0
- package/trial/trialshadowsocks.js +44 -0
- package/trial/trialssh.js +40 -0
- package/trial/trialtrojan.js +44 -0
- package/trial/trialvless.js +46 -0
- package/trial/trialvmess.js +46 -0
package/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Fightertunnel
|
2
|
+
|
3
|
+

|
4
|
+

|
5
|
+

|
6
|
+
|
7
|
+
Fightertunnel is a comprehensive module for managing various types of accounts such as SSH, VMess, VLESS, Trojan, and Shadowsocks. This module provides various functions to easily and efficiently create, check, delete, and update these accounts.
|
8
|
+
|
9
|
+
<img src="https://avatars.githubusercontent.com/u/118927603?v=4" alt="Fightertunnel" width="100" height="100" style="border-radius: 50%; box-shadow: 0 0 10px yellow;">
|
10
|
+
|
11
|
+
## Features
|
12
|
+
|
13
|
+
- **Create Account**: Create new accounts for SSH, VMess, VLESS, Trojan, and Shadowsocks.
|
14
|
+
- **Check Account**: Check the status and details of existing accounts.
|
15
|
+
- **Delete Account**: Remove accounts that are no longer needed.
|
16
|
+
- **Update Account**: Update information of existing accounts.
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
To install the Fightertunnel module, use the following command:
|
21
|
+
|
22
|
+
```bash
|
23
|
+
npm i fightertunnel
|
24
|
+
```
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Here is an example of using the FighterTunnel module to create an SSH account:
|
29
|
+
|
30
|
+
### SSH
|
31
|
+
```javascript
|
32
|
+
const { createSSH } = require('fightertunnel');
|
33
|
+
createSSH('username', 'password', 'exp', 'limitip', (err, result) => {
|
34
|
+
if (err) {
|
35
|
+
console.error(err);
|
36
|
+
} else {
|
37
|
+
console.log(result);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
```
|
41
|
+
|
42
|
+
### VMESS
|
43
|
+
```javascript
|
44
|
+
const { createVMess } = require('fightertunnel');
|
45
|
+
function createVMessAccount(username, expiry, quota, iplimit) {
|
46
|
+
createVMess(username, expiry, quota, iplimit, (err, result) => {
|
47
|
+
if (err) {
|
48
|
+
console.error('Error occurred:', err);
|
49
|
+
} else {
|
50
|
+
console.log('VMess account created successfully:', result);
|
51
|
+
}
|
52
|
+
});
|
53
|
+
}
|
54
|
+
createVMessAccount('user123', '1', '1', '1');
|
55
|
+
```
|
56
|
+
|
57
|
+
## Auto Script Link
|
58
|
+
|
59
|
+
For more information and auto scripts, visit our GitHub repository:
|
60
|
+
[https://github.com/FighterTunnel/tunnel](https://github.com/FighterTunnel/tunnel)
|
61
|
+
|
62
|
+
## API
|
63
|
+
|
64
|
+
For more information about our API, visit:
|
65
|
+
[https://github.com/AutoFTbot/Api/](https://github.com/AutoFTbot/Api/)
|
66
|
+
|
67
|
+
## Contribution
|
68
|
+
|
69
|
+
We welcome contributions from anyone. Please make a pull request or open an issue for further discussion.
|
70
|
+
|
71
|
+
## License
|
72
|
+
|
73
|
+
This project is licensed under the MIT License.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const checkSSH = (callback) => {
|
4
|
+
const child = spawn("/bin/bash", ["-c", `apicheck ssh`], {
|
5
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
6
|
+
});
|
7
|
+
|
8
|
+
child.stdin.end();
|
9
|
+
let output = '';
|
10
|
+
child.stdout.on('data', (data) => {
|
11
|
+
output += data.toString();
|
12
|
+
});
|
13
|
+
|
14
|
+
child.stderr.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.on('close', (code) => {
|
19
|
+
if (code !== 0) {
|
20
|
+
return callback(new Error('Terjadi kesalahan saat memeriksa akun'));
|
21
|
+
}
|
22
|
+
|
23
|
+
try {
|
24
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
25
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
26
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
27
|
+
callback(null, {
|
28
|
+
status: "success",
|
29
|
+
message: jsonResponse.data.message,
|
30
|
+
data: jsonResponse.data
|
31
|
+
});
|
32
|
+
} else {
|
33
|
+
callback(new Error('Akun SSH tidak ditemukan'));
|
34
|
+
}
|
35
|
+
} catch (error) {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
37
|
+
}
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
module.exports = checkSSH;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const checkShadowsocks = (callback) => {
|
4
|
+
const child = spawn("/bin/bash", ["-c", `apicheck shadowsocks`], {
|
5
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
6
|
+
});
|
7
|
+
|
8
|
+
child.stdin.end();
|
9
|
+
let output = '';
|
10
|
+
child.stdout.on('data', (data) => {
|
11
|
+
output += data.toString();
|
12
|
+
});
|
13
|
+
|
14
|
+
child.stderr.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.on('close', (code) => {
|
19
|
+
if (code !== 0) {
|
20
|
+
return callback(new Error('Terjadi kesalahan saat memeriksa akun'));
|
21
|
+
}
|
22
|
+
|
23
|
+
try {
|
24
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
25
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
26
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
27
|
+
callback(null, {
|
28
|
+
status: "success",
|
29
|
+
message: jsonResponse.data.message,
|
30
|
+
data: jsonResponse.data
|
31
|
+
});
|
32
|
+
} else {
|
33
|
+
callback(new Error('Akun Shadowsocks tidak ditemukan'));
|
34
|
+
}
|
35
|
+
} catch (error) {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
37
|
+
}
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
module.exports = checkShadowsocks;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const checkTrojan = (callback) => {
|
4
|
+
const child = spawn("/bin/bash", ["-c", `apicheck trojan`], {
|
5
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
6
|
+
});
|
7
|
+
|
8
|
+
child.stdin.end();
|
9
|
+
let output = '';
|
10
|
+
child.stdout.on('data', (data) => {
|
11
|
+
output += data.toString();
|
12
|
+
});
|
13
|
+
|
14
|
+
child.stderr.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.on('close', (code) => {
|
19
|
+
if (code !== 0) {
|
20
|
+
return callback(new Error('Terjadi kesalahan saat memeriksa akun'));
|
21
|
+
}
|
22
|
+
|
23
|
+
try {
|
24
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
25
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
26
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
27
|
+
callback(null, {
|
28
|
+
status: "success",
|
29
|
+
message: jsonResponse.data.message,
|
30
|
+
data: jsonResponse.data
|
31
|
+
});
|
32
|
+
} else {
|
33
|
+
callback(new Error('Akun Trojan tidak ditemukan'));
|
34
|
+
}
|
35
|
+
} catch (error) {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
37
|
+
}
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
module.exports = checkTrojan;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const checkVLESS = (callback) => {
|
4
|
+
const child = spawn("/bin/bash", ["-c", `apicheck vless`], {
|
5
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
6
|
+
});
|
7
|
+
|
8
|
+
child.stdin.end();
|
9
|
+
let output = '';
|
10
|
+
child.stdout.on('data', (data) => {
|
11
|
+
output += data.toString();
|
12
|
+
});
|
13
|
+
|
14
|
+
child.stderr.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.on('close', (code) => {
|
19
|
+
if (code !== 0) {
|
20
|
+
return callback(new Error('Terjadi kesalahan saat memeriksa akun'));
|
21
|
+
}
|
22
|
+
|
23
|
+
try {
|
24
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
25
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
26
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
27
|
+
callback(null, {
|
28
|
+
status: "success",
|
29
|
+
message: jsonResponse.data.message,
|
30
|
+
data: jsonResponse.data
|
31
|
+
});
|
32
|
+
} else {
|
33
|
+
callback(new Error('Akun VLESS tidak ditemukan'));
|
34
|
+
}
|
35
|
+
} catch (error) {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
37
|
+
}
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
module.exports = checkVLESS;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const checkVMess = (callback) => {
|
4
|
+
const child = spawn("/bin/bash", ["-c", `apicheck vmess`], {
|
5
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
6
|
+
});
|
7
|
+
|
8
|
+
child.stdin.end();
|
9
|
+
let output = '';
|
10
|
+
child.stdout.on('data', (data) => {
|
11
|
+
output += data.toString();
|
12
|
+
});
|
13
|
+
|
14
|
+
child.stderr.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.on('close', (code) => {
|
19
|
+
if (code !== 0) {
|
20
|
+
return callback(new Error('Terjadi kesalahan saat memeriksa akun'));
|
21
|
+
}
|
22
|
+
|
23
|
+
try {
|
24
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
25
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
26
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
27
|
+
callback(null, {
|
28
|
+
status: "success",
|
29
|
+
message: jsonResponse.data.message,
|
30
|
+
data: jsonResponse.data
|
31
|
+
});
|
32
|
+
} else {
|
33
|
+
callback(new Error('Akun VMess tidak ditemukan'));
|
34
|
+
}
|
35
|
+
} catch (error) {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
37
|
+
}
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
module.exports = checkVMess;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const createSSH = (user, password, exp, iplimit, callback) => {
|
4
|
+
if (!user || !password || !exp || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, iplimit, dan password diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apicreate ssh ${user} ${password} ${exp} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat membuat akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "SSH account successfully created",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error("Gagal membuat akun SSH"));
|
37
|
+
}
|
38
|
+
} catch (err) {
|
39
|
+
callback(new Error("Terjadi kesalahan saat memproses hasil"));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = createSSH;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const createShadowsocks = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apicreate shadowsocks ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat membuat akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "Shadowsocks account successfully created",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error("Gagal membuat akun Shadowsocks"));
|
37
|
+
}
|
38
|
+
} catch (err) {
|
39
|
+
callback(new Error("Terjadi kesalahan saat memproses hasil"));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = createShadowsocks;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const createTrojan = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apicreate trojan ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat membuat akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "Trojan account successfully created",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error("Gagal membuat akun Trojan"));
|
37
|
+
}
|
38
|
+
} catch (err) {
|
39
|
+
callback(new Error("Terjadi kesalahan saat memproses hasil"));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = createTrojan;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const createVLESS = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apicreate vless ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat membuat akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "VLESS account successfully created",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error("Gagal membuat akun VLESS"));
|
37
|
+
}
|
38
|
+
} catch (err) {
|
39
|
+
callback(new Error("Terjadi kesalahan saat memproses hasil"));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = createVLESS;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const createVMess = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apicreate vmess ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat membuat akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "VMess account successfully created",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error("Gagal membuat akun VMess"));
|
37
|
+
}
|
38
|
+
} catch (err) {
|
39
|
+
callback(new Error("Terjadi kesalahan saat memproses hasil"));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = createVMess;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const deleteSSH = (user, callback) => {
|
4
|
+
if (!user) {
|
5
|
+
return callback(new Error('Username diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apidelete ssh ${user}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat menghapus akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
29
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
30
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
31
|
+
callback(null, {
|
32
|
+
status: "success",
|
33
|
+
message: jsonResponse.data.message,
|
34
|
+
data: jsonResponse.data
|
35
|
+
});
|
36
|
+
} else {
|
37
|
+
callback(new Error('Akun SSH tidak ditemukan'));
|
38
|
+
}
|
39
|
+
} catch (error) {
|
40
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
41
|
+
}
|
42
|
+
});
|
43
|
+
};
|
44
|
+
|
45
|
+
module.exports = deleteSSH;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const deleteShadowsocks = (user, callback) => {
|
4
|
+
if (!user) {
|
5
|
+
return callback(new Error('Username diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apidelete shadowsocks ${user}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat menghapus akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
29
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
30
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
31
|
+
callback(null, {
|
32
|
+
status: "success",
|
33
|
+
message: jsonResponse.data.message,
|
34
|
+
data: jsonResponse.data
|
35
|
+
});
|
36
|
+
} else {
|
37
|
+
callback(new Error('Akun Shadowsocks tidak ditemukan'));
|
38
|
+
}
|
39
|
+
} catch (error) {
|
40
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
41
|
+
}
|
42
|
+
});
|
43
|
+
};
|
44
|
+
|
45
|
+
module.exports = deleteShadowsocks;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const deleteTrojan = (user, callback) => {
|
4
|
+
if (!user) {
|
5
|
+
return callback(new Error('Username diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apidelete trojan ${user}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat menghapus akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
29
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
30
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
31
|
+
callback(null, {
|
32
|
+
status: "success",
|
33
|
+
message: jsonResponse.data.message,
|
34
|
+
data: jsonResponse.data
|
35
|
+
});
|
36
|
+
} else {
|
37
|
+
callback(new Error('Akun Trojan tidak ditemukan'));
|
38
|
+
}
|
39
|
+
} catch (error) {
|
40
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
41
|
+
}
|
42
|
+
});
|
43
|
+
};
|
44
|
+
|
45
|
+
module.exports = deleteTrojan;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const deleteVLESS = (user, callback) => {
|
4
|
+
if (!user) {
|
5
|
+
return callback(new Error('Username diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apidelete vless ${user}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat menghapus akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
29
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
30
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
31
|
+
callback(null, {
|
32
|
+
status: "success",
|
33
|
+
message: jsonResponse.data.message,
|
34
|
+
data: jsonResponse.data
|
35
|
+
});
|
36
|
+
} else {
|
37
|
+
callback(new Error('Akun VLESS tidak ditemukan'));
|
38
|
+
}
|
39
|
+
} catch (error) {
|
40
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
41
|
+
}
|
42
|
+
});
|
43
|
+
};
|
44
|
+
|
45
|
+
module.exports = deleteVLESS;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const deleteVMess = (user, callback) => {
|
4
|
+
if (!user) {
|
5
|
+
return callback(new Error('Username diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apidelete vmess ${user}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat menghapus akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const cleanedOutput = output.replace(/,\s*}/g, '}').replace(/,\s*]/g, ']');
|
29
|
+
const jsonResponse = JSON.parse(cleanedOutput);
|
30
|
+
if (jsonResponse.status === "success" && jsonResponse.data) {
|
31
|
+
callback(null, {
|
32
|
+
status: "success",
|
33
|
+
message: jsonResponse.data.message,
|
34
|
+
data: jsonResponse.data
|
35
|
+
});
|
36
|
+
} else {
|
37
|
+
callback(new Error('Akun VMess tidak ditemukan'));
|
38
|
+
}
|
39
|
+
} catch (error) {
|
40
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
41
|
+
}
|
42
|
+
});
|
43
|
+
};
|
44
|
+
|
45
|
+
module.exports = deleteVMess;
|
package/index.js
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
//CREATE
|
2
|
+
const createSSH = require('./create/createSSH');
|
3
|
+
const createVMess = require('./create/createVMess');
|
4
|
+
const createVLESS = require('./create/createVLESS');
|
5
|
+
const createTrojan = require('./create/createTrojan');
|
6
|
+
const createShadowsocks = require('./create/createShadowsocks');
|
7
|
+
//CHECK
|
8
|
+
const checkSSH = require('./check/checkSSH');
|
9
|
+
const checkVMess = require('./check/checkVMess');
|
10
|
+
const checkVLESS = require('./check/checkVLESS');
|
11
|
+
const checkTrojan = require('./check/checkTrojan');
|
12
|
+
const checkShadowsocks = require('./check/checkShadowsocks');
|
13
|
+
//DELETE
|
14
|
+
const deleteSSH = require('./delete/deleteSSH');
|
15
|
+
const deleteVMess = require('./delete/deleteVMess');
|
16
|
+
const deleteVLESS = require('./delete/deleteVLESS');
|
17
|
+
const deleteTrojan = require('./delete/deleteTrojan');
|
18
|
+
const deleteShadowsocks = require('./delete/deleteShadowsocks');
|
19
|
+
//RENEW
|
20
|
+
const renewSSH = require('./renew/renewSSH');
|
21
|
+
const renewVMess = require('./renew/renewVMess');
|
22
|
+
const renewVLESS = require('./renew/renewVLESS');
|
23
|
+
const renewTrojan = require('./renew/renewTrojan');
|
24
|
+
const renewShadowsocks = require('./renew/renewShadowsocks');
|
25
|
+
//TRIAL
|
26
|
+
const trialSSH = require('./trial/trialssh');
|
27
|
+
const trialTrojan = require('./trial/trialtrojan');
|
28
|
+
const trialVMess = require('./trial/trialvmess');
|
29
|
+
const trialVLess = require('./trial/trialvless');
|
30
|
+
const trialShadowsocks = require('./trial/trialshadowsocks');
|
31
|
+
|
32
|
+
module.exports = {
|
33
|
+
createSSH,
|
34
|
+
createVMess,
|
35
|
+
createVLESS,
|
36
|
+
createTrojan,
|
37
|
+
createShadowsocks,
|
38
|
+
checkSSH,
|
39
|
+
checkVMess,
|
40
|
+
checkVLESS,
|
41
|
+
checkTrojan,
|
42
|
+
checkShadowsocks,
|
43
|
+
deleteSSH,
|
44
|
+
deleteVMess,
|
45
|
+
deleteVLESS,
|
46
|
+
deleteTrojan,
|
47
|
+
deleteShadowsocks,
|
48
|
+
renewSSH,
|
49
|
+
renewVMess,
|
50
|
+
renewVLESS,
|
51
|
+
renewTrojan,
|
52
|
+
renewShadowsocks,
|
53
|
+
trialSSH,
|
54
|
+
trialTrojan,
|
55
|
+
trialVMess,
|
56
|
+
trialVLess,
|
57
|
+
trialShadowsocks
|
58
|
+
};
|
package/package.json
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"name": "fightertunnel",
|
3
|
+
"version": "1.0.5",
|
4
|
+
"description": "A module for managing SSH, VMess, VLESS, Trojan, and Shadowsocks accounts",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"keywords": ["ssh", "vmess", "vless", "trojan", "shadowsocks"],
|
10
|
+
"author": "FighterTunnel",
|
11
|
+
"license": "ISC"
|
12
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const renewSSH = (user, exp, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apirenew ssh ${user} ${exp} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "Akun SSH berhasil diperbarui",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
37
|
+
}
|
38
|
+
} catch (error) {
|
39
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = renewSSH;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const renewShadowsocks = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apirenew shadowsocks ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "Akun Shadowsocks berhasil diperbarui",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
37
|
+
}
|
38
|
+
} catch (error) {
|
39
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = renewShadowsocks;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const renewTrojan = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apirenew trojan ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "Akun Trojan berhasil diperbarui",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
37
|
+
}
|
38
|
+
} catch (error) {
|
39
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = renewTrojan;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const renewVLESS = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apirenew vless ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "Akun VLESS berhasil diperbarui",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
37
|
+
}
|
38
|
+
} catch (error) {
|
39
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = renewVLESS;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { spawn } = require('child_process');
|
2
|
+
|
3
|
+
const renewVMess = (user, exp, quota, iplimit, callback) => {
|
4
|
+
if (!user || !exp || !quota || !iplimit) {
|
5
|
+
return callback(new Error('Username, expiry, quota, dan iplimit diperlukan'));
|
6
|
+
}
|
7
|
+
|
8
|
+
const child = spawn("/bin/bash", ["-c", `apirenew vmess ${user} ${exp} ${quota} ${iplimit}`], {
|
9
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
10
|
+
});
|
11
|
+
|
12
|
+
child.stdin.end();
|
13
|
+
let output = '';
|
14
|
+
child.stdout.on('data', (data) => {
|
15
|
+
output += data.toString();
|
16
|
+
});
|
17
|
+
|
18
|
+
child.stderr.on('data', (data) => {
|
19
|
+
output += data.toString();
|
20
|
+
});
|
21
|
+
|
22
|
+
child.on('close', (code) => {
|
23
|
+
if (code !== 0) {
|
24
|
+
return callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
25
|
+
}
|
26
|
+
|
27
|
+
try {
|
28
|
+
const jsonResponse = JSON.parse(output);
|
29
|
+
if (jsonResponse.status === "success") {
|
30
|
+
callback(null, {
|
31
|
+
status: "success",
|
32
|
+
message: "Akun VMess berhasil diperbarui",
|
33
|
+
data: jsonResponse.data
|
34
|
+
});
|
35
|
+
} else {
|
36
|
+
callback(new Error('Terjadi kesalahan saat memperbarui akun'));
|
37
|
+
}
|
38
|
+
} catch (error) {
|
39
|
+
callback(new Error('Terjadi kesalahan saat memproses output JSON'));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = renewVMess;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { exec } = require('child_process');
|
2
|
+
|
3
|
+
const trialShadowsocks = (callback) => {
|
4
|
+
exec(`printf '%s\n' '30' | trialshadowsocks`, (error, stdout, stderr) => {
|
5
|
+
if (error) {
|
6
|
+
return callback(new Error(`Terjadi kesalahan: ${error.message}`));
|
7
|
+
}
|
8
|
+
if (stderr) {
|
9
|
+
return callback(new Error(`stderr: ${stderr}`));
|
10
|
+
}
|
11
|
+
const cleanOutput = stdout.replace(/\x1B\[[0-9;]*m/g, '').trim();
|
12
|
+
const result = parseTrialshadowsocksOutput(cleanOutput);
|
13
|
+
if (result) {
|
14
|
+
callback(null, {
|
15
|
+
status: "success",
|
16
|
+
message: "Trial shadowsocks berhasil dibuat",
|
17
|
+
data: formatshadowsocksLinks(result)
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
callback(new Error('Gagal mem-parsing output trial shadowsocks'));
|
21
|
+
}
|
22
|
+
});
|
23
|
+
};
|
24
|
+
const parseTrialshadowsocksOutput = (output) => {
|
25
|
+
const lines = output.split('\n');
|
26
|
+
const data = [];
|
27
|
+
|
28
|
+
lines.forEach(line => {
|
29
|
+
const match = line.match(/ss:\/\/(.*)/);
|
30
|
+
if (match) {
|
31
|
+
data.push(match[0]);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
return data;
|
36
|
+
};
|
37
|
+
const formatshadowsocksLinks = (links) => {
|
38
|
+
return {
|
39
|
+
"TLS Link": links[0],
|
40
|
+
"GRPC Link": links[1]
|
41
|
+
};
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = trialShadowsocks;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
const { exec } = require('child_process');
|
2
|
+
|
3
|
+
const trialSSH = (callback) => {
|
4
|
+
exec(`printf '%s\n' '30' | trialssh`, (error, stdout, stderr) => {
|
5
|
+
if (error) {
|
6
|
+
return callback(new Error(`Terjadi kesalahan: ${error.message}`));
|
7
|
+
}
|
8
|
+
if (stderr) {
|
9
|
+
return callback(new Error(`stderr: ${stderr}`));
|
10
|
+
}
|
11
|
+
const cleanOutput = stdout.replace(/\x1B\[[0-9;]*m/g, '').trim();
|
12
|
+
const result = parseTrialSSHOutput(cleanOutput);
|
13
|
+
if (result) {
|
14
|
+
callback(null, {
|
15
|
+
status: "success",
|
16
|
+
message: "Trial SSH berhasil dibuat",
|
17
|
+
data: result
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
callback(new Error('Gagal mem-parsing output trial SSH'));
|
21
|
+
}
|
22
|
+
});
|
23
|
+
};
|
24
|
+
const parseTrialSSHOutput = (output) => {
|
25
|
+
const lines = output.split('\n');
|
26
|
+
const data = {};
|
27
|
+
|
28
|
+
lines.forEach(line => {
|
29
|
+
const parts = line.split(':');
|
30
|
+
if (parts.length === 2) {
|
31
|
+
const key = parts[0].trim();
|
32
|
+
const value = parts[1].trim();
|
33
|
+
data[key] = value;
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
return data;
|
38
|
+
};
|
39
|
+
|
40
|
+
module.exports = trialSSH;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { exec } = require('child_process');
|
2
|
+
|
3
|
+
const trialTrojan = (callback) => {
|
4
|
+
exec(`printf '%s\n' '30' | trialtrojan`, (error, stdout, stderr) => {
|
5
|
+
if (error) {
|
6
|
+
return callback(new Error(`Terjadi kesalahan: ${error.message}`));
|
7
|
+
}
|
8
|
+
if (stderr) {
|
9
|
+
return callback(new Error(`stderr: ${stderr}`));
|
10
|
+
}
|
11
|
+
const cleanOutput = stdout.replace(/\x1B\[[0-9;]*m/g, '').trim();
|
12
|
+
const result = parseTrialTrojanOutput(cleanOutput);
|
13
|
+
if (result) {
|
14
|
+
callback(null, {
|
15
|
+
status: "success",
|
16
|
+
message: "Trial Trojan berhasil dibuat",
|
17
|
+
data: formatTrojanLinks(result)
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
callback(new Error('Gagal mem-parsing output trial Trojan'));
|
21
|
+
}
|
22
|
+
});
|
23
|
+
};
|
24
|
+
const parseTrialTrojanOutput = (output) => {
|
25
|
+
const lines = output.split('\n');
|
26
|
+
const data = [];
|
27
|
+
|
28
|
+
lines.forEach(line => {
|
29
|
+
const match = line.match(/trojan:\/\/(.*)/);
|
30
|
+
if (match) {
|
31
|
+
data.push(match[0]);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
return data;
|
36
|
+
};
|
37
|
+
const formatTrojanLinks = (links) => {
|
38
|
+
return {
|
39
|
+
"TLS Link": links[0],
|
40
|
+
"GRPC Link": links[1]
|
41
|
+
};
|
42
|
+
};
|
43
|
+
|
44
|
+
module.exports = trialTrojan;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
const { exec } = require('child_process');
|
2
|
+
|
3
|
+
const trialVLess = (callback) => {
|
4
|
+
exec(`printf '%s\n' '30' | trialvless`, (error, stdout, stderr) => {
|
5
|
+
if (error) {
|
6
|
+
return callback(new Error(`Terjadi kesalahan: ${error.message}`));
|
7
|
+
}
|
8
|
+
if (stderr) {
|
9
|
+
return callback(new Error(`stderr: ${stderr}`));
|
10
|
+
}
|
11
|
+
const cleanOutput = stdout.replace(/\x1B\[[0-9;]*m/g, '').trim();
|
12
|
+
const result = parseTrialVLessOutput(cleanOutput);
|
13
|
+
if (result) {
|
14
|
+
callback(null, {
|
15
|
+
status: "success",
|
16
|
+
message: "Trial VLess berhasil dibuat",
|
17
|
+
data: formatVLessLinks(result)
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
callback(new Error('Gagal mem-parsing output trial VLess'));
|
21
|
+
}
|
22
|
+
});
|
23
|
+
};
|
24
|
+
|
25
|
+
const parseTrialVLessOutput = (output) => {
|
26
|
+
const lines = output.split('\n');
|
27
|
+
const data = [];
|
28
|
+
|
29
|
+
lines.forEach(line => {
|
30
|
+
const match = line.match(/vless:\/\/(.*)/);
|
31
|
+
if (match) {
|
32
|
+
data.push(match[0]);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
return data;
|
37
|
+
};
|
38
|
+
const formatVLessLinks = (links) => {
|
39
|
+
return {
|
40
|
+
"TLS Link": links[0],
|
41
|
+
"NTLS Link": links[1],
|
42
|
+
"GRPC Link": links[2]
|
43
|
+
};
|
44
|
+
};
|
45
|
+
|
46
|
+
module.exports = trialVLess;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
const { exec } = require('child_process');
|
2
|
+
|
3
|
+
const trialVMess = (callback) => {
|
4
|
+
exec(`printf '%s\n' '30' | trialvmess`, (error, stdout, stderr) => {
|
5
|
+
if (error) {
|
6
|
+
return callback(new Error(`Terjadi kesalahan: ${error.message}`));
|
7
|
+
}
|
8
|
+
if (stderr) {
|
9
|
+
return callback(new Error(`stderr: ${stderr}`));
|
10
|
+
}
|
11
|
+
const cleanOutput = stdout.replace(/\x1B\[[0-9;]*m/g, '').trim();
|
12
|
+
const result = parseTrialVMessOutput(cleanOutput);
|
13
|
+
if (result) {
|
14
|
+
callback(null, {
|
15
|
+
status: "success",
|
16
|
+
message: "Trial VMess berhasil dibuat",
|
17
|
+
data: formatVMessLinks(result)
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
callback(new Error('Gagal mem-parsing output trial VMess'));
|
21
|
+
}
|
22
|
+
});
|
23
|
+
};
|
24
|
+
|
25
|
+
const parseTrialVMessOutput = (output) => {
|
26
|
+
const lines = output.split('\n');
|
27
|
+
const data = [];
|
28
|
+
|
29
|
+
lines.forEach(line => {
|
30
|
+
const match = line.match(/vmess:\/\/(.*)/);
|
31
|
+
if (match) {
|
32
|
+
data.push(match[0]);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
return data;
|
37
|
+
};
|
38
|
+
const formatVMessLinks = (links) => {
|
39
|
+
return {
|
40
|
+
"TLS Link": links[0],
|
41
|
+
"NTLS Link": links[1],
|
42
|
+
"GRPC Link": links[2]
|
43
|
+
};
|
44
|
+
};
|
45
|
+
|
46
|
+
module.exports = trialVMess;
|