Nuuo mixin handle connection errors

master
Jacob Robles 2019-04-24 07:00:53 -05:00
parent aba88243d7
commit acf7e58e8e
No known key found for this signature in database
GPG Key ID: 3EC9F18F2B12401C
1 changed files with 23 additions and 8 deletions

View File

@ -43,7 +43,8 @@ module Exploit::Remote::Nuuo
host: datastore['RHOST'], host: datastore['RHOST'],
username: datastore['NCSUSER'], username: datastore['NCSUSER'],
password: datastore['NCSPASS'], password: datastore['NCSPASS'],
user_session: datastore['NCSSESSION'] user_session: datastore['NCSSESSION'],
context: { 'Msf' => framework, 'MsfExploit' => self }
}) })
client.close if self.client && global client.close if self.client && global
@ -72,15 +73,29 @@ module Exploit::Remote::Nuuo
print_status("Request:\r\n#{req.to_s}") print_status("Request:\r\n#{req.to_s}")
end end
conn = temp ? client.connect(temp: temp) : nil begin
res = client.send_recv(req, conn) conn = temp ? client.connect(temp: temp) : nil
conn.shutdown if conn res = client.send_recv(req, conn)
if conn && temp
conn.shutdown
conn.close
end
if datastore['NCSTRACE'] && res if datastore['NCSTRACE'] && res
print_status("Response:\r\n#{res.to_s}") print_status("Response:\r\n#{res.to_s}")
end
res
rescue ::Errno::EPIPE, ::Timeout::Error => e
print_line(e.message) if datastore['NCSTRACE']
nil
rescue Rex::ConnectionError => e
vprint_error(e.to_s)
nil
rescue ::Exception => e
print_line(e.message) if datastore['NCSTRACE']
raise e
end end
res
end end
def ncs_login def ncs_login