Last active
July 11, 2016 23:16
-
-
Save shutingrz/7690699 to your computer and use it in GitHub Desktop.
webrickを使ったdigのレコードを教えてくれるモノ./digにアクセスしてパラメータhostに名前解決したいホスト名、typeにレコードのタイプを入れる.(OSコマンドインジェクション可能)
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 'webrick' | |
class DigServlet < WEBrick::HTTPServlet::AbstractServlet | |
def do_GET(req,res) | |
host = req.query["host"] | |
type = req.query["t"] | |
res.body = `dig -t #{type} #{host}|grep IN |grep -v \\;` | |
end | |
end | |
srv = WEBrick::HTTPServer.new({ :DocumentRoot => './', | |
:BindAddress => '127.0.0.1', | |
:Port => 80}) | |
srv.mount('/dig', DigServlet) | |
trap("INT"){srv.shutdown} | |
srv.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment