Git Product home page Git Product logo

Comments (13)

thoatswold avatar thoatswold commented on July 21, 2024 2

I found this thread very useful – thank you. I used PlayOnLinux to install Python 2.7 for Windows in the amazonkindle wine prefix, using the .msi installer from https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi. One of the options in the installation wizard is to add python.exe to the PATH, which I left selected – much easier than updating the PATH afterwards. I was then able to run tristank's command (the one beginning WINEPREFIX= above) to generate the kindlekey1.k4i file. From there it was plain sailing.

from dedrm_tools.

richo67 avatar richo67 commented on July 21, 2024 2

It worked for me with 64bit wine (win7 defaults):

  • wine64 (I use default WINE localtion with WINEPREFIX ~/.wine)
  • kindle 1.26
  • python 3.8.10
    • I needed to install Crypto python lib using:
    • wine64 pip install pycryptodome
  • DeDRM 7.2.1
  • calibre 5.31.1 and

then by running your own variation of earlier mentioned command:

 wine64 python.exe "~/.config/calibre/plugins/DeDRM/libraryfiles/kindlekey.py" "/tmp"

which creates kindlekey1.k4i in /tmp. I imported it using DeDRMplugin from calibre

from dedrm_tools.

linuxturtle avatar linuxturtle commented on July 21, 2024 1

I hate to wake this dangling thread. This workaround didn't help. Here's how I got it done (after following the installation instructions for Linux):

Via playonlinux:

  • install the available version of Kindle for PC
  • install python2.7 for windows in the same virtual drive
  • Run IDLE in playonlinux
  • Open kindlekey.pyw with IDLE
  • Run it (F5)
  • It finds the key which can then be imported!
  • Import encrypted book.
  • enjoy free beer!

Wuf, I think I finally got this to work, but with some caveats:

  • You can't install Python 3 in wine (at least, I couldn't, and I couldn't find anyone on the web who could)
  • Python 3 is required for DeDRM 7+
  • DeDRM 7+ is required for Calibre 5+
  • No version of DeDRM will install and work in the 4.99 version of Calibre included in Ubuntu 20.04's repository

Sooo... I had to install the latest Calibre from the developer, then install the latest DeDRM, then also download and extract (but not install) DeDRM 6.8.1 in another directory. Then install Python 2.7 into my kindle4pc WINEPREFIX, and finally run the kindlekey.py I extracted from DeDRM 6.8.1 in that WINEPREFIX. It then found the key, and decrypted it into the same directory as kindlekey.py. Then I used the "Import Existing Keyfiles" to import the key into DeDRM 7 inside Calibre.

