Allow :sname as a synonym for :name when reporting services

This commit is contained in:
James Lee 2012-02-21 22:04:34 -07:00
parent 4932a9ca25
commit 72038df7b5
1 changed files with 9 additions and 1 deletions

View File

@ -364,7 +364,8 @@ class DBManager
# +:proto+:: the transport layer protocol (e.g. tcp, udp)
#
# opts may contain
# +:name+:: the application layer protocol (e.g. ssh, mssql, smb)
# +:name+:: the application layer protocol (e.g. ssh, mssql, smb)
# +:sname+:: an alias for the above
#
def report_service(opts)
return if not active
@ -378,6 +379,13 @@ class DBManager
hopts[:name] = hname if hname
hopts[:mac] = hmac if hmac
# Other report_* methods take :sname to mean the service name, so we
# map it here to ensure it ends up in the right place despite not being
# a real column.
if opts[:sname]
opts[:name] = opts.delete(:sname)
end
if addr.kind_of? Host
host = addr
addr = host.address