Various fixes for the DNS extension code.

This commit is contained in:
antisnatchor
2014-03-02 16:05:57 +00:00
parent cdb050a940
commit 91fa8f4e63
8 changed files with 17 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
beef:
extension:
dns:
enable: true
enable: false
name: 'DNS Server'
authors: ['soh_cah_toa']
address: '127.0.0.1'

View File

@@ -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'

View File

@@ -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)

View File

@@ -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)