This process created a key in the plugin, but I'm still not sure it's working. My whole purpose for this exercise was to decide if I wanted to buy a particular book on Kindle or not (It's a huge automotive repair manual, and I want to be able to print a few pages to reference when I'm working on a particular part of the car, so leaving it encrypted and restricted to view-only isn't an option), so I imported the "Sample Book" Amazon allows you to peruse before buying. Calibre/DeDRM doesn't appear to decrypt the sample book in any way when I import it, so either sample books are treated like library checkouts, or it's not working after all, and I don't know which. Do any of you?

from dedrm_tools.

apprenticeharper avatar apprenticeharper commented on July 21, 2024

Commentators at Alf's blog have mentioned that there seems to be a problem with the current Ubuntu and wine. The python executable should be on the Windows PATH (or whatever the wine equivalent is) but appears not to be. Either the PATH needs to be updated, or python needs installing in the place mentioned in the error message. I don't know how to do either.

from dedrm_tools.

tristan-k avatar tristan-k commented on July 21, 2024

I found a workaround to decrypt the kindlekey, but now I'm unable to open or convert the amazon azw ebook. I manually added the WINEPREFIX to the command.

$ WINEPREFIX=/home/tristank/.PlayOnLinux/wineprefix/amazonkindle/ wine python.exe "/home/tristank/.config/calibre/plugins/DeDRM/libraryfiles/kindlekey.py" "/home/tristank/.config/calibre/plugins/DeDRM/libraryfiles/winekeysdir/"
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
err:winediag:schan_imp_init Failed to load libgnutls, secure connections will not be available.
fixme:iphlpapi:NotifyIpInterfaceChange (family 0, callback 0x69e6d901, context 0x713de0, init_notify 0, handle 0xfde7b4): stub
fixme:iphlpapi:CancelMibChangeNotify2 (handle (nil)): stub
wine: configuration in '/home/tristank/.PlayOnLinux/wineprefix/amazonkindle' has been updated.
kindlekey.py v1.9
Copyright ? 2010-2013 some_updates and Apprentice Alf
searching for kinfoFiles in C:\users\tristank\Local Settings\Application Data
Found K4PC 1.9+ kinf2011 file: C:\users\tristank\Local Settings\Application Data\Amazon\Kindle\storage\.kinf2011
Decrypted key file using IDString '0' and UserName 'BLACKED'
Saved a key to Z:\home\tristank\.config\calibre\plugins\DeDRM\libraryfiles\winekeysdir\kindlekey1.k4i

The error message when converting or opening the azw:

InputFormatPlugin: MOBI Input running
on /path/to/ebook.azw
Found KF8 MOBI of type 'standalone'

The same ebook can be converted or open without flaws on a windows machine.

from dedrm_tools.

apprenticeharper avatar apprenticeharper commented on July 21, 2024

It looks like you've generated the k4i key file. Now import that into the plugin's preferences, and delete the book from calibre and re-import it. As it says in the readme, DRM removal happens on import, not on conversion.

from dedrm_tools.

larkaa avatar larkaa commented on July 21, 2024

This thread was very useful for me as well. Calibre didn't automatically generate the key, so I used the workaround to generate and load they key file, and voilà!

The most difficult step was finding a 32 bit version of Active Python!

from dedrm_tools.

oneyb avatar oneyb commented on July 21, 2024

I hate to wake this dangling thread. This workaround didn't help. Here's how I got it done (after following the installation instructions for Linux):

Via playonlinux:

  • install the available version of Kindle for PC
  • install python2.7 for windows in the same virtual drive
  • Run IDLE in playonlinux
  • Open kindlekey.pyw with IDLE
  • Run it (F5)
  • It finds the key which can then be imported!
  • Import encrypted book.
  • enjoy free beer!

from dedrm_tools.

fca1970 avatar fca1970 commented on July 21, 2024

I hate to wake this dangling thread. This workaround didn't help. Here's how I got it done (after following the installation instructions for Linux):

Via playonlinux:

  • install the available version of Kindle for PC
  • install python2.7 for windows in the same virtual drive
  • Run IDLE in playonlinux
  • Open kindlekey.pyw with IDLE
  • Run it (F5)
  • It finds the key which can then be imported!
  • Import encrypted book.
  • enjoy free beer!

The python console said:
searching for kinfoFiles in C:\users\paco\Local Settings\Application Data
Found K4PC 1.9+ kinf2011 file: C:\users\paco\Local Settings\Application Data\Amazon\Kindle\storage.kinf2011
Decrypted key file using IDString '472438770' and UserName '7061636f'

But the Calibre plugin was not able to find "the default encryption key ..." An I don't know what I must do it

from dedrm_tools.

ElleKayEm avatar ElleKayEm commented on July 21, 2024

You ran the kindlekey script on its own? It should have create a key file which you could then import into the calibre plugin.

from dedrm_tools.

ElleKayEm avatar ElleKayEm commented on July 21, 2024

Your best bet might be to go with calibre 4.23 and DeDRM 6.8, but let's see an import log of the sample book.

from dedrm_tools.

linuxturtle avatar linuxturtle commented on July 21, 2024

Hmm, actually, my problem was a red-herring. The import went fine, and the book wasn't even encrypted, so DeDRM wasn't even invoked and put no output in the log file. It was just a PDF encapsulated within a azw4 file, which the calibre e-book reader code can't cope with (after spinning for a long time, it attempted to show me the raw PDF data as text, which I interpreted as being encrypted). I installed the KindleUnpack extension, used it to extract the embedded PDF, and viola! I have a nice unencrypted PDF, which any pdf reader can handle.

from dedrm_tools.

weskerfoot avatar weskerfoot commented on July 21, 2024

This finally worked for me with the 1.17 version of kindle that I had installed. It was a bit of a rube goldberg, but @linuxturtle's instructions are what finally worked for me. No matter what DeDRM would just refuse to detect and convert to the .k4i file automatically, I had to run python within the wine prefix to get it to work.

from dedrm_tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.