Changed output format for RubyDNS to be "BeEF-compliant".

RubyDNS's logger now uses BeEF's print-related functions. Debug
messages regarding queries can be enabled using --verbose.
This commit is contained in:
soh_cah_toa
2013-05-05 22:19:54 -04:00
parent d22373d828
commit cbd815c519
4 changed files with 62 additions and 0 deletions

View File

@@ -20,3 +20,4 @@ end
require 'extensions/dns/api'
require 'extensions/dns/dns'
require 'extensions/dns/ruby'

7
extensions/dns/ruby.rb Normal file
View File

@@ -0,0 +1,7 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
require 'extensions/dns/ruby/logger'
require 'extensions/dns/ruby/rubydns'

View File

@@ -0,0 +1,23 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# Overrives the logger used by RubyDNS to use BeEF's print_info() and friends
class Logger
def debug(msg)
print_debug "DNS Server: #{msg}"
end
def info(msg)
print_info "DNS Server: #{msg}"
end
def error(msg)
print_error "DNS Server: #{msg}"
end
end

View File

@@ -0,0 +1,31 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module RubyDNS
# Overrides RubyDNS::run_server() to behave exactly the same, minus the output
def self.run_server(options = {}, &block)
server = RubyDNS::Server.new(&block)
options[:listen] ||= [[:udp, "0.0.0.0", 53], [:tcp, "0.0.0.0", 53]]
EventMachine.run do
server.fire(:setup)
options[:listen].each do |spec|
if spec[0] == :udp
EventMachine.open_datagram_socket(spec[1], spec[2], UDPHandler, server)
elsif spec[0] == :tcp
EventMachine.start_server(spec[1], spec[2], TCPHandler, server)
end
end
server.fire(:start)
end
server.fire(:stop)
end
end