Пример #1
0
def decryptpdb(infile, outdir, rscpath):
    errlog = ''
    outname = os.path.splitext(os.path.basename(infile))[0] + ".pmlz"
    outpath = os.path.join(outdir, outname)
    rv = 1
    socialpath = os.path.join(rscpath, 'sdrmlist.txt')
    if os.path.exists(socialpath):
        keydata = file(socialpath, 'r').read()
        keydata = keydata.rstrip(os.linesep)
        ar = keydata.split(',')
        for i in ar:
            try:
                name, cc8 = i.split(':')
            except ValueError:
                print('   Error parsing user supplied social drm data.')
                return 1
            try:
                rv = erdr2pml.decryptBook(infile, outpath, True,
                                          erdr2pml.getuser_key(name, cc8))
            except Exception as e:
                errlog += traceback.format_exc()
                errlog += str(e)
                rv = 1

            if rv == 0:
                break
    return rv
 def parseeReaderString(keystuff):
     from calibre_plugins.dedrm.erdr2pml import getuser_key
     userkeys = []
     ar = keystuff.split(':')
     for keystring in ar:
         try:
             name, cc = keystring.split(',')
             # Generate eReader user key from name and credit card number.
             keyname = u"{0}_{1}".format(name.strip(), cc.strip()[-4:])
             keyvalue = getuser_key(name, cc).encode('hex')
             userkeys.append([keyname, keyvalue])
         except Exception, e:
             traceback.print_exc()
             print e.args[0]
             pass
Пример #3
0
 def parseeReaderString(keystuff):
     from calibre_plugins.dedrm.erdr2pml import getuser_key
     userkeys = []
     ar = keystuff.split(':')
     for keystring in ar:
         try:
             name, cc = keystring.split(',')
             # Generate eReader user key from name and credit card number.
             keyname = u"{0}_{1}".format(name.strip(),cc.strip()[-4:])
             keyvalue = getuser_key(name,cc).encode('hex')
             userkeysappend([keyname,keyvalue])
         except Exception, e:
             traceback.print_exc()
             print e.args[0]
             pass