Module: Msf::Post::OSX::Priv

Includes:
Common
Defined in:
lib/msf/core/post/osx/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_admin?Boolean

Returns true if session user is in the admin group, false if not.

Returns:

  • (Boolean)

20
21
22
# File 'lib/msf/core/post/osx/priv.rb', line 20

def is_admin?
  cmd_exec('groups | grep -wq admin && echo true').eql? 'true'
end

#is_root?Boolean

Returns true if running as root, false if not.

Returns:

  • (Boolean)

13
14
15
# File 'lib/msf/core/post/osx/priv.rb', line 13

def is_root?
  cmd_exec('/usr/bin/id -ru').eql? '0'
end