Implemented DELETE handler for removing DNS rules.

This commit is contained in:
soh_cah_toa
2013-05-26 23:26:58 -04:00
parent 27b1b530ef
commit 38284d5eaa

View File

@@ -89,7 +89,23 @@ module DNS
print_error e.message
halt 400
rescue Exception => e
print_error "Invalid JSON input passed to endpoint /api/dns/rule"
print_error 'Invalid JSON input passed to endpoint /api/dns/rule'
halt 400
end
end
# Removes a rule given its id
delete '/rule/:id' do
begin
id = params[:id]
unless BeEF::Filters.alphanums_only?(id)
raise StandardError, 'Invalid id passed to endpoint /api/dns/rule/:id'
end
BeEF::Extension::DNS::DNS.instance.remove_rule(id)
rescue StandardError => e
print_error e.message
halt 400
end
end