Various fixes for the DNS extension code.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
beef:
|
||||
extension:
|
||||
dns:
|
||||
enable: true
|
||||
enable: false
|
||||
name: 'DNS Server'
|
||||
authors: ['soh_cah_toa']
|
||||
address: '127.0.0.1'
|
||||
|
||||
@@ -18,8 +18,9 @@ module BeEF
|
||||
end
|
||||
end
|
||||
|
||||
require 'extensions/dns/api'
|
||||
require 'extensions/dns/dns'
|
||||
require 'extensions/dns/model'
|
||||
require 'extensions/dns/rest/dns'
|
||||
require 'extensions/dns/ruby'
|
||||
#TODO antisnatchor: uncomment this when code will be stable
|
||||
#require 'extensions/dns/api'
|
||||
#require 'extensions/dns/dns'
|
||||
#require 'extensions/dns/model'
|
||||
#require 'extensions/dns/rest/dns'
|
||||
#require 'extensions/dns/ruby'
|
||||
|
||||
@@ -90,10 +90,10 @@ module BeEF
|
||||
|
||||
if response.class == Array
|
||||
if response.length == 0
|
||||
raise InvalidJsonError, 'Empty "reponse" key passed to endpoint /api/dns/rule'
|
||||
raise InvalidJsonError, 'Empty "response" key passed to endpoint /api/dns/rule'
|
||||
end
|
||||
else
|
||||
raise InvalidJsonError, 'Non-array "reponse" key passed to endpoint /api/dns/rule'
|
||||
raise InvalidJsonError, 'Non-array "response" key passed to endpoint /api/dns/rule'
|
||||
end
|
||||
|
||||
unless BeEF::Filters.is_non_empty_string?(pattern)
|
||||
|
||||
@@ -60,6 +60,7 @@ module RubyDNS
|
||||
BeEF::Core::Models::Dns::Rule.each do |rule|
|
||||
id = rule.id
|
||||
pattern = [rule.pattern, rule.type]
|
||||
#TODO antisnatchor: potentially unsafe (although input is from data already stored in the databse)
|
||||
block = eval rule.block
|
||||
|
||||
regex = pattern[0]
|
||||
@@ -98,6 +99,7 @@ module RubyDNS
|
||||
|
||||
case block
|
||||
when String
|
||||
#TODO antisnatchor: potentially unsafe (make sure block_src is safe or change this logic)
|
||||
@rules << Rule.new(id, pattern, eval(block_src))
|
||||
when Proc
|
||||
@rules << Rule.new(id, pattern, block)
|
||||
|
||||
Reference in New Issue
Block a user