SHARE
TWEET

Untitled

a guest Apr 18th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. import sys
  3. import subprocess
  4. import shlex
  5.  
  6.  
  7. def get_groups(raw_cmd):
  8.     cmd = shlex.split(raw_cmd)
  9.     user_groups = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
  10.     print(user_groups.stdout.read())
  11.     return user_groups.communicate()
  12.    
  13. def main():
  14.     users = raw_input("Enter a comma separated user list: \n")
  15.     print('\n')
  16.     users = users.split(",")    
  17.     for user in users:
  18.         stdout,sterr = get_groups('id %s' % user)
  19.    
  20.  
  21. if __name__ == '__main__':
  22.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top