Skip to content

Instantly share code, notes, and snippets.

@pooza
Created January 1, 2023 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pooza/218ee1e7dbbfc2899608ccfa27b3e4dc to your computer and use it in GitHub Desktop.
Save pooza/218ee1e7dbbfc2899608ccfa27b3e4dc to your computer and use it in GitHub Desktop.
鯖のリストから、サ終していそうなところをふるいにかけるやつ
#!/usr/bin/env ruby
require 'resolv'
require 'httparty'
require 'timeout'
File.read('./instances.txt').each_line(chomp: true) do |domain|
Timeout.timeout(10) do
Resolv::DNS.new.getaddress(domain)
code = HTTParty.get("https://#{domain}/nodeinfo/2.0.json").code
raise '404' if code == 404
raise '410' if code == 410
end
rescue => e
puts "#{domain} (#{e.message})"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment