Update server.js
Browse files
server.js
CHANGED
@@ -16,12 +16,9 @@ wss.on('connection', (ws) => {
|
|
16 |
console.log(`Received message: ${message}`);
|
17 |
|
18 |
// Convert message (Buffer) to string
|
19 |
-
|
20 |
|
21 |
-
//
|
22 |
-
command = `sudo ${command}`;
|
23 |
-
|
24 |
-
// Execute the command with superuser privileges
|
25 |
exec(command, (error, stdout, stderr) => {
|
26 |
if (error) {
|
27 |
ws.send(`Error: ${error.message}`);
|
|
|
16 |
console.log(`Received message: ${message}`);
|
17 |
|
18 |
// Convert message (Buffer) to string
|
19 |
+
const command = message.toString();
|
20 |
|
21 |
+
// Execute the command without sudo
|
|
|
|
|
|
|
22 |
exec(command, (error, stdout, stderr) => {
|
23 |
if (error) {
|
24 |
ws.send(`Error: ${error.message}`);
|