Another large number of warnings fixed by Yoann Guillot

git-svn-id: file:///home/svn/framework3/trunk@7248 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-10-25 17:18:23 +00:00
parent 9904861e94
commit e3f68f2639
45 changed files with 76 additions and 75 deletions

View File

@ -66,8 +66,8 @@ module Auxiliary
mod.framework.jobs.start_bg_job(
"Auxiliary: #{mod.refname}",
mod,
Proc.new { |mod| self.job_run_proc(mod) },
Proc.new { |mod| self.job_cleanup_proc(mod) }
Proc.new { |mod_| self.job_run_proc(mod_) },
Proc.new { |mod_| self.job_cleanup_proc(mod_) }
)
else
self.job_run_proc(mod)

View File

@ -5,7 +5,8 @@ module Msf
###
#
# The db module provides persistent storage and events
# The db module provides persistent storage and events. This class should be instantiated LAST
# as the active_suppport library overrides Kernel.require, slowing down all future code loads.
#
###

View File

@ -66,7 +66,7 @@ module Exploit::Remote::Arkeia
sock.put(req)
resp = arkeia_recv()
if (not (resp and resp[0,4] == "\x00\x60\x00\x04"))
if !(resp and resp[0,4] == "\x00\x60\x00\x04")
disconnect
return false
end
@ -79,7 +79,7 @@ module Exploit::Remote::Arkeia
sock.put(req)
resp = arkeia_recv()
if (not (resp and resp[0,4] == "\x00\x60\x00\x04"))
if !(resp and resp[0,4] == "\x00\x60\x00\x04")
disconnect
return false
end
@ -93,7 +93,7 @@ module Exploit::Remote::Arkeia
sock.put(req)
resp = arkeia_recv()
if (not (resp and resp[0,4] == "\x00\x43\x00\x00"))
if !(resp and resp[0,4] == "\x00\x43\x00\x00")
disconnect
return false
end
@ -109,7 +109,7 @@ module Exploit::Remote::Arkeia
sock.put(req)
resp = arkeia_recv()
if (not (resp and resp[0,4] == "\x00\x43\x00\x00"))
if !(resp and resp[0,4] == "\x00\x43\x00\x00")
disconnect
return false
end
@ -128,7 +128,7 @@ module Exploit::Remote::Arkeia
break if resp =~ /VERSION/
}
if (not (resp and resp =~ /VERSION/))
if !(resp and resp =~ /VERSION/)
disconnect
return false
end
@ -156,7 +156,7 @@ module Exploit::Remote::Arkeia
break if not resp
break if resp[0,2] == "\x00\x43"
}
if (not (resp and resp[0,2] == "\x00\x43"))
if !(resp and resp[0,2] == "\x00\x43")
disconnect
return info
end
@ -171,10 +171,10 @@ module Exploit::Remote::Arkeia
sock.put(req)
1.upto(5) { |i|
resp = arkeia_recv()
break if not (resp and resp.length > 0)
break if !(resp and resp.length > 0)
break if resp[0,2] == "\x00\x69"
}
if (not (resp and resp[0,2] == "\x00\x69"))
if !(resp and resp[0,2] == "\x00\x69")
disconnect
return info
end

View File

@ -54,7 +54,7 @@ module Exploit::Remote::Ftp
def connect_login(global = true, verbose = true)
ftpsock = connect(global, verbose)
if (not (user and pass))
if !(user and pass)
print_status("No username and password were supplied, unable to login")
return false
end

View File

@ -55,7 +55,7 @@ module Exploit::Remote::Imap
ftpsock = connect(global)
if (not (user and pass))
if !(user and pass)
print_status("No username and password were supplied, unable to login")
return false
end

View File

