Web Design

Categorized | cli, Multimedia, Security

Remove DRM from Amazon Kindle’s ebooks using Linux

When you buy an ebook using your Kindle, there’s a 99% chance it’s a DRM file. That means you won’t be able to read it anywhere else but on your Kindle. And we won’t accept that. To be able to convert that file and remove its DRM protection, you need a set of Python scripts called MobiDeDRM.
Now open your Kindle and type 411 on the keypad. This will bring up a window containing information. Write down the 16-character alphanumeric Serial.
Through your computer, buy a book from Amazon.com and save it to your harddrive. The filename shoud be something like Book-Title.azw.
Be sure you have Python installed in Linux. In Ubuntu you can easily install it with sudo apt-get install python.
Extract de files from the MobiDeDRM.zip file and run one of them like this:

python kindlepid.py XXXXXXXXXXX

where XXXXXXXXXXXX is your 16-character Serial. The Terminal window will return something like

Mobipocked PID for Kindle serial# XXXXXXXXXXXXXXXX is Z1QFCDQ*74

That “Z1QFCDQ*74” string is what you need.
Now all you have to do to remove the DRM from the .AZW file is:

python mobidedrm.py Book-Title.azw Book-Title.mobi Z1QFCDQ*74

In a minute or so you should have a DRM-free MobiPocket book you can later convert in any other format you like. If that doesn’t work, try

python mobidedrm2.py Book-Title.azw Book-Title.mobi Z1QFCDQ*74

Author Profile

T4L ;

Other posts by

Author's web site



Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.


