Implemented basic nameserver and configured it to run on BeEF startup.
It's worth noting that RubyDNS currently displays a lot of messy output. This needs to be addressed before moving any further.
This commit is contained in:
33
extensions/dns/api.rb
Normal file
33
extensions/dns/api.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# 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 BeEF
|
||||
module Extension
|
||||
module DNS
|
||||
module API
|
||||
|
||||
module NameserverHandler
|
||||
|
||||
BeEF::API::Registrar.instance.register(BeEF::Extension::DNS::API::NameserverHandler,
|
||||
BeEF::API::Server,
|
||||
'pre_http_start')
|
||||
|
||||
def self.pre_http_start(http_hook_server)
|
||||
config = BeEF::Core::Configuration.instance
|
||||
|
||||
address = config.get('beef.extension.dns.address')
|
||||
port = config.get('beef.extension.dns.port')
|
||||
|
||||
Thread.new { BeEF::Extension::DNS::DNS.new(address, port) }
|
||||
|
||||
print_info "DNS server: #{address}:#{port}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
33
extensions/dns/dns.rb
Normal file
33
extensions/dns/dns.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# 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 BeEF
|
||||
module Extension
|
||||
module DNS
|
||||
|
||||
class DNS
|
||||
|
||||
UPSTREAM = RubyDNS::Resolver.new([[:udp, '8.8.8.8', 53], [:tcp, '8.8.8.8', 53]])
|
||||
|
||||
def initialize(address, port)
|
||||
@address = address
|
||||
@port = port
|
||||
|
||||
run_server
|
||||
end
|
||||
|
||||
def run_server
|
||||
RubyDNS::run_server(:listen => [[:udp, @address, @port]]) do
|
||||
otherwise do |transaction|
|
||||
transaction.passthrough!(UPSTREAM)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -17,3 +17,6 @@ module DNS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require 'extensions/dns/api'
|
||||
require 'extensions/dns/dns'
|
||||
|
||||
Reference in New Issue
Block a user