Land #5937, use the Android mixin to get the Android version
commit
20366993e3
|
@ -9,6 +9,7 @@ class Metasploit4 < Msf::Post
|
||||||
Rank = NormalRanking
|
Rank = NormalRanking
|
||||||
|
|
||||||
include Msf::Post::Common
|
include Msf::Post::Common
|
||||||
|
include Msf::Post::Android::System
|
||||||
|
|
||||||
def initialize(info={})
|
def initialize(info={})
|
||||||
super( update_info( info, {
|
super( update_info( info, {
|
||||||
|
@ -39,15 +40,25 @@ class Metasploit4 < Msf::Post
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def is_version_compat?
|
||||||
buildprop = cmd_exec('cat /system/build.prop')
|
build_prop = get_build_prop
|
||||||
|
|
||||||
if buildprop.blank?
|
# Sometimes cmd_exec fails to cat build_prop, so the #get_build_prop method returns
|
||||||
print_error("Blank build.prop, try again")
|
# empty.
|
||||||
return
|
if build_prop.empty?
|
||||||
|
fail_with(Failure::Unknown, 'Failed to retrieve build.prop, you might need to try again.')
|
||||||
end
|
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")
|
print_error("This module is only compatible with Android versions 4.0 to 4.3")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue