Support re-authentication during the shell

After 8 hours, the server requests re-authentication, so need to support that.
This commit is contained in:
Ashley Donaldson 2021-09-10 07:41:31 +10:00
parent 9ea3be903d
commit cf09d56be0
No known key found for this signature in database
GPG Key ID: 70277622B54D3BCE
2 changed files with 4 additions and 4 deletions

View File

@ -207,9 +207,9 @@ module Net
def ntlm_transform_response(ntlm_client, response)
# OMI server doesn't always respond to encrypted messages with encrypted responses over SSL
return nil unless response
return response.body if response.headers['Content-Type'].first =~ %r{\Aapplication\/soap\+xml}i
return '' if response.body.empty?
return unless response
return if response.headers['Content-Type'] and response.headers['Content-Type'].first =~ %r{\Aapplication\/soap\+xml}i
return if response.body.empty?
str = response.body.force_encoding('BINARY')
str.sub!(%r{^.*Content-Type: application\/octet-stream\r\n(.*)--Encrypted.*$}m, '\1')

View File

@ -513,6 +513,7 @@ class Client
ntlm_message_3 = ntlm_client.init_context(ntlm_challenge, channel_binding)
self.ntlm_client = ntlm_client
# Send the response
opts['headers']['Authorization'] = "#{provider}#{ntlm_message_3.encode64}"
r = request_cgi(opts)
@ -521,7 +522,6 @@ class Client
unless resp.kind_of? Rex::Proto::Http::Response
return nil
end
self.ntlm_client = ntlm_client
return resp
rescue ::Errno::EPIPE, ::Timeout::Error