Skip to content

Commit 0d6fb3d

Browse files
committed
vulns command with -R --rhosts
1 parent ec28992 commit 0d6fb3d

File tree

1 file changed

+11
-0
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+11
-0
lines changed

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ def cmd_vulns_help
706706
print_line " -p,--port <portspec> List vulns matching this port spec"
707707
print_line " -s <svc names> List vulns matching these service names"
708708
print_line " -S,--search Search string to filter by"
709+
print_line " -R,--rhosts Set RHOSTS from the results of the search"
709710
print_line " -i,--info Display Vuln Info"
710711
print_line
711712
print_line "Examples:"
@@ -721,7 +722,10 @@ def cmd_vulns(*args)
721722
host_ranges = []
722723
port_ranges = []
723724
svcs = []
725+
rhosts = []
726+
724727
search_term = nil
728+
set_rhosts = nil
725729
show_info = false
726730

727731
# Short-circuit help
@@ -754,6 +758,8 @@ def cmd_vulns(*args)
754758
search_term = /#{args.shift}/nmi
755759
when '-i', '--info'
756760
show_info = true
761+
when '-R','--rhosts'
762+
set_rhosts = true
757763
else
758764
# Anything that wasn't an option is a host to search for
759765
unless (arg_host_range(arg, host_ranges))
@@ -790,9 +796,14 @@ def cmd_vulns(*args)
790796
next unless ports.empty? and svcs.empty?
791797
print_status("Time: #{vuln.created_at} Vuln: host=#{host.address} name=#{vuln.name} refs=#{reflist.join(',')} #{(show_info && vuln.info) ? "info=#{vuln.info}" : ""}")
792798
end
799+
if set_rhosts
800+
addr = (host.scope ? host.address + '%' + host.scope : host.address )
801+
rhosts << addr
793802
end
794803
end
795804
end
805+
set_rhosts_from_addrs(rhosts.uniq) if set_rhosts
806+
end
796807
}
797808
end
798809

0 commit comments

Comments
 (0)