Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Removing DRM protection from eBooks (http://stream-recorder.com/forum/forumdisplay.php?f=63)
-   -  

Removing DRM protection from Kindle for PC ebooks using unswindle

(http://stream-recorder.com/forum/showthread.php?t=5438)

any ANONYMOUS forum user 01-18-2010 11:09 AM

Removing DRM protection from Kindle for PC ebooks using unswindle


 
Unswindle - free open source application, developed by "I love cabbages". It grabs a unique Kindle For PC key for every book using Windows debugging APIs. It then hands all of the actual hard work of actual decryption to darkreverser's MobiDeDRM.

Quote:

Originally Posted by I Love Cabbages
Amazon actually put a bit effort behind the DRM obfuscation in their Kindle For PC application (K4PC). The Kindle proper and Kindle for iPhone/iPod app both use a single "device" encryption key for all DRMed content. K4PC uses the same encryption algorithms, but ups the ante with a per-book session key for the actual en/decryption. And they seem to have done a reasonable job on the obfuscation. Way to go Amazon! It's good enough that I got bored unwinding it all and just got lazy with the Windows debugging APIs instead.

Download the latest version of unswindle:
I Love Cabbages

or
Download unswindle v7
Code:

http://pastie.org/1030388
http://pastie.org/pastes/1293151

Download unswindle v6-rc1
Code:

http://pastie.org/761825
Download unswindle v5
Code:

http://pastie.org/755670
Download unswindle v4
Code:

http://pastie.org/753038
Download unswindle v3
Code:

http://pastie.org/749308
You'll also need a copy of darkreverser's mobidedrm.

Put those kids together (in the same directory) and run unswindle.pyw. It launches KindleForPC.exe. Pick the book you want to decrypt. Close KindleForPC. Pick your output file. And enjoy the sweet taste of freedom.

Script name in honor of rms and The Right to Read. Don't use this to steal, or I'm taking my toys and going home.

Updates. It came to my attention that unswindle version 1 did not work if KindleForPC was installed as a non-administrator and did not work on versions of Windows other than XP. Version 2 should fix these issues. Version 3 fixes an intermittent path-getting issue. Version 4 fixes an exception related to opening thread handles, detect Topaz format books, and detects that you have the proper version of Kindle For PC installed. Version 5 works with the new (20091222) version of the K4PC executable. Version 6 cleanly handles already DRM-free files.

Update 2009-12-22. Amazon has demonstrated that they (unlike Adobe) take their DRM seriously: they've already pushed out a new version of K4PC which breaks this particular script. As you can clearly see via their SHA-1 hashes:
fd386003520f7af7a15d77fcc2b859dd53e44bc1 KindleForPC-installer-20091217.exe

13a816a3abf7a71e7b6a55228099b03b1dc3789b KindleForPC-installer-20091222.exe

The application doesn't seem to auto-update, so if you can find a copy of the original installer you should be fine. Otherwise you'll have to hang tight. Newest unswindle version detects if you have the wrong K4PC executable installed.

Update 2009-12-22 (2). The K4PC update may not actually have been targeted at unswindle, as Amazon seems to have done nothing in particular to make the basic approach more difficult. In any case, unswindle was updated to handle the 20091222 version of the executable. We'll see if Amazon throws out another new build in short order, and I'll put some more elbow grease into figuring out the PID-generation algorithm.

See also:
ebook DRM removal tools archive

Stream Recorder 03-31-2010 03:23 AM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
How to use unswindle
  1. Download and Install python 2.6 for Windows x32 (even if you have Windows x64)
    Note: Do NOT use python 2.7!
  2. Disable UAC if you use Windows 7 or Vista.
  3. Download unswindle.pyw and mobidedrm.py
  4. Double-click unswindle.pyw. Kindle For PC will open.
  5. Select the book you want to convert.
  6. When the book loads, simply exit Kindle For PC.
  7. The "Select unencrypted Mobipocket file to produce" dialog will open asking you where you want to save your decrypted .mobi file. Enter the filename with the .mobi extension and save the DRM-free .mobi file.

Note that unswindle uses mobidedrm, so it can't remove DRM protection from Topaz .tpz ebooks.

b00jum 04-13-2010 07:10 AM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
Ok - all the previous instructions used to work - at least the part up to unswindle. I haven't used it for a few months.

So - it stops working, I check this forum and find you need to add unswindle to the mix. Good enough - download v5 and 6 - neither work - at least the product is not. unswindle seems to do its job and I get an output file.

I'm getting an error in Calibre when I load the output from unswindle.

ERROR: Could not open ebook:

Traceback (most recent call last):
File "site-packages\calibre\gui2\viewer\main.py", line 61, in run
File "threading.py", line 477, in run
File "site-packages\calibre\ebooks\oeb\iterator.py", line 183, in __enter__
File "site-packages\calibre\customize\conversion.py", line 211, in __call__
File "site-packages\calibre\ebooks\mobi\input.py", line 27, in convert
File "site-packages\calibre\ebooks\mobi\reader.py", line 331, in extract_content
File "site-packages\lxml-2.2.2-py2.6-win32.egg\lxml\html\soupparser.py", line 23, in fromstring
File "site-packages\lxml-2.2.2-py2.6-win32.egg\lxml\html\soupparser.py", line 66, in _parse
File "site-packages\beautifulsoup-3.1.0.1-py2.6.egg\BeautifulSoup.py", line 1499, in __init__
File "site-packages\beautifulsoup-3.1.0.1-py2.6.egg\BeautifulSoup.py", line 1230, in __init__
File "site-packages\beautifulsoup-3.1.0.1-py2.6.egg\BeautifulSoup.py", line 1263, in _feed
File "HTMLParser.py", line 108, in feed
File "HTMLParser.py", line 148, in goahead
File "HTMLParser.py", line 226, in parse_starttag
File "HTMLParser.py", line 301, in check_for_whole_start_tag
File "HTMLParser.py", line 115, in error
HTMLParseError: malformed start tag, at line 46, column 12

Any clues?

Stream Recorder 04-13-2010 07:23 AM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
Quote:

Originally Posted by b00jum (Post 18132)
Ok - all the previous instructions used to work - at least the part up to unswindle. I haven't used it for a few months.

So - it stops working, I check this forum and find you need to add unswindle to the mix. Good enough - download v5 and 6 - neither work - at least the product is not. unswindle seems to do its job and I get an output file.

I'm getting an error in Calibre when I load the output from unswindle.

ERROR: Could not open ebook:

Traceback (most recent call last):
File "site-packages\calibre\gui2\viewer\main.py", line 61, in run
File "threading.py", line 477, in run
File "site-packages\calibre\ebooks\oeb\iterator.py", line 183, in __enter__
File "site-packages\calibre\customize\conversion.py", line 211, in __call__
File "site-packages\calibre\ebooks\mobi\input.py", line 27, in convert
File "site-packages\calibre\ebooks\mobi\reader.py", line 331, in extract_content
File "site-packages\lxml-2.2.2-py2.6-win32.egg\lxml\html\soupparser.py", line 23, in fromstring
File "site-packages\lxml-2.2.2-py2.6-win32.egg\lxml\html\soupparser.py", line 66, in _parse
File "site-packages\beautifulsoup-3.1.0.1-py2.6.egg\BeautifulSoup.py", line 1499, in __init__
File "site-packages\beautifulsoup-3.1.0.1-py2.6.egg\BeautifulSoup.py", line 1230, in __init__
File "site-packages\beautifulsoup-3.1.0.1-py2.6.egg\BeautifulSoup.py", line 1263, in _feed
File "HTMLParser.py", line 108, in feed
File "HTMLParser.py", line 148, in goahead
File "HTMLParser.py", line 226, in parse_starttag
File "HTMLParser.py", line 301, in check_for_whole_start_tag
File "HTMLParser.py", line 115, in error
HTMLParseError: malformed start tag, at line 46, column 12

Any clues?

Can you open your MOBI ebook with Mobipocket Reader?

rmhartman 05-17-2010 05:58 PM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
Getting "Unsupported version of kindle for pc" with unswindle v6rc1 and k4pc v1.1.0.

Is there a version of unswindle that handles this version of k4pc, or is there an installer for an earlier version of k4pc available?

Stream Recorder 05-21-2010 03:53 AM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
Quote:

Originally Posted by rmhartman (Post 18988)
Getting "Unsupported version of kindle for pc" with unswindle v6rc1 and k4pc v1.1.0.

Is there a version of unswindle that handles this version of k4pc, or is there an installer for an earlier version of k4pc available?

Getting "Unsupported version of kindle for pc" with unswindle v6rc1 and k4pc v1.1

fallnhopes 06-24-2010 11:47 PM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
I get the following error:
"error = failed to determine book path"

I'm using kindle for pc (beta version)
Any advice?

Stream Recorder 06-25-2010 07:38 AM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
Quote:

Originally Posted by fallnhopes (Post 19783)
I get the following error:
"error = failed to determine book path"

I'm using kindle for pc (beta version)
Any advice?

If you use Windows 7 or Vista, try to disable UAC.
You can also try to disable your firewall and antivirus.

fallnhopes 06-25-2010 10:42 AM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
Quote:

Originally Posted by Stream Recorder (Post 19811)
If you use Windows 7 or Vista, try to disable UAC.
You can also try to disable your firewall and antivirus.

I have both the UAC and firewall and antivirus disabled now. Still seeing the same error.

fallnhopes 06-28-2010 03:05 PM

Re: Removing DRM protection from Kindle for PC ebooks using unswindle


 
Quote:

Originally Posted by fallnhopes (Post 19813)
I have both the UAC and firewall and antivirus disabled now. Still seeing the same error.

I'm running on Windows Vista Home 6.0. Still having the same error appear. I'm new to this. Please help.


All times are GMT -6. The time now is 04:20 AM.