@ -12,8 +12,8 @@ module Exploit::KernelMode
def encode_begin(real_payload, reqs)
super
reqs['EncapsulationRoutine'] = Proc.new { |reqs, raw|
encapsulate_payload(reqs, raw)
reqs['EncapsulationRoutine'] = Proc.new { |reqs_, raw|
encapsulate_payload(reqs_, raw)
}
end

View File

@ -173,7 +173,7 @@ module Exploit::Remote::MSSQL
while(not done)
head = sock.get_once(8, timeout)
if(not (head and head.length == 8))
if !(head and head.length == 8)
return false
end
@ -429,7 +429,7 @@ module Exploit::Remote::MSSQL
col[:id] = :hex # binary(2)
col[:max_size] = data.slice!(0,2).unpack('v')[0]
when 231,175,167,173,239
when 231,175,167,239
col[:id] = :string
col[:max_size] = data.slice!(0,2).unpack('v')[0]
col[:codepage] = data.slice!(0,2).unpack('v')[0]

View File

@ -54,7 +54,7 @@ module Exploit::Remote::NDMP
resp = ndmp_recv()
disconnect
if (not (resp and resp.length > 28))
if !(resp and resp.length > 28)
return false
end

View File

@ -195,7 +195,7 @@ module Msf
output = String.new()
output << "#{object} #{xref.length}\r\n"
xref.each {|xref| output << "#{xref} 00000 n\r\n"}
xref.each {|xref_| output << "#{xref_} 00000 n\r\n"}
return output
end

View File

@ -56,7 +56,7 @@ module Exploit::Remote::Pop2
pop2sock = connect(global)
if (not (user and pass))
if !(user and pass)
print_status("No username and password were supplied, unable to login")
return false
end

View File

@ -137,8 +137,8 @@ class ExploitDriver
self.job_id = exploit.framework.jobs.start_bg_job(
"Exploit: #{exploit.refname}",
ctx,
Proc.new { |ctx| job_run_proc(ctx) },
Proc.new { |ctx| job_cleanup_proc(ctx) }
Proc.new { |ctx_| job_run_proc(ctx_) },
Proc.new { |ctx_| job_cleanup_proc(ctx_) }
)
else
job_run_proc(ctx)

View File

@ -588,7 +588,7 @@ protected
refs = module_info['References']
if(refs and not refs.empty?)
refs.each_index do |i|
if(not (refs[i].respond_to?('[]') and refs[i].length == 2))
if !(refs[i].respond_to?('[]') and refs[i].length == 2)
refs[i] = nil
end
end

View File

@ -107,7 +107,7 @@ class Msf::Module::Author
self.email = str.sub(/\s*\[at\]\s*/, '@').sub(/\s*\[dot\]\s*/, '.').gsub(/^<|>$/, '')
m = self.email.match(/([^@]+)@/)
self.name = m ? m[1] : nil
if(not (self.email and self.email.index('@')))
if !(self.email and self.email.index('@'))
self.name = self.email
self.email = ''
end

View File

@ -466,7 +466,7 @@ class ModuleManager < ModuleSet
}
}
if(not (@modcache['ModuleTypeCounts'] and @modcache['ModuleTypeCounts'].keys.length > 0))
if !(@modcache['ModuleTypeCounts'] and @modcache['ModuleTypeCounts'].keys.length > 0)
@modcache_invalidated = true
end

View File

@ -96,12 +96,12 @@ module Msf::Payload::Solaris
end
# Prepend syscall code to prepend block
if not (pre.empty?)
if !(pre.empty?)
pre = sc + pre
end
# Prepend syscall code to append block
if not (app.empty?)
if !(app.empty?)
app = sc + app
end

View File

@ -464,7 +464,7 @@ module X86
if (dst != ESP)
next if badchars.index( (0x70 + dst).chr )
if (not (badchars.index("\x89") or badchars.index( (0xE0+dst).chr )))
if !(badchars.index("\x89") or badchars.index( (0xE0+dst).chr ))
buf << "\x89" + (0xE0 + dst).chr
else
next if badchars.index("\x54")

View File

@ -48,7 +48,8 @@ class Generic
second = 1
randbase = 0
gen_base_set(block).each do |randbase|
gen_base_set(block).each do |randbase_|
randbase = randbase_
second = gen_second(block, randbase)
next if second < 0
break if accepted_chars.include?(second.chr)

View File

@ -283,7 +283,6 @@ class GroupTlv < Tlv
# Adds a TLV of a given type and value.
#
def add_tlv(type, value = nil, replace = false)
tlv = nil
# If we should replace any TLVs with the same type...remove them first
if (replace)

View File

