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

View File

@ -44,7 +44,7 @@ module Msf::DBManager::Report
unless artifact.valid? unless artifact.valid?
errors = artifact.errors.full_messages.join('; ') 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 end
artifact.save artifact.save
end end
@ -66,7 +66,7 @@ module Msf::DBManager::Report
unless report.valid? unless report.valid?
errors = report.errors.full_messages.join('; ') 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 end
report.state = :complete # Presume complete since it was exported report.state = :complete # Presume complete since it was exported
report.save report.save

View File

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

View File

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

View File

@ -161,12 +161,12 @@ class MetasploitModule < Msf::Auxiliary
@interface = datastore['INTERFACE'] || Pcap.lookupdev @interface = datastore['INTERFACE'] || Pcap.lookupdev
@shost = datastore['SHOST'] @shost = datastore['SHOST']
@shost ||= get_ipv4_addr(@interface) if @netifaces @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 = datastore['SMAC']
@smac ||= get_mac(@interface) if @netifaces @smac ||= get_mac(@interface) if @netifaces
@smac ||= ipv6_mac @smac ||= ipv6_mac
raise RuntimeError, 'SMAC should be defined' unless @smac raise 'SMAC should be defined' unless @smac
# Send router advertisement # Send router advertisement
print_status("Sending 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']) icmp_response, contents = icmp_packet(packet, datastore['RESP_START'])
if not icmp_response if not icmp_response
raise RuntimeError, "Could not build ICMP response" raise "Could not build ICMP response"
else else
# send response packet icmp_pkt # send response packet icmp_pkt
send_icmp(icmp_response, contents) send_icmp(icmp_response, contents)
@ -172,7 +172,7 @@ class MetasploitModule < Msf::Auxiliary
icmp_response, contents = icmp_packet(packet, datastore['RESP_END']) icmp_response, contents = icmp_packet(packet, datastore['RESP_END'])
if not icmp_response if not icmp_response
raise RuntimeError, "Could not build ICMP response" raise "Could not build ICMP response"
else else
# send response packet icmp_pkt # send response packet icmp_pkt
send_icmp(icmp_response, contents) send_icmp(icmp_response, contents)
@ -192,7 +192,7 @@ class MetasploitModule < Msf::Auxiliary
icmp_response, contents = icmp_packet(packet, datastore['RESP_CONT']) icmp_response, contents = icmp_packet(packet, datastore['RESP_CONT'])
if not icmp_response if not icmp_response
raise RuntimeError, "Could not build ICMP response" raise "Could not build ICMP response"
else else
# send response packet icmp_pkt # send response packet icmp_pkt
send_icmp(icmp_response, contents) send_icmp(icmp_response, contents)

View File

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