Skip to content

Instantly share code, notes, and snippets.

@shutingrz
Last active July 11, 2016 23:16
Show Gist options
  • Save shutingrz/7690699 to your computer and use it in GitHub Desktop.
Save shutingrz/7690699 to your computer and use it in GitHub Desktop.
webrickを使ったdigのレコードを教えてくれるモノ./digにアクセスしてパラメータhostに名前解決したいホスト名、typeにレコードのタイプを入れる.(OSコマンドインジェクション可能)
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