Last active
May 17, 2026 00:22
-
-
Save rtldg/c208eddfcfce7bccc827c318ba7348d3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| ["195.133.55.226", "193.58.120.155", "31.13.248.71", "91.132.134.76", "185.232.171.145", "193.233.171.250", "62.133.60.237", "194.58.45.90", "185.107.96.64", "212.23.211.49", "89.169.6.235", "45.159.181.106", "94.16.111.220", "217.196.104.248", "138.124.31.149", "88.151.192.110", "88.151.192.26", "91.238.105.35", "88.151.195.73", "185.172.129.124", "91.231.182.127", "91.199.45.85", "188.127.247.120", "89.169.10.43", "45.140.146.234", "45.89.63.246", "194.156.103.121", "85.238.112.45", "91.208.52.149", "89.169.8.123", "212.162.155.96", "91.149.221.82", "77.83.246.78", "51.68.143.140", "156.253.249.16", "31.130.138.94", "151.252.104.37", "146.185.198.11", "146.185.198.39", "31.130.138.49", "5.44.41.229", "91.244.174.235", "91.244.174.239", "81.16.141.93", "185.244.50.245", "195.238.126.252", "185.135.86.224", "146.185.196.52", "146.185.196.17", "185.248.100.98", "45.89.66.250", "185.221.162.95", "121.127.37.71", "193.19.119.167", "62.173.149.184", "195.133.52.30", "185.22.153.62", "91.219.149.14", "45.143.95.127", "185.117.154.98", "91.217.77.82", "91.219.150.156", "46.17.45.99", "45.89.66.246", "89.111.141.33", "193.162.143.150", "89.111.140.62", "121.127.37.35", "5.252.193.7", "95.183.12.209", "193.19.119.97", "45.89.67.8", "91.219.149.6", "94.142.140.200", "89.111.141.144", "188.127.224.78", "5.8.64.160", "185.22.154.171", "185.158.114.143", "45.144.67.126", "176.32.38.136", "45.89.67.67", "185.117.155.5", "95.183.12.207", "94.142.139.106", "146.185.218.172", "89.253.237.163", "45.89.67.65", "185.246.118.254", "95.183.12.223", "95.183.12.236", "176.113.80.111", "95.183.12.221", "95.183.12.172", "88.151.114.27", "82.97.250.141", "2.56.88.98", "185.188.183.107", "46.29.161.135", "91.217.77.139", "185.173.157.60", "194.226.139.98", "91.217.77.65", "217.199.219.191", "91.217.77.22", "91.217.77.85", "91.217.77.130", "95.183.13.43", "80.66.81.42", "217.199.219.189", "89.36.161.114", "31.40.147.75", "46.173.214.100", "193.42.112.106", "185.40.78.210", "185.40.78.211", "85.143.218.195", "88.151.117.229", "37.27.129.199", "91.217.76.232", "77.222.37.82", "185.80.91.72", "176.32.39.9", "45.89.190.236", "77.222.43.209", "81.200.144.48", "212.113.120.63", "146.185.215.50", "77.232.139.192", "77.222.37.207", "46.229.212.90", "188.225.11.9", "77.232.139.6", "77.222.38.193", "185.43.4.252", "80.85.158.69", "185.41.162.93", "91.201.54.243", "5.181.253.220", "185.93.110.28", "188.240.213.9", "45.136.59.41", "147.45.113.36", "192.145.99.107", "91.230.211.117", "5.189.201.157", "5.189.201.24", "89.22.169.2", "77.83.93.157", "80.90.182.187", "193.218.188.114", "195.58.51.33", "194.38.8.53", "78.153.149.201", "147.45.48.171", "195.62.52.237", "146.185.199.60", "79.141.72.93", "45.153.68.222", "95.170.124.151", "91.221.37.9", "78.153.149.174", "178.250.186.11", "185.173.93.215", "194.38.9.141", "2.59.161.61", "2.59.161.178", "2.59.161.2", "91.240.86.187", "62.109.21.133", "192.124.180.120", "37.230.141.34", "5.101.218.188", "91.243.84.28"] |
This file contains hidden or 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
| ["89.172.222.244", "138.201.127.170", "138.201.127.153", "138.201.127.190", "129.151.206.76", "95.217.56.72", "95.217.56.88", "95.217.56.115", "135.181.236.5", "135.181.236.36", "135.181.236.56", "100.16.65.112", "108.181.244.75", "108.181.244.76", "139.99.62.187"] |
This file contains hidden or 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
| # /// script | |
| # dependencies = [ | |
| # "httpx", | |
| # ] | |
| # /// | |
| import json | |
| import sys | |
| import httpx # 414 URI Too Long @ 8200~ characters | |
| #import requests # 414 URI Too Long @ 7200~ characters | |
| with open("steam_web_api_key.secret") as f: | |
| STEAM_WEB_API_KEY = f.read().strip() | |
| APPID = "240" # css is 240. tf2 is 440. csgo/cs2 is 730 | |
| BASE_URL = "https://api.steampowered.com/IGameServersService/GetServerList/v1/" | |
| def setup_filter(bad_ips): | |
| filter = f"\\appid\\{APPID}\\nor\\2\\gametype\\hidden\\gametype\\valve" | |
| if len(bad_ips) > 0: | |
| filter += f"\\nor\\{len(bad_ips)}" | |
| for ip in bad_ips: | |
| filter += f"\\gameaddr\\{ip}" | |
| return filter | |
| def find_bad_servers(servers): | |
| counts = {} | |
| for server in servers: | |
| ip = server["addr"].split(":")[0] | |
| # Steam Datagram Relay IP | |
| if ip.startswith("169.254."): | |
| continue | |
| counts[ip] = counts.get(ip, 0) + 1 | |
| return [ip for ip in counts.keys() if counts[ip] > 20] | |
| def main(): | |
| global APPID | |
| if len(sys.argv) > 1: | |
| APPID = int(sys.argv[1]) | |
| bad_ips = [] | |
| try: | |
| with open(f"bad_ips{APPID}.json") as f: | |
| bad_ips = json.load(f) | |
| except: | |
| pass | |
| servers = [] | |
| while len(servers) == 0 or len(servers) >= 10_000: | |
| filter = setup_filter(bad_ips) | |
| url = f"{BASE_URL}?filter={filter}&limit=10000&key={STEAM_WEB_API_KEY}" | |
| #print(url) | |
| resp = httpx.get(url, timeout=20.0) | |
| print(resp) | |
| data = json.loads(resp.content.decode("utf-8", "replace")) | |
| servers = data["response"]["servers"] | |
| new_bad_ips = find_bad_servers(servers) | |
| if new_bad_ips: | |
| bad_ips += new_bad_ips | |
| print(new_bad_ips) | |
| with open(f"bad_ips{APPID}.json", "w") as f: | |
| json.dump(bad_ips, f) | |
| servers = [] | |
| else: | |
| break | |
| with open(f"servers{APPID}.json", "w", encoding="utf-8") as f: | |
| #servers = [server for server in servers if not server["addr"].startswith("169.254.")] | |
| json.dump(servers, f) | |
| print("done!") | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment