Fix the rest of nil res from get_once

unstable
sinn3r 2012-06-04 17:26:15 -05:00
parent 0fcc53b0a2
commit d9c39d3798
20 changed files with 37 additions and 37 deletions

View File

@ -73,7 +73,7 @@ class Metasploit3 < Msf::Auxiliary
select(nil,nil,nil,0.4)
end
sock.put(command)
@result = sock.get_once
@result = sock.get_once || ''
rescue ::Exception => err
print_error("Error: #{err.to_s}")
end

View File

@ -278,7 +278,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
# NOTE: We don't care if the login failed here...
ret = connect
banner = sock.get_once
banner = sock.get_once || ''
# We just want the banner to check against our targets..
print_status("FTP Banner: #{banner.strip}")
@ -317,7 +317,7 @@ class Metasploit3 < Msf::Exploit::Remote
def exploit
connect
banner = sock.get_once
banner = sock.get_once || ''
# Use a copy of the target
mytarget = target

View File

@ -87,7 +87,7 @@ class Metasploit3 < Msf::Exploit::Remote
# read the mysql server hello :)
version = nil
if (buf = sock.get_once(-1, 5))
if (buf = sock.get_once(-1, 5) || '')
#print_status("\n" + Rex::Text.to_hex_dump(buf))
if (buf =~ /is not allowed to connect/)
raise RuntimeError, 'The server refused our connection!'

View File

@ -66,7 +66,7 @@ class Metasploit3 < Msf::Exploit::Remote
disconnect
if ( ver =~ /11.1.742/ )
if ( ver and ver =~ /11.1.742/ )
return Exploit::CheckCode::Vulnerable
end

View File

@ -65,7 +65,7 @@ class Metasploit3 < Msf::Exploit::Remote
disconnect
if ( ver =~ /11.1.742/ )
if ( ver and ver =~ /11.1.742/ )
return Exploit::CheckCode::Vulnerable
end
return Exploit::CheckCode::Safe

View File

@ -65,7 +65,7 @@ class Metasploit3 < Msf::Exploit::Remote
disconnect
if ( ver =~ /11.1.742/ )
if ( ver and ver =~ /11.1.742/ )
return Exploit::CheckCode::Vulnerable
end

View File

@ -64,7 +64,7 @@ class Metasploit3 < Msf::Exploit::Remote
disconnect
if ( ver =~ /11.1.742/ )
if ( ver and ver =~ /11.1.742/ )
return Exploit::CheckCode::Vulnerable
end

View File

@ -91,8 +91,8 @@ class Metasploit3 < Msf::Exploit::Remote
# This isn't exactly awesome, but it seems to work..
begin
headers = sock.get_once(-1, timeout)
body = sock.get_once(-1, timeout)
headers = sock.get_once(-1, timeout) || ''
body = sock.get_once(-1, timeout) || ''
rescue ::EOFError
# nothing
end

View File

@ -77,7 +77,7 @@ class Metasploit3 < Msf::Exploit::Remote
connect
banner = sock.get_once
sock.put("A0 GETCONFIG SELF 0<EOM>")
res = sock.get_once
res = sock.get_once || ''
disconnect
if (res =~ /OS\<([^\>]+)/)
print_status("CA License Server reports OS: #{$1}")

View File

@ -98,7 +98,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
connect
banner = sock.get_once(-1,5).chomp
banner = (sock.get_once(-1,5) || '').chomp
disconnect
if banner =~ /Lotus Domino Release 8.5/
@ -241,7 +241,7 @@ class Metasploit3 < Msf::Exploit::Remote
connect
# Get SMTP Banner
res = sock.get_once.chomp
res = (sock.get_once || '').chomp
print_status("Banner: #{res}")
# Check banner before trying the exploit
@ -253,22 +253,22 @@ class Metasploit3 < Msf::Exploit::Remote
# Send HELO
sock.put(commands[:HELO])
res = sock.get_once
res = sock.get_once || ''
print_status("Received: #{res.chomp}")
# Set MAIL FROM
sock.put(commands[:FROM])
res = sock.get_once
res = sock.get_once || ''
print_status("Received: #{res.chomp}")
# Set RCPT
sock.put(commands[:RCPT])
res = sock.get_once
res = sock.get_once || ''
print_status("Received: #{res.chomp}")
# Set DATA
sock.put(commands[:DATA])
res = sock.get_once
res = sock.get_once || ''
print_status("Received: #{res.chomp}")
# Send malicious data
@ -277,7 +277,7 @@ class Metasploit3 < Msf::Exploit::Remote
# QUIT
sock.put(commands[:QUIT])
res = sock.get_once
res = sock.get_once || ''
print_status("Received: #{res.chomp}")
handler

View File

