From 06fd2a4d80f45edad359d52590da1b920d0e1395 Mon Sep 17 00:00:00 2001 From: Carl Bennett Date: Sat, 13 Mar 2021 21:33:40 -0600 Subject: [PATCH] Add bin/discover-dns.php script --- bin/discover-dns.php | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 bin/discover-dns.php diff --git a/bin/discover-dns.php b/bin/discover-dns.php new file mode 100755 index 00000000..22a38e43 --- /dev/null +++ b/bin/discover-dns.php @@ -0,0 +1,54 @@ +#!/usr/bin/env php + + * + * Dec 5 2020 - Generate strings that might resolve, for Blizzard Classic Battle.net servers and other interesting servers. + */ +declare(strict_types=1); + +$regions = [ 'account', 'apac', 'api', 'bot', 'cn', 'emea', 'eu', 'eur', 'forever', 'kor', 'kr', 'na', 'par', 'use', 'usw' ]; +$envs = [ 'live', 'ptr' ]; +$domains = [ 'classic.blizzard.com', 'blizzard.com' ]; + +$patterns = [ + 'connect.{domain}', + 'connect-{env}.{domain}', + 'connect-{region}.{domain}', + 'connect-{env}-{region}-[ab].{domain}', +]; + +$names = []; + +foreach ($patterns as $pattern) +{ + foreach ($domains as $domain) + { + foreach ($regions as $region) + { + foreach ($envs as $env) + { + $name = $pattern; + + $name = str_replace('{domain}', $domain, $name); + $name = str_replace('{region}', $region, $name); + $name = str_replace('{env}', $env, $name); + + if (stripos($name, '[ab]') !== false) + { + $names[str_ireplace('[ab]', 'a', $name)] = true; + $names[str_ireplace('[ab]', 'b', $name)] = true; + $name = str_ireplace('-[ab]', '', $name); + } + + $names[$name] = true; + } + } + } +} + +$names = array_keys($names); +sort($names); + +echo json_encode($names, JSON_PRETTY_PRINT) . PHP_EOL; +