Module: Msf::Post::Android::Priv

Includes:
Common
Defined in:
lib/msf/core/post/android/priv.rb

Instance Method Summary collapse

Methods included from Common

#clear_screen, #cmd_exec, #cmd_exec_get_pid, #command_exists?, #get_env, #get_envs, #has_pid?, #peer, #report_virtualization, #rhost, #rport

Instance Method Details

#is_root?Boolean

Returns whether we are running as root or not.

Returns:

  • (Boolean)

    TrueClass if as root, otherwise FalseClass.


19
20
21
22
23
24
25
26
27
# File 'lib/msf/core/post/android/priv.rb', line 19

def is_root?
  id = cmd_exec('id')
  uid = id.scan(/uid=(\d+)(.+)/).flatten.first
  if /^0$/ === uid
    return true
  else
    return false
  end
end