From 7041102df748126945b59180b70804169be3e11f Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Wed, 6 Oct 2010 04:18:01 +0000 Subject: [PATCH] Fixes #2848, uses the half-guessing method of figuring out the "right" protocol. git-svn-id: file:///home/svn/framework3/trunk@10562 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/db.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/msf/core/db.rb b/lib/msf/core/db.rb index 218644b090..df22604c79 100644 --- a/lib/msf/core/db.rb +++ b/lib/msf/core/db.rb @@ -825,10 +825,19 @@ class DBManager vuln = host.vulns.find_or_initialize_by_name(name, :include => :refs) end - if opts[:port] and opts[:proto] - vuln.service = host.services.find_or_create_by_port_and_proto(opts[:port], opts[:proto]) - elsif opts[:port] - vuln.service = host.services.find_or_create_by_port_and_proto(opts[:port], "tcp") + if opts[:port] + proto = nil + case opts[:proto].to_s.downcase # Catch incorrect usages, as in report_note + when 'tcp','udp' + proto = opts[:proto] + when 'dns','snmp','dhcp' + proto = 'udp' + sname = opts[:proto] + else + proto = 'tcp' + sname = opts[:proto] + end + vuln.service = host.services.find_or_create_by_port_and_proto(opts[:port], proto) end if rids