From: <Z3...@us...> - 2010-06-27 10:17:11
|
Revision: 294 http://spd.svn.sourceforge.net/spd/?rev=294&view=rev Author: Z3po Date: 2010-06-27 10:17:05 +0000 (Sun, 27 Jun 2010) Log Message: ----------- fixed some bugs in spd-cli and added --passfile functionality to use any file as passwordfile (maybe to use in conjunction with --local if a Store is configured?) Modified Paths: -------------- trunk/src/spd-cli trunk/src/spdCore.py Modified: trunk/src/spd-cli =================================================================== --- trunk/src/spd-cli 2010-06-23 14:41:34 UTC (rev 293) +++ trunk/src/spd-cli 2010-06-27 10:17:05 UTC (rev 294) @@ -70,12 +70,17 @@ default=False, help = "do not operate on the configured RCS, only use the local password container") +parser.add_option( "--passfile", + dest = "passfile", + help = "do not use the confgured passfile but the one given here") + + (options, args) = parser.parse_args() # }}} -pc = spdCore.PasswordContainer(ConfigFile,options.localStore) +pc = spdCore.PasswordContainer(ConfigFile,options.localStore,options.passfile) interface = spdCLI.cli(ConfigFile) @@ -86,19 +91,17 @@ pc.exportPasswordsPlain() elif options.delete: - searchPatterns = sys.argv + searchPatterns = args del searchPatterns[0] del searchPatterns[0] pc.delEntry(searchPatterns) pc.exportPasswordsPlain() elif options.deleteID: - id = int(sys.argv[2]) + id = options.deleteID pc.delEntry('nix', id=id) pc.exportPasswordsPlain() - - elif options.pwonly: searchPatterns = args try: @@ -107,15 +110,13 @@ pass elif options.widemode: - searchPatterns = sys.argv - del searchPatterns[0] - del searchPatterns[0] + searchPatterns = args interface.tableOutput(pc.findPassword(searchPatterns)) else: # regular search - searchPatterns = sys.argv - del searchPatterns[0] + searchPatterns = args + print str(searchPatterns) + "\n\n" if options.localStore: try: del searchPatterns[searchPatterns.index('-l')] Modified: trunk/src/spdCore.py =================================================================== --- trunk/src/spdCore.py 2010-06-23 14:41:34 UTC (rev 293) +++ trunk/src/spdCore.py 2010-06-27 10:17:05 UTC (rev 294) @@ -50,7 +50,7 @@ debug: if set to true, the database is /tmp/spd_debug.db autoload: if set to False, the data is not loaded automatically""" - def __init__(self,file,localStore=False,debug=False,autoload=True): #{{{ + def __init__(self,file,localStore=False,passfile=False,debug=False,autoload=True): #{{{ if not debug: self.__sql = sqlite3.connect(":memory:") @@ -84,7 +84,10 @@ # }}} # set the configuration variables - self.file = os.path.expanduser(c.get('Main','file')) + if not passfile: + self.file = os.path.expanduser(c.get('Main','file')) + else: + self.file = passfile self.encryption = c.get('Main','encryption') self.passwordField = c.get('Main', 'passwordField') self.separator = '\t' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |