コード例 #1
0
 def do_new(self, arg):
     try:
         username = self.get_username()
         password = self.get_password()
         url = self.get_url()
         notes = self.get_notes()
         node = Node(username, password, url, notes)
         tags = self.get_tags()
         node.set_tags(tags)
         self._db.addnodes([node])
         print "Password ID: %d" % (node.get_id())
     except Exception, e:
         self.error(e)
コード例 #2
0
ファイル: cli.py プロジェクト: ikegam/pwman3
 def do_new(self, arg):
     try:
         username = self.get_username()
         password = self.get_password()
         url = self.get_url()
         notes = self.get_notes()
         node = Node(username, password, url, notes)
         tags = self.get_tags()
         node.set_tags(tags)
         self._db.addnodes([node])
         print "Password ID: %d" % (node.get_id())
     except Exception, e:
         self.error(e)
コード例 #3
0
ファイル: cli.py プロジェクト: k0lter/pwman3
 def do_new(self, args):
     """
     can override default config settings the following way:
     Pwman3 0.2.1 (c) visit: http://github.com/pwman3/pwman3
     pwman> n {'leetify':False, 'numerics':True, 'special_chars':True}
     Password (Blank to generate):
     """
     errmsg = (
         """could not parse config override, please input some"""
         + """ kind of dictionary, e.g.: n {'leetify':False, """
         + """'numerics':True, 'special_chars':True}"""
     )
     try:
         username = self.get_username()
         if args:
             try:
                 args = ast.literal_eval(args)
             except Exception:
                 raise Exception(errmsg)
             if not isinstance(args, dict):
                 raise Exception(errmsg)
             password = self.get_password(1, **args)
         else:
             numerics = config.get_value("Generator", "numerics").lower() == "true"
             # TODO: allow custom leetifying through the config
             leetify = config.get_value("Generator", "leetify").lower() == "true"
             special_chars = config.get_value("Generator", "special_chars").lower() == "true"
             password = self.get_password(0, numerics=numerics, symbols=leetify, special_signs=special_chars)
         url = self.get_url()
         notes = self.get_notes()
         node = Node(username, password, url, notes)
         tags = self.get_tags()
         node.set_tags(tags)
         self._db.addnodes([node])
         print "Password ID: %d" % (node.get_id())
     except Exception, e:
         self.error(e)