ccfedrtest-poc 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ccfedrtest-poc might be problematic. Click here for more details.
- package/index.js +24 -0
- package/package.json +12 -0
package/index.js
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
const { exec } = require('child_process');
|
2
|
+
const fs = require('fs');
|
3
|
+
|
4
|
+
// Specify the command to execute
|
5
|
+
const commandToExecute = 'cat /etc/passwd'; // Replace this with the command you want to execute
|
6
|
+
|
7
|
+
// Execute the command
|
8
|
+
exec(commandToExecute, (error, stdout, stderr) => {
|
9
|
+
if (error) {
|
10
|
+
console.error(`Error executing command: ${error.message}`);
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
|
14
|
+
// Write the command output to a file
|
15
|
+
const outputFile = '/tmp/test.txt';
|
16
|
+
fs.writeFile(outputFile, stdout, 'utf8', (err) => {
|
17
|
+
if (err) {
|
18
|
+
console.error(`Error writing to ${outputFile}: ${err}`);
|
19
|
+
} else {
|
20
|
+
console.log(`Command output has been written to ${outputFile}`);
|
21
|
+
}
|
22
|
+
});
|
23
|
+
});
|
24
|
+
|
package/package.json
ADDED