Class: Snackhack2::ListUsers

Inherits:
Object
  • Object
show all
Defined in:
lib/snackhack2/list_users.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeListUsers

Returns a new instance of ListUsers.



5
6
7
# File 'lib/snackhack2/list_users.rb', line 5

def initialize
  @user = user
end

Instance Attribute Details

#userObject

Returns the value of attribute user.



3
4
5
# File 'lib/snackhack2/list_users.rb', line 3

def user
  @user
end

Instance Method Details

#linuxObject



9
10
11
12
13
# File 'lib/snackhack2/list_users.rb', line 9

def linux
  `cat /etc/passwd`.split("\n").each do |l|
    puts l.split(":")[0]
  end
end

#windowsObject



15
16
17
# File 'lib/snackhack2/list_users.rb', line 15

def windows
  puts `net users`
end

#windows_search_userObject



19
20
21
# File 'lib/snackhack2/list_users.rb', line 19

def windows_search_user
  puts `net user #{@user}`
end