From 274404716f14d5d3c128e8aa36b5d55346cf799e Mon Sep 17 00:00:00 2001 From: andurin Date: Fri, 6 Apr 2012 14:47:36 +0200 Subject: [PATCH] Show vuln.info on db_vuln command IssueID #5837 --- lib/msf/ui/console/command_dispatcher/db.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/db.rb b/lib/msf/ui/console/command_dispatcher/db.rb index f686edb5a4..04a3fbe5fa 100644 --- a/lib/msf/ui/console/command_dispatcher/db.rb +++ b/lib/msf/ui/console/command_dispatcher/db.rb @@ -526,6 +526,7 @@ class Db print_line " -p,--port List vulns matching this port spec" print_line " -s List vulns matching these service names" print_line " -S,--search Search string to filter by" + print_line " -i,--info Display Vuln Info" print_line print_line "Examples:" print_line " vulns -p 1-65536 # only vulns with associated services" @@ -541,6 +542,7 @@ class Db port_ranges = [] svcs = [] search_term = nil + show_info = false # Short-circuit help if args.delete "-h" @@ -571,6 +573,8 @@ class Db svcs = service.split(/[\s]*,[\s]*/) when '-S', '--search' search_term = /#{args.shift}/nmi + when '-i', '--info' + show_info = true else # Anything that wasn't an option is a host to search for unless (arg_host_range(arg, host_ranges)) @@ -600,11 +604,12 @@ class Db next unless ports.empty? or ports.include? vuln.service.port # Same for service names next unless svcs.empty? or svcs.include?(vuln.service.name) - print_status("Time: #{vuln.created_at} Vuln: host=#{host.address} port=#{vuln.service.port} proto=#{vuln.service.proto} name=#{vuln.name} refs=#{reflist.join(',')}") + print_status("Time: #{vuln.created_at} Vuln: host=#{host.address} name=#{vuln.name} refs=#{reflist.join(',')} #{show_info ? "info=#{vuln.info}" : ""}") + else # This vuln has no service, so it can't match next unless ports.empty? and svcs.empty? - print_status("Time: #{vuln.created_at} Vuln: host=#{host.address} name=#{vuln.name} refs=#{reflist.join(',')}") + print_status("Time: #{vuln.created_at} Vuln: host=#{host.address} name=#{vuln.name} refs=#{reflist.join(',')} #{show_info ? "info=#{vuln.info}" : ""}") end end end