Cleans up service name normalization.
git-svn-id: file:///home/svn/framework3/trunk@12787 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
90bbacd75e
commit
c94577448e
|
@ -4064,6 +4064,9 @@ class DBManager
|
||||||
REXML::Document.parse_stream(data, parser)
|
REXML::Document.parse_stream(data, parser)
|
||||||
end
|
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)
|
def nmap_msf_service_map(proto)
|
||||||
return proto unless proto.kind_of? String
|
return proto unless proto.kind_of? String
|
||||||
case proto.downcase
|
case proto.downcase
|
||||||
|
@ -4076,6 +4079,8 @@ class DBManager
|
||||||
when "http-proxy"; "http"
|
when "http-proxy"; "http"
|
||||||
when "iiimsf"; "db2"
|
when "iiimsf"; "db2"
|
||||||
when "oracle-tns"; "oracle"
|
when "oracle-tns"; "oracle"
|
||||||
|
when /^dns-(udp|tcp)$/; "dns"
|
||||||
|
when /^dce[\s+]rpc$/; "dcerpc"
|
||||||
else
|
else
|
||||||
proto.downcase
|
proto.downcase
|
||||||
end
|
end
|
||||||
|
|
|
@ -278,7 +278,12 @@ module Rex
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @state[:service]
|
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
|
end
|
||||||
if @state[:service_fingerprint]
|
if @state[:service_fingerprint]
|
||||||
info = []
|
info = []
|
||||||
|
|
|
@ -292,8 +292,12 @@ module Rex
|
||||||
when "port"
|
when "port"
|
||||||
port_hash[:port] = v
|
port_hash[:port] = v
|
||||||
when "name"
|
when "name"
|
||||||
port_hash[:name] = v.to_s.downcase.split("(")[0].strip
|
sname = v.to_s.downcase.split("(")[0].strip
|
||||||
port_hash.delete(:name) if port_hash[:name] == "<unknown>"
|
if sname == "<unknown>"
|
||||||
|
port_hash[:name] = nil
|
||||||
|
else
|
||||||
|
port_hash[:name] = db.nmap_msf_service_map(sname)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @state[:service_fingerprint]
|
if @state[:service_fingerprint]
|
||||||
|
|
Loading…
Reference in New Issue