Last active
January 16, 2025 14:15
-
-
Save AndyIsHereBoi/eed5853873e8296a249f7136fc8ad040 to your computer and use it in GitHub Desktop.
Scans Discord for its voice servers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dns from 'node:dns'; | |
import fetch from 'node-fetch'; | |
import regions from "./regions.json" assert { type: "json" }; | |
import fs from 'node:fs'; | |
const IPINFO_API_KEY = "key here"; | |
const loops = 15000; | |
var regionscomplete = {}; | |
async function processDomains() { | |
for (const region of regions) { | |
for (let i = 0; i < loops; i++) { | |
const domain = `${region}${i + 1}.discord.gg`; | |
console.log(domain) | |
try { | |
const address = await resolveDNS(domain); | |
await resolveData(address, domain, region); | |
} catch (error) { | |
// console.error(`Error resolving ${domain}:`, error); | |
} | |
} | |
} | |
} | |
function resolveDNS(domain) { | |
return new Promise((resolve, reject) => { | |
dns.lookup(domain, (err, address) => { | |
if (err) { | |
reject(err); | |
} else { | |
resolve(address); | |
} | |
}); | |
}); | |
}; | |
async function resolveData(ip, dnsDomain, region) { | |
console.log('getting ip info'); | |
try { | |
const response = await fetch(`https://ipinfo.io/${ip}/json?token=${IPINFO_API_KEY}`); | |
const responseData = await response.json(); | |
const completeObject = { | |
"ip": ip, | |
"dns": dnsDomain, | |
"city": responseData.city, | |
"region": responseData.region, | |
"country": responseData.country, | |
"org": responseData.org | |
}; | |
console.log(completeObject); | |
pushRegionData(region, completeObject) | |
} catch (error) { | |
console.error(`Error fetching IP info for ${dnsDomain}:`, error); | |
}; | |
}; | |
function pushRegionData(region, data) { | |
if (!regionscomplete.hasOwnProperty(region)) { | |
regionscomplete[region] = []; // initialize an empty array for the region if it doesn't exist already | |
}; | |
regionscomplete[region].push(data); // add the resolved data to the region array | |
}; | |
processDomains(); | |
process.on('exit', beforeProcessExit); | |
function beforeProcessExit() { | |
const jsonContent = JSON.stringify(regionscomplete); | |
fs.writeFileSync('./output.json', jsonContent, (err) => { | |
if (err) { | |
console.error('Error writing JSON file:', err); | |
} else { | |
console.log('JSON file saved successfully!'); | |
} | |
}); | |
console.log("Before process exit"); | |
console.log(regionscomplete); | |
// Write the JSON string to a file | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "discord-voice-servers", | |
"version": "0.0.1", | |
"description": "Resolve all discord voice server IPS", | |
"main": "index.js", | |
"type": "module", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "AndyIsHereBoi", | |
"license": "ISC", | |
"dependencies": { | |
"axios": "^1.6.5", | |
"node-fetch": "^3.3.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"atlanta", | |
"brazil", | |
"bucharest", | |
"buenos-aires", | |
"dammam", | |
"dubai", | |
"finland", | |
"frankfurt", | |
"hongkong", | |
"india", | |
"jakarta", | |
"japan", | |
"madrid", | |
"milan", | |
"montreal", | |
"newark", | |
"oregon", | |
"rotterdam", | |
"russia", | |
"santa-clara", | |
"santiago", | |
"seattle", | |
"singapore", | |
"south-korea", | |
"southafrica", | |
"st-pete", | |
"stage-scale", | |
"stockholm", | |
"sydney", | |
"tel-aviv", | |
"us-central", | |
"us-east", | |
"us-south", | |
"us-west", | |
"warsaw" | |
] |
ill scan for updates ones later, ganna take exponentially longer with how many it is lol
@bhdrozgn i updated the regions, will do a scan now. will take a few hours probabyl
Thank you!
Hi, they are using the same ips for API request too? I need to test some blockage at my end. Thanks
Hi, they are using the same ips for API request too? I need to test some blockage at my end. Thanks
I'm not sure
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you. I found that there are other regions other than regions in
regions.json
: