Advertisement
Guest User

Untitled

a guest
May 24th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #!/usr/bin/python
  2. import subprocess
  3. cmd = '/usr/bin/dscl', '.', 'list', '/Users'
  4. task = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  5. (out, err) = task.communicate()
  6. allusers = (out).split()
  7. nonsyss = []
  8. syss = ['jssadmin', 'root', 'puppet', 'daemon', 'nobody', 'Guest', 'jenkins']
  9. for user in allusers:
  10. if (not user[0] == '_') and (user not in syss):
  11. nonsyss.append(user)
  12. print nonsyss
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement