diff --git a/extensions/dns/dns.rb b/extensions/dns/dns.rb index c562dc603..2cf90e66d 100644 --- a/extensions/dns/dns.rb +++ b/extensions/dns/dns.rb @@ -76,6 +76,18 @@ module BeEF end end + # Removes the given DNS rule. + # + # @param id [String] rule identifier + # + # @return [Boolean] true if rule was removed, otherwise false + def remove_rule(id) + @lock.synchronize do + rule = BeEF::Core::Models::Dns::Rule.get(id) + rule.nil? ? false : rule.destroy + end + end + # Entry point for processing incoming DNS requests. Attempts to find a matching rule and # sends back its associated response. #