@ -158,7 +158,7 @@ require 'rex/proto/smb/exceptions'
end
data = self.socket.read( read_cnt, rand(1024)+1)
break if not (data and data.length > 0)
break if !(data and data.length > 0)
raw_response += data
# Keep reading until we have at least the DCERPC header

View File

@ -143,7 +143,7 @@ class Response
self.cancel_cnt = data.unpack('CCCCNvvVVvC')
# Error out if the whole header was not read
if(not (self.alloc_hint and self.context_id and self.cancel_cnt))
if !(self.alloc_hint and self.context_id and self.cancel_cnt)
raise Rex::Proto::DCERPC::Exceptions::InvalidPacket, 'DCERPC response packet is incomplete'
end

View File

@ -233,7 +233,7 @@ module Text
bin = [a].pack('C').unpack('B8')[0].split(//)
# even more ugh.
bin.collect!{|a| a = a.to_i}
bin.collect!{|a_| a_.to_i}
out = Array.new(8 * size, 0)

View File

@ -158,7 +158,7 @@ module DispatcherShell
# Verify that our search string is a valid regex
begin
Regexp.compile(str)
rescue RegexpError => e
rescue RegexpError
str = Regexp.escape(str)
end

View File

@ -81,10 +81,10 @@ class Metasploit3 < Msf::Auxiliary
dataf = Rex::Text.rand_text_alpha(100)+1
print_status("Deleting #{datstore['RPATH']}...")
if (not (
if !(
send_file(sock1, 2, "cfA" + jid + r_hostname, control) and
send_file(sock1, 3, "dfa" + jid + r_hostname, dataf)
) )
)
sock1.close
return
end
@ -97,7 +97,7 @@ class Metasploit3 < Msf::Auxiliary
s.put(type.chr + data.length.to_s + " " + name + "\n")
res = s.get_once(1)
if (not (res and res[0] == 0))
if !(res and res[0] == ?\0)
print_status("The target did not accept our control file command (#{name})")
return
end
@ -105,7 +105,7 @@ class Metasploit3 < Msf::Auxiliary
s.put(data)
s.put("\x00")
res = s.get_once(1)
if (not (res and res[0] == 0))
if !(res and res[0] == ?\0)
print_status("The target did not accept our control file data (#{name})")
return
end

View File

@ -53,7 +53,7 @@ class Metasploit3 < Msf::Auxiliary
eports = {}
epm.each do |ep|
next if not (ep[:port] and ep[:prot] and ep[:prot] == "tcp")
next if !(ep[:port] and ep[:prot] and ep[:prot] == "tcp")
eports[ep[:port]] ||= {}
eports[ep[:port]][ep[:uuid]+'_'+ep[:vers]] = true
end

View File

@ -88,7 +88,7 @@ class Metasploit3 < Msf::Auxiliary
def on_client_data(cli)
begin
data = cli.get_once(-1, 5)
raise ::Errno::ECONNABORTED if not (data or data.length == 0)
raise ::Errno::ECONNABORTED if !data or data.length == 0
case cli.request.parse(data)
when Rex::Proto::Http::Packet::ParseCode::Completed
dispatch_request(cli, cli.request)

View File

@ -69,7 +69,6 @@ class Metasploit3 < Msf::Auxiliary
# Wrap in exception handler
begin
name = ''
while @run
reply = false
packet, addr = @sock.recvfrom(65535)

View File

@ -78,7 +78,7 @@ class Metasploit3 < Msf::Auxiliary
def process_socks(client)
req = client.get_once
return if not (req and req.length > 2)
return if !(req and req.length > 2)
# Versions
case req[0]

View File

@ -109,7 +109,7 @@ class Metasploit3 < Msf::Auxiliary
next if not ip.protocol == 6
tcp = Racket::TCP.new(ip.payload)
next if not (tcp.payload and tcp.payload.length > 0)
next if !(tcp.payload and tcp.payload.length > 0)
data = {:raw => pkt, :eth => eth, :ip => ip, :tcp => tcp}

View File

@ -64,7 +64,7 @@ class Metasploit3 < Msf::Auxiliary
targ = args[0] || rhost()
dom = args[1] || "example.com"
if(not (targ and targ.length > 0))
if !(targ and targ.length > 0)
print_status("usage: racer [dns-server] [domain]")
return
end
@ -74,7 +74,7 @@ class Metasploit3 < Msf::Auxiliary
def cmd_check(*args)
targ = args[0] || rhost()
if(not (targ and targ.length > 0))
if !(targ and targ.length > 0)
print_status("usage: check [dns-server]")
return
end

View File

@ -57,8 +57,8 @@ class Metasploit3 < Msf::Auxiliary
def cmd_racer(*args)
targ = args[0] || rhost()
dom = args[1] || "example.com"
if(not (targ and targ.length > 0))
if !(targ and targ.length > 0)
print_status("usage: racer [dns-server] [domain]")
return
end
@ -68,7 +68,7 @@ class Metasploit3 < Msf::Auxiliary
def cmd_check(*args)
targ = args[0] || rhost()
if(not (targ and targ.length > 0))
if !(targ and targ.length > 0)
print_status("usage: check [dns-server]")
return
end

View File

@ -73,9 +73,9 @@ class Metasploit3 < Msf::Auxiliary
base_res, base_saddr = base_sock.recvfrom(65535, 3.0)
targ_res, targ_saddr = targ_sock.recvfrom(65535, 3.0)
if(not (base_res and targ_res and base_res.length > 0 and targ_res.length > 0) )
print_status(" Error: The baseline server did not respond to our request.") if not (base_res and base_res.length > 0)
print_status(" Error: The target server did not respond to our request.") if not (targ_res and targ_res.length > 0)
if !(base_res and targ_res and base_res.length > 0 and targ_res.length > 0)
print_status(" Error: The baseline server did not respond to our request.") if ! (base_res and base_res.length > 0)
print_status(" Error: The target server did not respond to our request.") if ! (targ_res and targ_res.length > 0)
next
end

View File

@ -51,7 +51,7 @@ class Metasploit3 < Msf::Auxiliary
next if not ip.protocol == 6
tcp = Racket::TCP.new(ip.payload)
next if not (tcp.payload and tcp.payload.length > 0)
next if !(tcp.payload and tcp.payload.length > 0)
if (tcp.payload =~ /GET\s+([^\s]+)\s+HTTP/smi)
print_status("GET #{$1}")

View File

@ -90,7 +90,7 @@ class Metasploit3 < Msf::Exploit::Remote
res = sock.get_once(-1, 5)
disconnect
if (not (res and res.length > 0))
if !(res and res.length > 0)
print_status("The remote service did not reply to our request")
return Exploit::CheckCode::Safe
end
@ -125,7 +125,7 @@ class Metasploit3 < Msf::Exploit::Remote
print_status(res.to_s)
if (not (res and res.length > 0))
if !(res and res.length > 0)
print_status("The remote service did not reply to our request")
return Exploit::CheckCode::Safe
end
@ -160,7 +160,7 @@ class Metasploit3 < Msf::Exploit::Remote
sock.put(payload.encoded + ";\n")
res = sock.get_once(-1, 5)
if (not (res and res.length > 0))
if !(res and res.length > 0)
print_status("The remote service did not reply to our request")
disconnect
return
@ -227,7 +227,7 @@ class Metasploit3 < Msf::Exploit::Remote
#sock.put(payload.encoded + "\n")
res = sock.get_once(-1, 5)
if (not (res and res.length > 0))
if !(res and res.length > 0)
print_status("The remote service did not reply to our request")
disconnect
return

View File

@ -66,7 +66,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
info = arkeia_info()
if(not (info and info['Version']))
if !(info and info['Version'])
return Exploit::CheckCode::Safe
end

View File

@ -114,11 +114,11 @@ class Metasploit3 < Msf::Exploit::Remote
end
print_status("Configuring the spool directory...")
if (not (
if !(
send_file(sock1, 2, "cfA" + jid + "metasploit", control) and
send_file(sock1, 3, jid + "mail.cf", mailcf) and
send_file(sock1, 3, jid + "script", payload.encoded)
) )
)
sock1.close
return
end
@ -135,10 +135,10 @@ class Metasploit3 < Msf::Exploit::Remote
end
print_status("Triggering the vulnerable call to the mail program...")
if (not (
if !(
send_file(sock2, 2, "cfA" + jid + "metasploit", control) and
send_file(sock2, 3, "dfa" + jid + "config", mailcf)
) )
)
sock1.close
sock2.close
return
@ -157,7 +157,7 @@ class Metasploit3 < Msf::Exploit::Remote
s.put(type.chr + data.length.to_s + " " + name + "\n")
res = s.get_once(1)
if (not (res and res[0] == 0))
if !(res and res[0] == ?\0)
print_status("The target did not accept our control file command (#{name})")
return
end
@ -165,7 +165,7 @@ class Metasploit3 < Msf::Exploit::Remote
s.put(data)
s.put("\x00")
res = s.get_once(1)
if (not (res and res[0] == 0))
if !(res and res[0] == ?\0)
print_status("The target did not accept our control file data (#{name})")
return
end

View File

@ -71,7 +71,7 @@ class Metasploit3 < Msf::Exploit::Remote
res = sock.get_once(24, 5)
if (not (res and res.length == 24))
if !(res and res.length == 24)
print_status("The remote distccd did not reply to our request")
disconnect
return

View File

@ -107,13 +107,13 @@ class Metasploit3 < Msf::Exploit::Remote
'version' => '1.0'
}, 10)
if (not (res and res['location'] and res['location'] =~ /site=/))
if !(res and res['location'] and res['location'] =~ /site=/)
print_status("Could not read the location header: #{res.code} #{res.message}")
return
end
m = res['location'].match(/site=([^\&]+)\&.*client=([^\&]+)\&/im)
if (not (m and m[1] and m[2]))
if !(m and m[1] and m[2])
print_status("Invalid location header: #{res['location']}")
return
end