24 Comments

  1. K_REY_C

    Any chance this will work 100% if you don’t own a Kindle? I’ve been wanting digital content for a while now but I just won’t do the DRM thing — so I lug around a lot of books.

    1
  2. T4L

    It should work as long as you have that Kindle Serial and the book you downloaded is DRM-enabled. I own a Nook myself but didn’t buy any books with it yet since the B&N store doesn’t let me use my non-US credit card.

    2
  3. K_REY_C

    So how do you get the Kindle Serial w/out the device? At any rate, thanks for this. Once the DRM goes away the honest and thoughtful among us might be able to utilize these newer technologies.

    3

  4. Hate to be the copy editor nerd here, but it’s loaded and misleading to call DRM restrictions “protection”. How about “restrictions” or “scrambling”?

    4
  5. Martin

    I am opposed to DRM as well. But I am opposed to advicing people to break DRM, without informing them that it is illegal, because they accepted the licence agreement in the first place.

    In fact, I think you shouldn’t break the DRM. Just pay for the service. Or buy books in a store if you don’t like the service.

    5
  6. jr

    The 1st download link only contains the MobiDeDRM script, the 2nd one has 3 versions of this script. The kindlepid.py script is not included.

    6
  7. T4L

    @jr: the link has been updated; the zip file should contain now what you need. My bad for not checking the archive earlier.
    @Martin: breaking DRM is illegal in the US. I, on the other hand, don’t live in the US. Secondly, we’re Linux users. We know a thing or two about DRM, so it wasn’t necessary for me to specify it might be illegal.
    @Don Marti: “Protection” was the first word to pop into my head. :) But you might be right there.

    7
  8. T4L

    PS: an easier way to get your Kindle PID is using this online converter: http://kindletools.prestonlee.com/

    8
  9. random internet guy

    @martin

    > without informing them that it is illegal

    It’s not illegal where I live, so it may be legal in most part of the world.

    9
  10. anon

    Looks like these instructions are out of date and won’t work anymore. I believe that the newest Kindle firmware uses pid which is tied both to the Kindle serial number and individual books. So the pid one gets with this method won’t work with kindle2 (as long as it has current firmware) or later. I would gladly be wrong — and the files in the archive could be updated to get the working pid for the latest firmware. But it does not look so based on the timestamps of the files in the archive.

    10

  11. I love this in principle because I have more than 5 devices (counting numerous computers, iPhones, and iPads) and I can only have my books on 5 of them, which is really annoying. Ownership should be mapped to users rather than to devices.

    In any case, I’m wondering how I get the serial number for Kindle software running on my iPad so I can try this process.

    11
  12. T4L

    @David Jameson: The http://kindletools.prestonlee.com/ form also works for the Kindle iPad/iPhone app. Give it a try.

    12
  13. D4K

    MobiDeDrm has stopped working.. had worked before, but now says ‘maybe PID is wrong’. Has Amazon found a way of beating mobidedrm?

    13
  14. Kirby

    While trying to convert .azw and .azw1 files to .mobi, I usually (not always) receive:

    Error: invalid encryption type: 0

    Is anyone else seeing this error?

    14
  15. Mai

    I’ve seen several books of Victorian sermons going cheap on kindle format, but own no kindle: i’m going to buy one and try it. Well, $2 i can afford.

    15
  16. 16
  17. Ty

    Calibre only converts between ebook formats (epub, mobi, etc), it can’t remove drm. If you want to convert a kindle book to epub with calibre, you first have to figure out a way to remove the drm (such as with these mobidedrm scripts). Of course they don’t seem to work for me with the kindle 3, but I’ve only just started trying…

    17

  18. D4K: Wih firmware update 2.5 for the Kindle 2, and always with the Kindle 3, Amazon now uses a per-book PID for DRMed books downloaded to or for use of the Kindle 2 and Kindle 3.

    Kirby: azw1 files and sometimes azw files are in Amazon’s Topaz format raher than the Mobipocket format. MobiDeDRM only handles Mobipocket format.

    mjjzf: Calibre contains no de-drm abilities on its own for legal reasons.

    There are now solutions for al these problems. A way to generate the per-book PID has been reverse engineered. A way to de-drm and extract the info in Topaz format ebooks has been found. And plug-ins for Calibre that remove DRM have been written.

    Yoy can find full instructions and download links to all the tools (including the latest MobiDeDRM, version 0.24), at my blog:

    http://apprenticealf.wordpress.com/

    — Alf.

    18

  19. Is it legal? can u answer pls?

    19
  20. Jeremy

    This method obviously doesn’t work anymore, but a simple solution if you’re reading legitimately-purchased copies of books is to install the Amazon Kindle Reading App for Windows. It installs flawlessly in WINE (at least on Ubuntu) and gives you instant access to all your purchased titles.

    http://www.amazon.com/gp/feature.html/?docId=1000493771

    20
  21. P4Dave

    #Fail? S/No from iPad,
    kindlepid.py works,
    First pgm
    Error: no key found. maybe the PID is incorrec
    Second pgm
    Error: invalid encryption type: 0

    21
  22. BLyons

    According the latest court cases in the US, NO… It’s NOT illegal to break DRM to access what you’ve purchased. It IS illegal to break DRM, if you further use the cracked copy to do something else illegal. IOW, if you break security to either pirate or damage someone’s systems, breaking DRM is an additional charge against you. If you do it for access, it has been ruled (at least in one district court…second or fifth, I believe, and if you’re looking for the case, it was specifically dealing with software) legal, overturning that line of the Millennium Act. Of course, if you ask Amazon, they’ll try to tell you Millennium still stands.

    22
  23. planfan

    I would be more sympathetic to the DRM issue, if it wasn’t so tied up with limiting competing e-readers from reading books from different providers (note that I said providers NOT publishers or authors). It is important to protect the creators of the work. However, I can’t bring myself to buy an e-reader since whichever one I buy excludes important rights that I believe I have, such as the right to BUY books from anybody and view them on my device. The state of affairs with Amazon, for example, is analogous to Apple building computers and an OS and excluding ANY software other than that created by Apple from working on an Apple computer. That is of course NOT the way things are. Software vendors can write for the Apple platform regardless of whether or not they are part of Apple’s company!

    23

  24. @planfan:

    Apple’s walled garden on iOS allows other developers, but only with Apple’s approval. Apple has a TOS that is incompatible with the GNU GPL, so lots of free/open-source software is BANNED from the iOS by Apple. It isn’t (yet) so bad on the Mac, but your analogy is actually more true than you realize. Apple *IS* locking things down.

    24

7 Trackback(s)

  1. 20 08 2010 : How to Remove DRM from Amazon's Kindle Books
  2. 21 08 2010 : Elimina DRM de tus libros Kindle utilizando Linux y Python
  3. 23 08 2010 : Ganalot! » Blog Archive » DS Linux
  4. 23 08 2010 : de la red – 22/08/2010 « Tecnologías y su contexto
  5. 23 08 2010 : El libro electrónico, una incertidumbre para los autores. « Blog multi-temático de Antonio Castro
  6. 23 08 2010 : Elimina DRM de tus libros Kindle utilizando Linux y Python | Noticias HMX
  7. 24 08 2010 : Remove DRM from your Kindle library « 0ddn1x: tricks with *nix

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>