@ -74,7 +74,7 @@ class Metasploit3 < Msf::Exploit::Remote
req << "User-Agent: Sametime Community Agent\r\n"
req << "Host: #{datastore['RHOST']}:#{datastore['RPORT']}\r\n"
sock.put(req)
res = sock.get_once(-1,3)
res = sock.get_once(-1,3) || ''
disconnect
@ -85,7 +85,7 @@ class Metasploit3 < Msf::Exploit::Remote
req << "User-Agent: Sametime Community Agent\r\n"
req << "Host: #{datastore['RHOST']}:#{datastore['RPORT']}\r\n"
sock.put(req)
res = sock.get_once(-1,3)
res = sock.get_once(-1,3) || ''
disconnect

View File

@ -88,7 +88,7 @@ class Metasploit3 < Msf::Exploit::Remote
print_status("Trying #{target.name} using jmp esp at #{"%.8x" % target.ret}")
banner = sock.get_once
banner = sock.get_once || ''
if banner !~ /^\+OK POP3 server (.*) ready/
print_error("POP3 server does not appear to be running")
return

View File

@ -65,7 +65,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
connect
banner = sock.get_once(-1,3)
banner = sock.get_once(-1,3) || ''
disconnect
if (banner =~ /CCProxy Telnet Service Ready/)

View File

@ -63,7 +63,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
connect
sock.put("GET /\r\n\r\n") # Malformed request to get proxy info
banner = sock.get_once
banner = sock.get_once || ''
if (banner =~ /Server:\sWinGate\s6.1.1\s\(Build 1077\)/)
return Exploit::CheckCode::Vulnerable
end

View File

@ -76,8 +76,8 @@ class Metasploit3 < Msf::Exploit::Remote
def check
connect
res = sock.get_once.chomp #This gives us string "----------------------------"
res = sock.get_once.chomp #This gives us the actual software version
res = (sock.get_once || '').chomp #This gives us string "----------------------------"
res = (sock.get_once || '').chomp #This gives us the actual software version
disconnect
if res =~ /Core Command Interface V1\.(.*)2/

View File

@ -65,7 +65,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
connect
banner = sock.get_once(-1,3)
banner = sock.get_once(-1,3) || ''
disconnect
if (banner =~ /ESMTP TABS Mail Server for Windows NT/)

View File

@ -71,7 +71,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
connect
banner = sock.get_once
banner = sock.get_once || ''
if (banner !~ /Microsoft/)
print_status("Target does not appear to be an Exchange server.")
@ -79,20 +79,20 @@ class Metasploit3 < Msf::Exploit::Remote
end
sock.put("EHLO #{Rex::Text.rand_text_alpha(1)}\r\n")
res = sock.get_once
res = sock.get_once || ''
if (res !~ /XEXCH50/)
print_status("Target does not appear to be an Exchange server.")
return Exploit::CheckCode::Safe
end
sock.put("MAIL FROM: #{datastore['MAILFROM']}\r\n")
res = sock.get_once
res = sock.get_once || ''
if (res =~ /Sender OK/)
sock.put("RCPT TO: #{datastore['MAILTO']}\r\n")
res = sock.get_once
res = sock.get_once || ''
if (res =~ /250/)
sock.put("XEXCH50 2 2\r\n")
res = sock.get_once
res = sock.get_once || ''
if (res !~ /Send binary data/)
print_error("Target has been patched!")
return Exploit::CheckCode::Detected
@ -110,7 +110,7 @@ class Metasploit3 < Msf::Exploit::Remote
connect
select(nil,nil,nil,1)
banner = sock.get_once
banner = sock.get_once || ''
print_status("Connected to SMTP server: #{banner.to_s}")
if (banner !~ /Microsoft/)
@ -121,7 +121,7 @@ class Metasploit3 < Msf::Exploit::Remote
select(nil,nil,nil,5)
sock.put("EHLO X\r\n")
select(nil,nil,nil,7)
res = sock.get_once
res = sock.get_once || ''
if (res !~ /XEXCH50/)
print_status("Target is not running Exchange.")
@ -187,7 +187,7 @@ class Metasploit3 < Msf::Exploit::Remote
sock.put("XEXCH50 -1 2\r\n") # Allocate negative value
select(nil,nil,nil,2)
res = sock.get_once
res = sock.get_once || ''
if (!res)
print_error("Error - no response")

View File

@ -75,7 +75,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
begin
connect
banner = sock.get_once(-1,5)
banner = sock.get_once(-1,5) || ''
disconnect
if banner =~ /SSH\-2\.0\-SysaxSSH_1\.0/
return Exploit::CheckCode::Vulnerable

View File

@ -91,7 +91,7 @@ class Metasploit3 < Msf::Exploit::Remote
connect
print_status("Attempting to determine if target is vulnerable...")
select(nil,nil,nil,7)
banner = sock.get_once(-1,3)
banner = sock.get_once(-1,3) || ''
if (banner =~ /TelSrv 1\.5/)
return Exploit::CheckCode::Vulnerable

View File

@ -59,7 +59,7 @@ class Metasploit3 < Msf::Exploit::Remote
def check
connect
ack = sock.get_once
ack = sock.get_once || ''
disconnect
(ack == "ACK\x00") ? Exploit::CheckCode::Detected : Exploit::CheckCode::Safe