apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.49k stars 1.5k forks source link

Issue Importing KFX Files Involving Wine #561

Closed Wisperer closed 6 years ago

Wisperer commented 6 years ago

Arch Linux with Kernal 4.17.2-1 Calibre 3.26.1 DeDRM Tools 6.6.1 Kindle For PC Version 1.19 KFX Input Plugin is installed. Running Kindle For PC in Wine 3.11 with no issues with the caveat That 1.19 is the latest Kindle for PC release I can get running. Anything newer will install, but crash on loading.

Basically I go to import the KFX Files and the import fails. I get the KFX-ZIP out put instead of KFX.

Log for Calibre in Debug mode: https://pastebin.com/DDp6Bmym

I manually imported the Kindle DRM key and it's able to Decrypt older none KFX books i have.

ElleKayEm commented 6 years ago

Doesn't look like the key you manually imported is right for this book. Did you run the key script with the current installation of Kindle for PC? Because every installation will have its own unique key.

Wisperer commented 6 years ago

Yes I did. This is a new Arch install where I had to wipe everything. So I lost the old key. I installed wine, the .net packages, and a vc runtimes for a few games. Then I added kindle for PC and basically had to GI backwards from the latest release to find one that would run in wine. Then I installed Calibre and the plugins as well as Python and the pycrypto thingy like the reeadme said. I manually ran the keyimport script and added it to the Dedrm plugin and it worked on all my none KFX books

ElleKayEm commented 6 years ago

So the non-KFX books were downloaded with the same installation of Kindle for PC that the KFX books were downloaded with? And the non-KFX books definitely had DRM?

Wisperer commented 6 years ago

Correct. If need be I can produce a log where I import both types of books.

ElleKayEm commented 6 years ago

Yeah, let's look at that. Because books from the same installation should work with the same key.

Wisperer commented 6 years ago

Sorry for taking all day. Busy...

I imported the KFX book first and the older standard azw book second.

https://pastebin.com/8iaaK9Cx

ElleKayEm commented 6 years ago

Hmm, I'm kinda stumped. When you were trying to figure out which version of K4PC would work, did you ever manage to log in before settling at your current version? I'd try downloading fresh copies of a couple books, one of each format, and see what happens.

Wisperer commented 6 years ago

This is a new Arch install where I had to wipe everything.

Thus all file were freshly downloaded.

Far as logging in goes no. Instant crash each time.

I will test some more files and let you know.

ElleKayEm commented 6 years ago

I just haven't seen a key work for one book and not another from the same install until now. Unless there was some other issue -- which doesn't look like the case here. But maybe there's something I'm not aware of with KFX files and/or doing the manual import of the keys. Unless you really want KFX books or have books that are only available in the new format, you could use one of the methods to get your books in the older format. The only other thing I know to suggest is just starting again with a clean install of Kindle for PC 1.19.

Wisperer commented 6 years ago

Well ATM I'm thinking it may be a system config issue. I noticed in the output for EX when i goes to call the script after failing to use the provided DRM key it sets WINEPREFIX to /home/fletcher . It should be setting it to /home/fletcher/.wine

As for why I'm using 1.19 is because at some point amazon WILL crippled this those workarounds.

Wisperer commented 6 years ago

OKAY PROGRESS. I figured out i had to dump the genned keys into /home/fletcher/.config/calibre/plugins/DeDRM/libraryfiles/winekeysdir/ but it still errors out. but differently. https://pastebin.com/HkFRjZnw Edit: Nevermind. I simply bypassed the issue. it still the same error

Wisperer commented 6 years ago

okay so i reinstalled Calibre using the directions i found here https://www.mobileread.com/forums/showthread.php?t=275875

sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda x:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main('/opt')"

and now it works https://pastebin.com/JKMS4Urj

ElleKayEm commented 6 years ago

Beautiful! And it still works on the older format books too?

Wisperer commented 6 years ago

Yes it does. I think there was an issue with the Distro provided binaries. Basically that command forced compiled and installed calibre overtop the distro provided Files. seems like something some where wan't parsing quite right as evident by calibre trying to call wine from /home/fletcher/ instead of /home/fletcher/.wine/

ElleKayEm commented 6 years ago

Cool. Glad you got it working. I've seen that getting DeDRM setup on Linux has been pretty tricky for a while now.

Wisperer commented 6 years ago

Ye think i'll drop the Arch Maintainers a line about it.