Skip to content

Instantly share code, notes, and snippets.

@rockpapergoat
Created November 26, 2010 23:56
Show Gist options
  • Save rockpapergoat/717364 to your computer and use it in GitHub Desktop.
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
#!/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