apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.52k stars 1.51k forks source link

Unable to de-DRM new Kindle magazines (Windows) #664

Open DefiantCatgirl opened 6 years ago

DefiantCatgirl commented 6 years ago

Windows 10, Kindle for PC, DeDRM 6.61 (though same happens with older versions)

The older issues of the same magazine are getting decrypted just fine through the standalone script, however a fresh one that was just recently published is no longer getting decrypted.

Cannot provide a useful log because I can't get the Calibre plugin to work in the first place - as per https://github.com/apprenticeharper/DeDRM_tools/issues/663 (using the same magazine as an example, it's the same log there regardless of whether it works with the standalone script or not)

The standalone script only writes in the console the following whether the decryption was successful or not:

Using Library AlfCrypto DLL/DYLIB/SO
No nook Study log files have been found.
Using Library AlfCrypto DLL/DYLIB/SO
ElleKayEm commented 6 years ago

A log file wasn't created in your user folder? I know a lot of people are having trouble with the last couple releases of the stand-alone apps.

DefiantCatgirl commented 6 years ago

Oh, there it was, apologies for not reading the docs attentively enough. Unfortunately the log doesn't seem to be too helpful either.

DeDRM v6.6.1: Processing: B07JPH5XWL_EBOK.azw...
MobiDeDrm v0.42.
Copyright © 2008-2017 The Dark Reverser, Apprentice Harper et al.
Decrypting Kindle Format 8 ebook: 電撃マオウ 2018年12月号 [雑誌]
Got DSN key from database C:\Users\Artemiy\AppData\Local\DeDRMPrefs\kindlekey.k4i
Got DSN key from database C:\Users\Artemiy\AppData\Local\DeDRMPrefs\kindlekey1.k4i
Found 4 keys to try after 0.7 seconds
Crypto Type is: 2
Error decrypting book after 0.7 seconds: No key found in 4 keys tried.
Traceback (most recent call last):
  File "D:\Downloads\Software\Ripping\DeDRM_tools_6.6.1\DeDRM_Windows_Application\DeDRM_App\DeDRM_lib\lib\k4mobidedrm.py", line 259, in decryptBook
    book = GetDecryptedBook(infile, kDatabases, androidFiles, serials, pids, starttime)
  File "D:\Downloads\Software\Ripping\DeDRM_tools_6.6.1\DeDRM_Windows_Application\DeDRM_App\DeDRM_lib\lib\k4mobidedrm.py", line 233, in GetDecryptedBook
    mb.processBook(totalpids)
  File "D:\Downloads\Software\Ripping\DeDRM_tools_6.6.1\DeDRM_Windows_Application\DeDRM_App\DeDRM_lib\lib\mobidedrm.py", line 471, in processBook
    raise DrmException(u"No key found in {0:d} keys tried.".format(len(goodpids)))
DrmException: No key found in 4 keys tried.
DeDRM v6.6.1: Failed

DeDRM v6.6.1: Complete:  Successes: 0, Failures: 1
ElleKayEm commented 6 years ago

Yeah, looks like the same problem here. Hopefully a fresh install works for both.

DefiantCatgirl commented 6 years ago

The causes are probably not the same, as the difference is that with the Calibre plugin I can't decrypt anything whatsoever (some kind of config issue), and the standalone app successfully decodes e.g. the previous issues of the same magazine, and only has trouble with the latest one (specific DRM'd file issue). This particular issue really doesn't seem like it can be fixed with a reinstall, and indeed a reinstall didn't work...

ElleKayEm commented 6 years ago

Do fresh copies of the old issues work?

DefiantCatgirl commented 6 years ago

Yes, I re-downloaded an old issue and it was decrypted successfully, although only from the second attempt for some reason.

ElleKayEm commented 6 years ago

Was this only with the stand-alone again? And was the old issue downloaded with the same K4PC installation as the new issue?

DefiantCatgirl commented 6 years ago

Only with the stand-alone (these really are different issues, I think), and both the working and non-working issues were downloaded with the same fresh K4PC installation, yes.

ElleKayEm commented 6 years ago

Hmm, books downloaded with the same app should unlock with the same key.

I'm stumped. The plugin and the stand-alone app use the same Python scripts, but the plugin uses calibre's built in Python and the stand-alone requires you to install Python.

DefiantCatgirl commented 6 years ago

Hmm, books downloaded with the same app should unlock with the same key.

Hence why I suspect there might have been some changes to the encryption or something, although when I downgraded K4PC to 1.17 it still opened the magazine fine, and I still wasn't able to have it decrypted... It's a mystery to me as well, so far.

The only other minor clue I have is that the magazine's .azw alone is almost a whopping 500MB, but the previous issues weren't that far off in terms of filesize and the error didn't seem to be memory-related at first glance. I'll try fiddling with the code to see if I can get more debug data.

Don't think this is directly related to #663, I created that one since I thought solving it might provide a more useful log, but you helped me find the standalone logs already.

DefiantCatgirl commented 5 years ago

Just as an addition, the newer issues of the same magazine are being decrypted successfully, the problem was only with that particular issue so far. I blame the filesize, the other ones were below 350-420 MB, and the problematic one was 480 MB.

Got most of the pages out of the .res file anyway, so not a huge deal in the end.

ElleKayEm commented 5 years ago

Might be able to do it with 64-bit calibre and the plugin if you haven't tried that.

DefiantCatgirl commented 5 years ago

That was a brilliant idea, thanks! Baffled that I didn't think of trying this since this was a memory issue.

While I can't get Calibre to work with DeDrm for reasons beyond my comprehension - I have tried everything - running the standalone in a 64-bit Python environment does seem to do the trick. I don't have that particular magazine, but I had the same problem with a new one (450 MB) and it decrypted perfectly fine when I switched to Python 2.7 64-bit.