Cleans up service name normalization.

git-svn-id: file:///home/svn/framework3/trunk@12787 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Tod Beardsley 2011-05-31 19:27:22 +00:00
parent 90bbacd75e
commit c94577448e
3 changed files with 17 additions and 3 deletions

View File

@ -4064,6 +4064,9 @@ class DBManager
REXML::Document.parse_stream(data, parser)
end
# This is starting to be more than just nmap -> msf, other
# things are creeping in here. Consider renaming the method
# and intentionally making it more general.
def nmap_msf_service_map(proto)
return proto unless proto.kind_of? String
case proto.downcase
@ -4076,6 +4079,8 @@ class DBManager
when "http-proxy"; "http"
when "iiimsf"; "db2"
when "oracle-tns"; "oracle"
when /^dns-(udp|tcp)$/; "dns"
when /^dce[\s+]rpc$/; "dcerpc"
else
proto.downcase
end

View File

@ -278,7 +278,12 @@ module Rex
end
end
if @state[:service]
port_hash[:name] = @state[:service]["name"] if @state[:service]["name"] != "<unknown>"
if state[:service]["name"] == "<unknown>"
sname = nil
else
sname = db.nmap_msf_service_map(@state[:service]["name"])
end
port_hash[:name] = sname
end
if @state[:service_fingerprint]
info = []

View File

@ -292,8 +292,12 @@ module Rex
when "port"
port_hash[:port] = v
when "name"
port_hash[:name] = v.to_s.downcase.split("(")[0].strip
port_hash.delete(:name) if port_hash[:name] == "<unknown>"
sname = v.to_s.downcase.split("(")[0].strip
if sname == "<unknown>"
port_hash[:name] = nil
else
port_hash[:name] = db.nmap_msf_service_map(sname)
end
end
end
if @state[:service_fingerprint]