use implicit RuntimeError

bug/bundler_fix
Brent Cook 2017-10-31 04:53:14 -05:00
parent 9389052f61
commit aa0ac57238
7 changed files with 21 additions and 21 deletions

View File

@ -43,7 +43,7 @@ def rport
end
def set_nmap_cmd
self.nmap_bin || (raise RuntimeError, "Cannot locate nmap binary")
self.nmap_bin || (raise "Cannot locate nmap binary")
nmap_set_log
nmap_add_ports
nmap_cmd = [self.nmap_bin]
@ -54,7 +54,7 @@ def set_nmap_cmd
end
def get_nmap_ver
self.nmap_bin || (raise RuntimeError, "Cannot locate nmap binary")
self.nmap_bin || (raise "Cannot locate nmap binary")
res = ""
nmap_cmd = [self.nmap_bin]
nmap_cmd << "--version"
@ -84,7 +84,7 @@ def nmap_version_at_least?(test_ver=nil)
end
def nmap_build_args
raise RuntimeError, "nmap_build_args() not defined by #{self.refname}"
raise "nmap_build_args() not defined by #{self.refname}"
end
def nmap_run
@ -159,7 +159,7 @@ end
# A helper to add in rport or rports as a -p argument
def nmap_add_ports
if not nmap_validate_rports
raise RuntimeError, "Cannot continue without a valid port list."
raise "Cannot continue without a valid port list."
end
port_arg = "-p \"#{datastore['RPORT'] || rports}\""
if nmap_validate_arg(port_arg)
@ -237,7 +237,7 @@ end
# module to ferret out whatever's interesting in this host
# object.
def nmap_hosts(&block)
@nmap_bin || (raise RuntimeError, "Cannot locate the nmap binary.")
@nmap_bin || (raise "Cannot locate the nmap binary.")
fh = self.nmap_log[0]
nmap_data = fh.read(fh.stat.size)
# fh.unlink

View File

@ -44,7 +44,7 @@ module Msf::DBManager::Report
unless artifact.valid?
errors = artifact.errors.full_messages.join('; ')
raise RuntimeError, "Artifact to be imported is not valid: #{errors}"
raise "Artifact to be imported is not valid: #{errors}"
end
artifact.save
end
@ -66,7 +66,7 @@ module Msf::DBManager::Report
unless report.valid?
errors = report.errors.full_messages.join('; ')
raise RuntimeError, "Report to be imported is not valid: #{errors}"
raise "Report to be imported is not valid: #{errors}"
end
report.state = :complete # Presume complete since it was exported
report.save

View File

@ -46,11 +46,11 @@ class MetasploitModule < Msf::Auxiliary
@interface = datastore['INTERFACE'] || Pcap.lookupdev
shost = datastore['SHOST']
shost ||= get_ipv4_addr(@interface) if @netifaces
raise RuntimeError, 'SHOST should be defined' unless shost
raise 'SHOST should be defined' unless shost
smac = datastore['SMAC']
smac ||= get_mac(@interface) if @netifaces
raise RuntimeError, 'SMAC should be defined' unless smac
raise 'SMAC should be defined' unless smac
begin

View File

@ -49,11 +49,11 @@ class MetasploitModule < Msf::Auxiliary
@interface = datastore['INTERFACE'] || Pcap.lookupdev
@shost = datastore['SHOST']
@shost ||= get_ipv4_addr(@interface) if @netifaces
raise RuntimeError, 'SHOST should be defined' unless @shost
raise 'SHOST should be defined' unless @shost
@smac = datastore['SMAC']
@smac ||= get_mac(@interface) if @netifaces
raise RuntimeError, 'SMAC should be defined' unless @smac
raise 'SMAC should be defined' unless @smac
addrs = []

View File

@ -161,12 +161,12 @@ class MetasploitModule < Msf::Auxiliary
@interface = datastore['INTERFACE'] || Pcap.lookupdev
@shost = datastore['SHOST']
@shost ||= get_ipv4_addr(@interface) if @netifaces
raise RuntimeError, 'SHOST should be defined' unless @shost
raise 'SHOST should be defined' unless @shost
@smac = datastore['SMAC']
@smac ||= get_mac(@interface) if @netifaces
@smac ||= ipv6_mac
raise RuntimeError, 'SMAC should be defined' unless @smac
raise 'SMAC should be defined' unless @smac
# Send router advertisement
print_status("Sending router advertisement...")

View File

@ -153,7 +153,7 @@ class MetasploitModule < Msf::Auxiliary
icmp_response, contents = icmp_packet(packet, datastore['RESP_START'])
if not icmp_response
raise RuntimeError, "Could not build ICMP response"
raise "Could not build ICMP response"
else
# send response packet icmp_pkt
send_icmp(icmp_response, contents)
@ -172,7 +172,7 @@ class MetasploitModule < Msf::Auxiliary
icmp_response, contents = icmp_packet(packet, datastore['RESP_END'])
if not icmp_response
raise RuntimeError, "Could not build ICMP response"
raise "Could not build ICMP response"
else
# send response packet icmp_pkt
send_icmp(icmp_response, contents)
@ -192,7 +192,7 @@ class MetasploitModule < Msf::Auxiliary
icmp_response, contents = icmp_packet(packet, datastore['RESP_CONT'])
if not icmp_response
raise RuntimeError, "Could not build ICMP response"
raise "Could not build ICMP response"
else
# send response packet icmp_pkt
send_icmp(icmp_response, contents)

View File

@ -72,8 +72,8 @@ class MetasploitModule < Msf::Auxiliary
@interface = get_interface_guid(@interface)
@smac = datastore['SMAC']
@smac ||= get_mac(@interface) if @netifaces
raise RuntimeError, 'SMAC is not defined and can not be guessed' unless @smac
raise RuntimeError, 'Source MAC is not in correct format' unless is_mac?(@smac)
raise 'SMAC is not defined and can not be guessed' unless @smac
raise 'Source MAC is not in correct format' unless is_mac?(@smac)
@sip = datastore['LOCALSIP']
@sip ||= get_ipv4_addr(@interface) if @netifaces
@ -162,7 +162,7 @@ class MetasploitModule < Msf::Auxiliary
def arp_poisoning
lsmac = datastore['LOCALSMAC'] || @smac
raise RuntimeError, 'Local Source Mac is not in correct format' unless is_mac?(lsmac)
raise 'Local Source Mac is not in correct format' unless is_mac?(lsmac)
dhosts_range = Rex::Socket::RangeWalker.new(datastore['DHOSTS'])
@dhosts = []
@ -199,7 +199,7 @@ class MetasploitModule < Msf::Auxiliary
end
Kernel.select(nil, nil, nil, 0.50)
end
raise RuntimeError, "No hosts found" unless @dsthosts_cache.length > 0
raise "No hosts found" unless @dsthosts_cache.length > 0
# Build the local src hosts cache
if datastore['BIDIRECTIONAL']
@ -236,7 +236,7 @@ class MetasploitModule < Msf::Auxiliary
end
Kernel.select(nil, nil, nil, 0.50)
end
raise RuntimeError, "No hosts found" unless @srchosts_cache.length > 0
raise "No hosts found" unless @srchosts_cache.length > 0
end
if datastore['AUTO_ADD']