Use Msf::Post::Android::System#get_build_prop to get the android ver

Instead of grabbing the android version from the module, this
is done by the mixin.
bug/bundler_fix
wchen-r7 2015-09-04 15:05:45 -05:00
parent eaf51a2113
commit 7ab506dc06
1 changed files with 18 additions and 6 deletions

View File

@ -4,11 +4,13 @@
##
require 'msf/core'
require 'msf/core/post/android'
class Metasploit4 < Msf::Post
Rank = NormalRanking
include Msf::Post::Common
include Msf::Post::Android::System
def initialize(info={})
super( update_info( info, {
@ -39,15 +41,25 @@ class Metasploit4 < Msf::Post
))
end
def run
buildprop = cmd_exec('cat /system/build.prop')
def is_version_compat?
build_prop = get_build_prop
if buildprop.blank?
print_error("Blank build.prop, try again")
return
# Sometimes cmd_exec fails to cat build_prop, so the #get_build_prop method returns
# empty.
if build_prop.empty?
raise RuntimeError, "Failed to retrieve build.prop, you might need to try again."
end
unless buildprop =~ /ro.build.version.release=4.[0|1|2|3]/
android_version = Gem::Version.new(build_prop['ro.build.version.release'])
if android_version <= Gem::Version.new('4.3') && android_version >= Gem::Version.new('4.0')
return true
end
false
end
def run
unless is_version_compat?
print_error("This module is only compatible with Android versions 4.0 to 4.3")
return
end