GDataCopier – Patch PasswordFile
Here is a patch to be able to enter the password with a file. It would
allow to do some scripting without passing it on the command line, while keeping a good security level.
Ex : gcp –passwordfile thefilecontainingthepassword.txt …
Below is a sample patch against 2.0.2 for gcp.
--- gcp.py.dist 2010-01-06 11:47:17.000000000 +0100
+++ gcp.py 2010-01-06 11:51:27.000000000 +0100
@@ -399,6 +399,8 @@
help = 'copies documents to a sub-directory by owner name, if the directory doesn't exist it will be created')
parser.add_option('-p', '--password', dest = 'password',
help = 'password to login to Google document servers, use with extreme caution, may be logged')
+ parser.add_option('', '--passwordfile', dest = 'passwordfile',
+ help = 'name of file containing password to login to Google document servers, this file should obvisouly be read only by user')
parser.add_option('-f', '--format', default = 'oo',
help = 'file format to export documents to, ensure to use default if exporting mixed types (download only option)')
@@ -428,6 +430,9 @@
to enter the password on the command line
"""
+ if options.passwordfile != None:
+ options.password = open(options.passwordfile, 'r').read().strip()
+
if options.password == None:
options.password = getpass.getpass()
Comments are powered by Github. You must authenticate to GitHub before commenting. Create an account if you haven't one, it only takes 1 minute!
Les commentaires sont hébergés sur GitHub. Il vous faudra vous authentifier sur GitHub pour pouvoir commenter. Si vous n'avez pas de compte, une minute suffit à en créer un !