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
| require 'net/dns' | |
| require 'optparse' | |
| require 'net/https' | |
| require 'base64' | |
| require 'uri' | |
| endpoint = "" | |
| opt = OptionParser.new | |
| opt.on('-s endpoint') {|v| endpoint = v } | |
| argv = opt.parse(ARGV) | |
| domain = argv[0] | |
| type = argv[1] || "A" | |
| query = Net::DNS::Packet.new(domain, type) | |
| row_query = Base64.urlsafe_encode64(query.data).delete('=') | |
| res = Net::HTTP.get(URI.parse("#{endpoint}?ct&body=#{row_query}")) | |
| puts Net::DNS::Packet::parse(res) |
Author
flano-yuki
commented
Jan 11, 2018
•
手前味噌ですが、DNS over HTTPSの仕様の解説は
http://asnokaze.hatenablog.com/entry/2017/09/14/015154
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment