Created
November 26, 2010 23:56
-
-
Save rockpapergoat/717364 to your computer and use it in GitHub Desktop.
trying to find ways to grab account details via dscl on os x clients
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# dump userlist using dscl and find accounts above UID 500 | |
def iterate_users | |
userlist=`/usr/bin/dscl . -list /users UniqueID`.split("\n").slice(1..-1) | |
newlist = userlist.map { |pair| pair.split(" ").to_a } | |
over500 = newlist.find_all { |item| item.at(1).to_i > 500 } | |
p over500 | |
end | |
iterate_users |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment