Land #9560, Fix undef method 'gsub' in bavision_cam_login

MS-2855/keylogger-mettle-extension
Brent Cook 2018-02-15 11:36:45 -06:00
commit 5b88f27e2b
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
1 changed files with 10 additions and 2 deletions

View File

@ -5,6 +5,8 @@ module Metasploit
module Framework
module LoginScanner
class BavisionCamerasException < Exception; end
class BavisionCameras < HTTP
DEFAULT_PORT = 80
@ -59,7 +61,13 @@ module Metasploit
nonce_count = 1
cnonce = Digest::MD5.hexdigest("%x" % (Time.now.to_i + rand(65535)))
response['www-authenticate'] =~ /^(\w+) (.*)/
i = (response['www-authenticate'] =~ /^(\w+) (.*)/)
# The www-authenticate header does not return in the format we like,
# so let's bail.
unless i
raise BavisionCamerasException, 'www-authenticate header is not in the right format'
end
params = {}
$2.gsub(/(\w+)="(.*?)"/) { params[$1] = $2 }
@ -104,7 +112,7 @@ module Metasploit
begin
result_opts.merge!(try_digest_auth(credential))
rescue ::Rex::ConnectionError => e
rescue ::Rex::ConnectionError, BavisionCamerasException => e
# Something went wrong during login. 'e' knows what's up.
result_opts.merge!(status: LOGIN_STATUS::UNABLE_TO_CONNECT, proof: e.message)
end