Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Crashplan query script
- Queries the crashplan server using subprocess calls and formats the output
- '''
- import subprocess
- import json
- password = raw_input("What password do you want to use: ")
- sitelist = ['US - DC - Washington', 'US - FL - Miami', 'US - GA - Atlanta', 'CA - Toronto']
- cmdsites = ""
- for each in sitelist:
- cmdsites = cmdsites + '(OfficeLocation={})'.format(each)
- ldap_cmd = "ldapsearch -xLLL -S OfficeLocation -h ldap.local.x.com -b cn=users,dc=x,dc=com '(&(!(gidNumber=1088))(|%s))' | grep -w 'uid:' | awk {'print $2'}" % cmdsites
- users = subprocess.check_output([ldap_cmd], shell=True)
- ##### EVERYTHING WORKS UP TO THIS POINT #####
- for each in users:
- # subprocess.call(['curl -X GET -k -u "admin:'+password+'" "https://crashplan.x.com:4285/api/User?username='+each+'@x.com&incBackupUsage=true&strKey=lastBackup"'], shell=True) ### THIS COMMAND WORKS IT JUST GETS PASSED THE WRONG USERNAME
- print each #### THIS PRINTS OUT ONE LETTER PER LINE ####
- print type(users) #### THIS PRINTS OUT ONE NAME PER LINE ####
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement