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
parent
eaf51a2113
commit
7ab506dc06
|
@ -4,11 +4,13 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
|
require 'msf/core/post/android'
|
||||||
|
|
||||||
class Metasploit4 < Msf::Post
|
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 +41,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?
|
||||||
|
raise RuntimeError, "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