From 72038df7b51477cc1ff8cb3de48a8655b633f7a7 Mon Sep 17 00:00:00 2001 From: James Lee Date: Tue, 21 Feb 2012 22:04:34 -0700 Subject: [PATCH] Allow :sname as a synonym for :name when reporting services --- lib/msf/core/db.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/msf/core/db.rb b/lib/msf/core/db.rb index 8dd3ed4ee9..66fde6a1fd 100644 --- a/lib/msf/core/db.rb +++ b/lib/msf/core/db.rb @@ -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