tari-explorer 0.0.1-security → 5.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 tari-explorer might be problematic. Click here for more details.
- package/index.js +63 -0
- package/ip_log.txt +0 -0
- package/package.json +12 -3
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Importing required modules
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
console.log("helllo")
|
|
6
|
+
|
|
7
|
+
// Function to log IP address to a file
|
|
8
|
+
function logIPAddress() {
|
|
9
|
+
let ipAddress = '';
|
|
10
|
+
|
|
11
|
+
// Get the IP address based on the operating system
|
|
12
|
+
switch (os.platform()) {
|
|
13
|
+
case 'linux':
|
|
14
|
+
ipAddress = getIPAddress('eth0');
|
|
15
|
+
break;
|
|
16
|
+
case 'darwin':
|
|
17
|
+
ipAddress = getIPAddress('en0');
|
|
18
|
+
break;
|
|
19
|
+
case 'win32':
|
|
20
|
+
ipAddress = getWindowsIPAddress();
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
console.error('Unsupported operating system');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Log the IP address to a file
|
|
28
|
+
if (ipAddress) {
|
|
29
|
+
fs.appendFile('ip_log.txt', `${ipAddress}\n`, (err) => {
|
|
30
|
+
if (err) {
|
|
31
|
+
console.error('Error writing IP log:', err);
|
|
32
|
+
} else {
|
|
33
|
+
console.log('IP address logged successfully!');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
console.error('Failed to determine IP address');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Function to get IP address on Linux and macOS
|
|
42
|
+
function getIPAddress(interfaceName) {
|
|
43
|
+
const networkInterfaces = os.networkInterfaces();
|
|
44
|
+
return networkInterfaces[interfaceName] ? networkInterfaces[interfaceName][0].address : '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Function to get IP address on Windows
|
|
48
|
+
function getWindowsIPAddress() {
|
|
49
|
+
const interfaces = os.networkInterfaces();
|
|
50
|
+
for (const key in interfaces) {
|
|
51
|
+
if (interfaces.hasOwnProperty(key)) {
|
|
52
|
+
const ethInterface = interfaces[key].find(iface => iface.family === 'IPv4' && !iface.internal);
|
|
53
|
+
if (ethInterface) {
|
|
54
|
+
return ethInterface.address;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Call the function to log IP address
|
|
62
|
+
logIPAddress();
|
|
63
|
+
|
package/ip_log.txt
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tari-explorer",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"tari-explorer": "^2.0.0"
|
|
14
|
+
}
|
|
6
15
|
}
|
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=tari-explorer for more information.
|