Raise Msf::OptionValidateError when the PORTS option is invalid
Instead of print_error for invalid ports, modules should be raising Msf::OptionValidateError to warn the user about the invalid input.
This commit is contained in:
parent
8af81c98c8
commit
ee87f357b0
|
@ -77,6 +77,10 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
||||
|
||||
if ports.empty?
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
ports.each_with_index do |port,i|
|
||||
p.tcp_dst = port
|
||||
p.tcp_src = rand(64511)+1024
|
||||
|
|
|
@ -56,6 +56,10 @@ class Metasploit3 < Msf::Auxiliary
|
|||
dead = false
|
||||
portlist = Rex::Socket.portspec_crack(datastore['PORTS'])
|
||||
|
||||
if portlist.empty?
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
vprint_status("[#{rhost}] Verifying manual testing is not required...")
|
||||
|
||||
manual = false
|
||||
|
|
|
@ -50,8 +50,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
||||
|
||||
if ports.empty?
|
||||
print_error("Error: No valid ports specified")
|
||||
return
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
to = (datastore['TIMEOUT'] || 500).to_f / 1000.0
|
||||
|
|
|
@ -43,8 +43,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
||||
|
||||
if ports.empty?
|
||||
print_error("Error: No valid ports specified")
|
||||
return
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
datastore['RHOST'] = datastore['BOUNCEHOST']
|
||||
|
|
|
@ -48,8 +48,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
||||
|
||||
if ports.empty?
|
||||
print_error("Error: No valid ports specified")
|
||||
return
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
to = (datastore['TIMEOUT'] || 500).to_f / 1000.0
|
||||
|
|
|
@ -41,8 +41,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
||||
|
||||
if ports.empty?
|
||||
print_error("Error: No valid ports specified")
|
||||
return
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
while(ports.length > 0)
|
||||
|
|
|
@ -50,8 +50,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
||||
|
||||
if ports.empty?
|
||||
print_error("Error: No valid ports specified")
|
||||
return
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
to = (datastore['TIMEOUT'] || 500).to_f / 1000.0
|
||||
|
|
|
@ -282,8 +282,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
ports = build_sap_ports(ports)
|
||||
|
||||
if ports.empty?
|
||||
print_error('Error: No valid ports specified')
|
||||
return
|
||||
raise Msf::OptionValidateError.new(['PORTS'])
|
||||
end
|
||||
|
||||
print_status("Scanning #{ip}")
|
||||
|
|
Loading…
Reference in New Issue