Land #5937, use the Android mixin to get the Android version
commit
20366993e3
|
@ -9,6 +9,7 @@ class Metasploit4 < Msf::Post
|
|||
Rank = NormalRanking
|
||||
|
||||
include Msf::Post::Common
|
||||
include Msf::Post::Android::System
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info, {
|
||||
|
@ -39,15 +40,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?
|
||||
fail_with(Failure::Unknown, '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
|
||||
|
|
Loading…
Reference in New Issue