View File

@ -70,7 +70,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
info = arkeia_info()
if(not (info and info['Version']))
if !(info and info['Version'])
return Exploit::CheckCode::Safe
end

View File

@ -99,7 +99,7 @@ class Metasploit3 < Msf::Exploit::Remote
token,trash = token.split('=')
end
if(not (token and @state[token]))
if !(token and @state[token])
print_status("Sending #{self.name} init HTML to #{cli.peerhost}:#{cli.peerport}...")
token = rand_text_numeric(32)

View File

@ -113,7 +113,7 @@ class Metasploit3 < Msf::Exploit::Remote
'query' => 'fn=' + ("../" * 10) + path
}, 5)
return if not (res and res.body and res.body =~ /tuner\.css/ and res.body =~ /<pre>/)
return if !(res and res.body and res.body =~ /tuner\.css/ and res.body =~ /<pre>/)
m = res.match(/<pre>(.*)<\/pre><\/body>/smi)
return if not m

View File

@ -76,7 +76,7 @@ class Metasploit3 < Msf::Exploit::Remote
resp = sock.get_once
disconnect
if (not (resp and resp =~ /Error in web printer/))
if !(resp and resp =~ /Error in web printer/)
return Exploit::CheckCode::Safe
end

View File

@ -66,7 +66,7 @@ class Metasploit3 < Msf::Exploit::Remote
pad = Rex::Text.rand_text_alphanumeric(6, payload_badchars)
ident = sock.get_once
if (not (ident and ident.length == 16))
if !(ident and ident.length == 16)
print_status("Failed to receive agent version identification")
return
end

View File

@ -197,7 +197,7 @@ class Metasploit3 < Msf::Exploit::Remote
# Returns a BER encoded SPNEGO token
def spnego_token(stage0, stage1)
if (not (stage0 and stage1))
if !(stage0 and stage1)
print_status("Invalid parameters passed to spnego_token")
return
end

View File

@ -362,7 +362,8 @@ class Metasploit3 < Msf::Exploit::Remote
rsock = nil
rport = nil
[445, 139].each do |rport|
[445, 139].each do |rport_|
rport = rport_
begin
rsock = Rex::Socket::Tcp.create(
'PeerHost' => target_host,

View File

@ -207,8 +207,8 @@ class Metasploit3 < Msf::Nop
end
# Now that we have chosen all the instructions to use we must generate the actual sled.
opcodes_stack.each do | opcodes |
sled += opcodes
opcodes_stack.each do | opcodes_ |
sled += opcodes_
end
return sled