Leverage check_version_from_custom_file in PR #5292

Change the 'check' code to leverage check_version_from_custom_file added to wordpress/version.rb by @FireFart in PR #5292
bug/bundler_fix
Tom Sellers 2015-05-02 19:11:40 -05:00
parent 18697d8d02
commit c293066198
1 changed files with 1 additions and 30 deletions

View File

@ -41,37 +41,8 @@ class Metasploit3 < Msf::Exploit::Remote
end end
def check def check
fixed_version = '3.0.96'
# RevSlider doesn't have a readme.txt, look elsewhere
release_log_url = normalize_uri(wordpress_url_plugins, 'revslider', 'release_log.txt') release_log_url = normalize_uri(wordpress_url_plugins, 'revslider', 'release_log.txt')
vprint_status("#{peer} - Checking #{release_log_url}") check_version_from_custom_file(release_log_url, /^\s*(?:version)\s*(\d{1,2}\.\d{1,2}(?:\.\d{1,2})?).*$/mi, '3.0.96')
res = send_request_cgi(
'uri' => release_log_url,
'method' => 'GET'
)
if res.nil? || res.code != 200
# No release_log.txt present for plugin
return Msf::Exploit::CheckCode::Unknown
end
if res.body
body = res.body.to_s
version = body[/(?:version)\s*([0-9a-z.-]+)/i, 1]
end
# Could not identify version number
return Msf::Exploit::CheckCode::Detected if version.nil?
vprint_status("#{peer} - Found version #{version}")
# Check to see if version older than fixed version
if Gem::Version.new(version) < Gem::Version.new(fixed_version)
return Msf::Exploit::CheckCode::Appears
else
return Msf::Exploit::CheckCode::Safe
end
end end
def exploit def exploit