Files
metasploit-gs/lib/msf/core/post/android/priv.rb
T
wchen-r7 ccd0a06353 Use ===
2015-09-03 01:10:13 -05:00

35 lines
567 B
Ruby

# -*- coding: binary -*-
require 'msf/core/post/common'
require 'msf/core/post/file'
require 'msf/core/post/unix'
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