commit
176296681a
|
@ -339,7 +339,7 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
|
|
||||||
def tls_jabber
|
def tls_jabber
|
||||||
sock.put(jabber_connect_msg(xmpp_domain))
|
sock.put(jabber_connect_msg(xmpp_domain))
|
||||||
res = sock.get_once(-1, response_timeout)
|
res = get_data
|
||||||
if res && res.include?('host-unknown')
|
if res && res.include?('host-unknown')
|
||||||
jabber_host = res.match(/ from='([\w.]*)' /)
|
jabber_host = res.match(/ from='([\w.]*)' /)
|
||||||
if jabber_host && jabber_host[1]
|
if jabber_host && jabber_host[1]
|
||||||
|
@ -347,7 +347,7 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
establish_connect
|
establish_connect
|
||||||
vprint_status("#{peer} - Connecting with autodetected remote XMPP hostname: #{jabber_host[1]}...")
|
vprint_status("#{peer} - Connecting with autodetected remote XMPP hostname: #{jabber_host[1]}...")
|
||||||
sock.put(jabber_connect_msg(jabber_host[1]))
|
sock.put(jabber_connect_msg(jabber_host[1]))
|
||||||
res = sock.get_once(-1, response_timeout)
|
res = get_data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if res.nil? || res.include?('stream:error') || res !~ /<starttls xmlns=['"]urn:ietf:params:xml:ns:xmpp-tls['"]/
|
if res.nil? || res.include?('stream:error') || res !~ /<starttls xmlns=['"]urn:ietf:params:xml:ns:xmpp-tls['"]/
|
||||||
|
@ -356,14 +356,14 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
end
|
end
|
||||||
msg = "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"
|
msg = "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"
|
||||||
sock.put(msg)
|
sock.put(msg)
|
||||||
res = sock.get_once(-1, response_timeout)
|
res = get_data
|
||||||
return nil if res.nil? || !res.include?('<proceed')
|
return nil if res.nil? || !res.include?('<proceed')
|
||||||
res
|
res
|
||||||
end
|
end
|
||||||
|
|
||||||
def tls_ftp
|
def tls_ftp
|
||||||
# http://tools.ietf.org/html/rfc4217
|
# http://tools.ietf.org/html/rfc4217
|
||||||
res = sock.get_once(-1, response_timeout)
|
res = get_data
|
||||||
return nil if res.nil?
|
return nil if res.nil?
|
||||||
sock.put("AUTH TLS\r\n")
|
sock.put("AUTH TLS\r\n")
|
||||||
res = get_data
|
res = get_data
|
||||||
|
@ -383,18 +383,25 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
# Get data from the socket
|
# Get data from the socket
|
||||||
# this ensures the requested length is read (if available)
|
# this ensures the requested length is read (if available)
|
||||||
def get_data(length = -1)
|
def get_data(length = -1)
|
||||||
|
|
||||||
return sock.get_once(-1, response_timeout) if length == -1
|
|
||||||
|
|
||||||
to_receive = length
|
to_receive = length
|
||||||
data = ''
|
data = ''
|
||||||
while to_receive > 0
|
done = false
|
||||||
|
while done == false
|
||||||
|
begin
|
||||||
temp = sock.get_once(to_receive, response_timeout)
|
temp = sock.get_once(to_receive, response_timeout)
|
||||||
|
rescue EOFError
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
break if temp.nil?
|
break if temp.nil?
|
||||||
|
|
||||||
data << temp
|
data << temp
|
||||||
|
if length != -1
|
||||||
to_receive -= temp.length
|
to_receive -= temp.length
|
||||||
|
done = true if to_receive <= 0
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -417,8 +424,7 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
|
|
||||||
vprint_status("#{peer} - Sending Client Hello...")
|
vprint_status("#{peer} - Sending Client Hello...")
|
||||||
sock.put(client_hello)
|
sock.put(client_hello)
|
||||||
|
server_hello = get_data
|
||||||
server_hello = sock.get_once(-1, response_timeout)
|
|
||||||
unless server_hello
|
unless server_hello
|
||||||
vprint_error("#{peer} - No Server Hello after #{response_timeout} seconds...")
|
vprint_error("#{peer} - No Server Hello after #{response_timeout} seconds...")
|
||||||
return nil
|
return nil
|
||||||
|
@ -777,19 +783,19 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
cert_len_padding = unpacked[0]
|
cert_len_padding = unpacked[0]
|
||||||
cert_len = unpacked[1]
|
cert_len = unpacked[1]
|
||||||
vprint_debug("\t\tCertificates length: #{cert_len}")
|
vprint_debug("\t\tCertificates length: #{cert_len}")
|
||||||
|
vprint_debug("\t\tData length: #{data.length}")
|
||||||
# contains multiple certs
|
# contains multiple certs
|
||||||
already_read = 3
|
already_read = 3
|
||||||
cert_counter = 0
|
cert_counter = 0
|
||||||
while already_read < cert_len
|
while already_read < cert_len
|
||||||
start = already_read
|
|
||||||
cert_counter += 1
|
cert_counter += 1
|
||||||
# get single certificate length
|
# get single certificate length
|
||||||
single_cert_unpacked = data[start, 3].unpack('Cn')
|
single_cert_unpacked = data[already_read, 3].unpack('Cn')
|
||||||
single_cert_len_padding = single_cert_unpacked[0]
|
single_cert_len_padding = single_cert_unpacked[0]
|
||||||
single_cert_len = single_cert_unpacked[1]
|
single_cert_len = single_cert_unpacked[1]
|
||||||
vprint_debug("\t\tCertificate ##{cert_counter}:")
|
vprint_debug("\t\tCertificate ##{cert_counter}:")
|
||||||
vprint_debug("\t\t\tCertificate ##{cert_counter}: Length: #{single_cert_len}")
|
vprint_debug("\t\t\tCertificate ##{cert_counter}: Length: #{single_cert_len}")
|
||||||
certificate_data = data[(start + 3), single_cert_len]
|
certificate_data = data[(already_read + 3), single_cert_len]
|
||||||
cert = OpenSSL::X509::Certificate.new(certificate_data)
|
cert = OpenSSL::X509::Certificate.new(certificate_data)
|
||||||
# First received certificate is the one from the server
|
# First received certificate is the one from the server
|
||||||
@cert = cert if @cert.nil?
|
@cert = cert if @cert.nil?
|
||||||
|
|
Loading…
Reference in New Issue