Read header as 6 bytes

bug/bundler_fix
jvazquez-r7 2015-07-10 14:25:57 -05:00
parent bed3257a3f
commit 29a497a616
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
1 changed files with 76 additions and 75 deletions

View File

@ -93,20 +93,20 @@ class Metasploit3 < Msf::Exploit::Remote
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x60\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x60\x00\x04"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -120,20 +120,20 @@ class Metasploit3 < Msf::Exploit::Remote
req << "\x00" * 11
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x60\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x60\x00\x04"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -146,20 +146,21 @@ class Metasploit3 < Msf::Exploit::Remote
req << "\x00" * 11
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x43\x00\x00"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x43\x00\x00"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
unless data_length == 0
disconnect
@ -176,20 +177,20 @@ class Metasploit3 < Msf::Exploit::Remote
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x43\x00\x00"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x43\x00\x00"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
unless data_length == 0
disconnect
return Exploit::CheckCode::Unknown
@ -202,20 +203,20 @@ class Metasploit3 < Msf::Exploit::Remote
# 1st packet
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x63\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x63\x00\x04"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -225,20 +226,20 @@ class Metasploit3 < Msf::Exploit::Remote
# 2nd packet
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x68\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x68\x00\x04"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -248,20 +249,20 @@ class Metasploit3 < Msf::Exploit::Remote
# 3rd packet
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x65\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x65\x00\x04"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length && data.include?('You have successfully retrieved client information')
@ -271,20 +272,20 @@ class Metasploit3 < Msf::Exploit::Remote
# 4th packet
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x69\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x69\x00\x04"
disconnect
return Exploit::CheckCode::Unknown
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
return Exploit::CheckCode::Unknown
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -356,20 +357,20 @@ class Metasploit3 < Msf::Exploit::Remote
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x60\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x60\x00\x04"
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet identifier")
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet length")
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -381,20 +382,20 @@ class Metasploit3 < Msf::Exploit::Remote
req << "\x00" * 11
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x60\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x60\x00\x04"
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet identifier")
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet length")
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -409,20 +410,20 @@ class Metasploit3 < Msf::Exploit::Remote
req << "\x00" * 11
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x43\x00\x00"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x43\x00\x00"
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet identifier")
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet length")
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
unless data_length == 0
disconnect
@ -436,20 +437,20 @@ class Metasploit3 < Msf::Exploit::Remote
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x43\x00\x00"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x43\x00\x00"
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet identifier")
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet length")
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
unless data_length == 0
disconnect
@ -473,20 +474,20 @@ class Metasploit3 < Msf::Exploit::Remote
sock.put(req)
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x63\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x63\x00\x04"
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet identifier")
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet length")
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -496,20 +497,20 @@ class Metasploit3 < Msf::Exploit::Remote
# 1st Packet
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x68\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x68\x00\x04"
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet identifier")
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet length")
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length
@ -519,20 +520,20 @@ class Metasploit3 < Msf::Exploit::Remote
# 2st Packet
id = sock.get_once(4)
unless id && id.length == 4 && id == "\x00\x68\x00\x04"
header = sock.get_once(6)
unless header && header.length == 6 && header[0, 4] == "\x00\x68\x00\x04"
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet identifier")
end
data_length = sock.get_once(4)
data_length = sock.get_once(2)
unless data_length && data_length.length == 4
unless data_length && data_length.length == 2
disconnect
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failure reading packet length")
end
data_length = data_length[2..3].unpack('n')[0]
data_length = data_length.unpack('n')[0]
data = sock.get_once(data_length)
unless data && data.length == data_length