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, #cmd_exec_with_result, #command_exists?, #create_process, #get_env, #get_envs, #initialize, #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.



15
16
17
18
19
20
21
22
23
# File 'lib/msf/core/post/android/priv.rb', line 15

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