def export():
    """
    do the export logic
    """
    msg  = '' #return value
    conn = __getConnection()
    #root password
    key  = config.getRootPwd()


    sql = 'select title,  username,password, secret, description FROM ACCOUNT'
    cur = conn.cursor()
    cur.execute(sql)

    lines = []
    for row in cur.fetchall():
        (title,uid,pwd,secret,description) = row
        #decrypt
        title = '"' + title
        if secret:
            secret = util.decrypt(key, secret)
        uid = util.decrypt(key, uid)
        pwd = util.decrypt(key, pwd)
        note = description + u"\\n>>>>>>>>>>>>>>>>>>>>>>\\n" + secret + u'"'
        note = re.sub("\n|\r","\\n",note)
        lines.append(u'","'.join((title,uid,pwd,u"",note)))
    cur.close()
    # print re.sub(r"\\u([a-f0-9]{4})", lambda mg: unichr(int(mg.group(1), 16)), lines.__repr__())

    print "\n".join(lines)
Example #2
0
 def showHidePassword (self,event):
     if self.chk.GetValue():
         self.password.SetValue(util.decrypt(config.getRootPwd(),self.accountObj.pwd))
         self.secret.SetValue(util.decrypt(config.getRootPwd(),self.accountObj.secret) if self.accountObj.secret else "")
     else:
         self.password.SetValue(myGui.INFO_HIDE_TXT)
         self.secret.SetValue(myGui.INFO_HIDE_TXT)
Example #3
0
def export():
    """
    do the export logic
    """
    msg = ''  #return value
    conn = __getConnection()
    #root password
    key = config.getRootPwd()

    sql = 'select title,  username,password, secret, description FROM ACCOUNT'
    cur = conn.cursor()
    cur.execute(sql)

    lines = []
    for row in cur.fetchall():
        (title, uid, pwd, secret, description) = row
        #decrypt
        title = '"' + title
        if secret:
            secret = util.decrypt(key, secret)
        uid = util.decrypt(key, uid)
        pwd = util.decrypt(key, pwd)
        note = description + u"\\n>>>>>>>>>>>>>>>>>>>>>>\\n" + secret + u'"'
        note = re.sub("\n|\r", "\\n", note)
        lines.append(u'","'.join((title, uid, pwd, u"", note)))
    cur.close()
    # print re.sub(r"\\u([a-f0-9]{4})", lambda mg: unichr(int(mg.group(1), 16)), lines.__repr__())

    print "\n".join(lines)
Example #4
0
 def showHidePassword(self, event):
     if self.chk.GetValue():
         self.password.SetValue(
             util.decrypt(config.getRootPwd(), self.accountObj.pwd))
         self.secret.SetValue(
             util.decrypt(config.getRootPwd(), self.accountObj.secret
                          ) if self.accountObj.secret else "")
     else:
         self.password.SetValue(myGui.INFO_HIDE_TXT)
         self.secret.SetValue(myGui.INFO_HIDE_TXT)
Example #5
0
 def onCopyPassword(self, event):
     account = self.pwdService.getPwdById(self.selectedPwdId)
     # decrypted password
     dePwd = util.decrypt(config.getRootPwd(), account.pwd)
     text_data = wx.TextDataObject(dePwd)
     if wx.TheClipboard.Open():
         wx.TheClipboard.SetData(text_data)
         wx.TheClipboard.Close()
     myGui.showInfoDialog(myGui.INFO_CLIPBOARD, account.title)
Example #6
0
 def loadData(self):
     a = self.accountObj
     self.title.SetValue(a.title)
     self.username.SetValue(a.username)
     self.description.SetValue(a.description)
     self.secret.SetValue(util.decrypt(config.getRootPwd(), a.secret) if a.secret else "")
     for tag in a.tags:
         name = tag.name
         self.tags.SetStringSelection(name,True)
Example #7
0
 def onCopyPassword(self,event):
     account = self.pwdService.getPwdById(self.selectedPwdId)
     # decrypted password
     dePwd = util.decrypt(config.getRootPwd(),account.pwd)
     text_data = wx.TextDataObject(dePwd)
     if wx.TheClipboard.Open():
         wx.TheClipboard.SetData(text_data)
         wx.TheClipboard.Close()
     myGui.showInfoDialog(myGui.INFO_CLIPBOARD , account.title)
Example #8
0
 def loadData(self):
     a = self.accountObj
     self.title.SetValue(a.title)
     self.username.SetValue(a.username)
     self.description.SetValue(a.description)
     self.secret.SetValue(
         util.decrypt(config.getRootPwd(), a.secret) if a.secret else "")
     for tag in a.tags:
         name = tag.name
         self.tags.SetStringSelection(name, True)