Module: Msf::Post::OSX::Priv
- Includes:
- Common
- Defined in:
- lib/msf/core/post/osx/priv.rb
Instance Method Summary collapse
-
#is_admin? ⇒ Boolean
Returns true if session user is in the admin group, false if not.
-
#is_root? ⇒ Boolean
Returns true if running as root, false if not.
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_admin? ⇒ Boolean
Returns true if session user is in the admin group, false if not.
19 20 21 |
# File 'lib/msf/core/post/osx/priv.rb', line 19 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.
12 13 14 |
# File 'lib/msf/core/post/osx/priv.rb', line 12 def is_root? cmd_exec('/usr/bin/id -ru').eql? '0' end |