Files
metasploit-gs/lib/msf/core/post/android/priv.rb
T
2020-12-07 10:31:45 +00:00

31 lines
477 B
Ruby

# -*- coding: binary -*-
module Msf
class Post
module Android
module Priv
include Msf::Post::Common
public
# Returns whether we are running as root or not.
#
# @return [Boolean] TrueClass if as root, otherwise FalseClass.
def is_root?
id = cmd_exec('id')
uid = id.scan(/uid=(\d+)(.+)/).flatten.first
if /^0$/ === uid
return true
else
return false
end
end
private
def get_id
cmd_exec('id')
end
end ; end ; end ; end