Public » Kiln Backup
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

handle password input securely

Changeset 3a5b70050b44

Parent 41b03cb0da0b

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at 3a5b70050b44 Showing diff from parent 41b03cb0da0b Diff from another changeset...

Change 1 of 3 Show Entire File kilnbackup.py Stacked
 
22
23
24
 
25
26
27
 
33
34
35
36
37
 
 
38
39
40
41
42
 
43
44
45
 
46
47
48
 
50
51
52
53
 
54
55
56
 
22
23
24
25
26
27
28
 
34
35
36
 
 
37
38
39
40
41
42
 
43
44
45
 
46
47
48
49
 
51
52
53
 
54
55
56
57
@@ -22,6 +22,7 @@
     import ConfigParser, sys, urllib, urllib2, cookielib, os, subprocess, shutil, time +import getpass    config = ConfigParser.RawConfigParser()  config.read("kilnbackup.cfg") @@ -33,16 +34,16 @@
   settings = dict(config.items('kiln'))   -def prompt(msg): - value = raw_input(msg) +def prompt(msg, secure): + value = raw_input(msg) if not secure else getpass.getpass(msg)   if not value:   sys.exit()   return value   -def check(section, option, msg): +def check(section, option, msg, secure=False):   if settings.get(option):   return - value = prompt(msg) + value = prompt(msg, secure)   global save   save = True   config.set(section, option, value) @@ -50,7 +51,7 @@
   check("kiln", "server", "FogBugz URL (e.g. https://company.fogbugz.com): ")  check("kiln", "username", "Username: ") -check("kiln", "password", "Password: ") +check("kiln", "password", "Password: ", secure=True)    if save:   f = open("kilnbackup.cfg", "w")