View Full Version : Mobipocket Decoder Tool


Pages : [1] 2

Nate the great
02-09-2008, 12:35 AM
I apologize in advance for the frustration this will cause.

There is a new DRM stripper for Mobipocket ebooks out on the web. It's written in Python, and it works. Unfortunately, I can't help you find it.

Our forum policy on DRM removal tools is that I can mention the name, and give vague instruction on how to find it. I can't provide a link to the tool. Unfortunately, the new tool doesn't have a name yet. In fact, it hasn't been released or announced or anything. What I have is not the tool, but the source file. A link to the source was posted by a member. The source file is currently on www.pastebin.com. Look there if you want, I doubt you will find it.

So here I am. I can't tell you the name or location, just that it exist. That's not very helpful, I know. I'm sorry.

P.S. I like our forum policy. This is the first time that I've been blocked from helping people.

AnemicOak
02-09-2008, 12:39 AM
I've tried it on the freebie 'Around the world in 80 days' from Fictionwise & it works quite well.

wallcraft
02-09-2008, 02:12 AM
It is interesting that all this takes is a 150 line python script.

Based on the source code, it should be called mobidedrm.py: print "MobiDeDrm v0.01. Copyright (c) 2008 The Dark Reverser"

darkninja
02-09-2008, 06:39 AM
There's a new tool for all mobipocket users out there called MobiDeDrm. It's written in Python, and can apparently be found through a google search.

FixB
02-09-2008, 07:40 AM
That's quite frustrating : I'm apparently not that good at googling hidden stuff :o

tompe
02-09-2008, 07:50 AM
So that means that the MobiPocket format now has the same status as the lit format. It is a format you can buy things in since you then can convert it to anything else. So now the Sony Reader definitely has most books available to buy.

zelda_pinwheel
02-09-2008, 08:45 AM
Could you give us mobi decoder rings instead ? if you could put them inside cereal boxes that would be perfect. also then maybe we could all have secret identities and wear capes while making (or un-drm-ing) ebooks. that would make me really happy.

wallcraft
02-09-2008, 11:44 AM
I'm apparently not that good at googling hidden stuff Google "pastebin MobiDeDrm". All you get is the source code for a Python program, so you may have found it without realizing what you had.

ProfJulie
02-09-2008, 11:44 AM
The last time a Mobipocket decoder was available, it was shut down pretty quickly with the threat of a lawsuit, so don't expect this one to be available for a long time.

You won't find it searching through the link that Nate provided, but there are other clues in his posting that will help you figure out where to look. It took me about 30 minutes last night to figure it out.

The decoder works a treat! And it's funny, but I feel like my DRM Mobipocket books are worth more to me now and I'm more willing to spend the money on them because now I know I will not be constrained in using them - I never realized how much I hate DRM.

captaingeorges
02-09-2008, 12:04 PM
The last time a Mobipocket decoder was available, it was shut down pretty quickly with the threat of a lawsuit, so don't expect this one to be available for a long time.

You won't find it searching through the link that Nate provided, but there are other clues in his posting that will help you figure out where to look. It took me about 30 minutes last night to figure it out.

The decoder works a treat! And it's funny, but I feel like my DRM Mobipocket books are worth more to me now and I'm more willing to spend the money on them because now I know I will not be constrained in using them - I never realized how much I hate DRM.

More clues please... I must be stupid...

tompe
02-09-2008, 12:09 PM
The last time a Mobipocket decoder was available, it was shut down pretty quickly with the threat of a lawsuit, so don't expect this one to be available for a long time.


But wasn't that because copyrighted code was used? In what respect is this program different from ConvertLit that has not been removed?

DMcCunney
02-09-2008, 12:16 PM
The magic word "m40582493" might help in locating it...
______
Dennis

ProfJulie
02-09-2008, 12:18 PM
More clues please... I must be stupid...

Anemic Oaks posting was a pretty big clue for me (thanks Anemic Oaks).

But wasn't that because copyrighted code was used? In what respect is this program different from ConvertLit that has not been removed?

I don't know much about the specific reason the other decoder was removed. This decoder is really not a program at all. It is lines and lines of Python code that is not compiled into a program, so you'll need to install Python to your computer (http://www.activestate.com/Products/activepython/) before you can run it. Nonetheless once you connect all the dots, it is fairly easy to run and works quite well. It does not extract the HTML files like converlit, it only removes the DRM.

tompe
02-09-2008, 12:42 PM
I don't know much about the specific reason the other decoder was removed. This decoder is really not a program at all. It is lines and lines of Python code that is not compiled into a program, so you'll need to install Python to your computer (http://www.activestate.com/Products/activepython/) before you can run it. Nonetheless once you connect all the dots, it is fairly easy to run and works quite well. It does not extract the HTML files like converlit, it only removes the DRM.

Well, it is a program. It is just not in a form that is directly executable. To execute the program you have to run an intepreter.

convertLit as i understand it constists of two part. One part that only remove the drm. And one part that pakes a drm free lit file and explode it.

wallcraft
02-09-2008, 12:47 PM
This also seems to work on AZW files by the way:
mobidedrm infile.azw outfile.mobi KindlePID

Amazon.com has got out of the e-book selling business before, leaving its e-book buyers with no way to move e-books to new devices. So it is comforting to know that there is a work around (at least for AWZ books) if they decide that there won't be a Kindle II or that Kindle I e-books are not transferable to Kindle IIs.

AnemicOak
02-09-2008, 12:55 PM
The decoder works a treat! And it's funny, but I feel like my DRM Mobipocket books are worth more to me now and I'm more willing to spend the money on them because now I know I will not be constrained in using them - I never realized how much I hate DRM.

I know exactly what you mean.


Now Sony users like me just need mobi/prc2lrf & I'd be really happy. I used mobi2html on the un-DRM'd file & it worked great to turn it into something I could convert.

Nate the great
02-09-2008, 01:13 PM
It looks like the author saw this thread and reposted the the tool. Downloading it is easy; there is a button you click. You then have to rename the file to something.py and it will run.

This also seems to work on AZW files by the way:
mobidedrm infile.azw outfile.mobi KindlePID

Amazon.com has got out of the e-book selling business before, leaving its e-book buyers with no way to move e-books to new devices. So it is comforting to know that there is a work around (at least for AWZ books) if they decide that there won't be a Kindle II or that Kindle I e-books are not transferable to Kindle IIs.

It doesn't yet work on AZW1 or TPZ. Oh, well.

Nate the great
02-09-2008, 01:21 PM
The decoder works a treat! And it's funny, but I feel like my DRM Mobipocket books are worth more to me now and I'm more willing to spend the money on them because now I know I will not be constrained in using them - I never realized how much I hate DRM.

And that's exactly why I wanted everyone to know about it.

DMcCunney
02-09-2008, 02:03 PM
convertLit as i understand it constists of two part. One part that only remove the drm. And one part that pakes a drm free lit file and explode it.One program, three modes of operation:

This program has three modes of operation:
First, is ** EXPLOSION **, or the expanding of a .LIT file into an
OEBPS compliant package.

Second, is the DOWNCONVERTING of a .LIT file down to "Sealed",
or DRM1 format for reading on handheld devices.

Third, is the INSCRIBING of a .LIT file which allows you to label
your ebooks.

Mode is selected by command line parms.
______
Dennis

IceHand
02-09-2008, 05:20 PM
Thanks, works great!
Btw, ConvertLIT has not been taken down yet, because their server is located in Poland. Read here: http://www.convertlit.com/legal.php

stxopher
02-09-2008, 05:45 PM
Because ConvertLIT is available my book budget has been over limit for months. I can only imagine the financial repercussions that would follow if I could move Mobi books around to my reader too. No way I can afford it!

(Though, do I really need cable? I'd have more books. Hmmmm...)

jswinden
02-10-2008, 12:20 AM
I only get errors, lots of errors. Doesn't seem to be a reliable program unless I'm missing something. I thought it would de-drm MobiPocket files, but I only get errors. Apparently it doesn't work for *.prc type MobiPocket files designed for the Palm OS.

AnemicOak
02-10-2008, 12:26 AM
I only get errors, lots of errors. Doesn't seem to be a reliable program unless I'm missing something. I thought it would de-drm MobiPocket files, but I only get errors. Apparently it doesn't work for *.prc type MobiPocket files designed for the Palm OS.

Worked fine on the Mobi .prc file I tried it on. If you post the errors you're getting maybe someone can help.

ProfJulie
02-10-2008, 01:19 AM
I got a few errors when I first tried to use it. Here are some things you can do:

Run the program from the same folder where the books are stored.
If any books have really long titles, first rename the book to a shorter title (don't use spaces in the name).

igorsk
02-10-2008, 04:04 AM
But wasn't that because copyrighted code was used? In what respect is this program different from ConvertLit that has not been removed?
When I posted here my mobi decoder which didn't use Java libs it resulted in a C&D letter.
BTW it was also in Python and seems to have been the basis for this implementation.

darkninja
02-10-2008, 11:44 AM
I made a script to convert eReader.com books to HTML

How to locate it:

AnemicOak
02-10-2008, 12:46 PM
[QUOTE=darkninja;148159]I made a script to convert eReader.com books to HTML

How to locate it:
1) Find the *******.
2) Replace the last part of the URL

Tried it on the freebie from Fictionwise (Bold Type Conversations) and get the error "incorrect eReader version (error 1)".

wallcraft
02-10-2008, 01:26 PM
I have started an eReader Decoder Tool (http://www.mobileread.com/forums/showthread.php?t=20407) thread.

Nate the great
02-10-2008, 04:16 PM
I removed a number of posts here because they violated forum policy. We do not discuss how to use DRM removal tools. M apologies if this offends anyone but rules are rules.

wallcraft
02-10-2008, 07:18 PM
The mobidedrm tool does seem to allow Kindle AZW e-books to be read by MobiPocket Reader software and (all) MOBI e-books to be read on the Kindle.

However, it may not allow format shifting because the MOBI "exploder" mobi2html does not work on files that use "Mobipocket hufdif compression" (mobigen -c2). Most DRM-free MOBI files use simple compression, but it is unknown what fraction of DRM-laden files use hufdif.

It would probably be ok for mobi2html to add support for hufdif (particularly since there are some DRM-free MOBIs using it), but first someone has to work out how to decompress such files.

DaleDe
02-10-2008, 07:54 PM
The mobidedrm tool does seem to allow Kindle AZW e-books to be read by MobiPocket Reader software and (all) MOBI e-books to be read on the Kindle.

However, it may not allow format shifting because the MOBI "exploder" mobi2html does not work on files that use "Mobipocket hufdif compression" (mobigen -c2). Most DRM-free MOBI files use simple compression, but it is unknown what fraction of DRM-laden files use hufdif.

It would probably be ok for mobi2html to add support for hufdif (particularly since there are some DRM-free MOBIs using it), but first someone has to work out how to decompress such files.

There are plenty of people including the author of FBReader that would like to have the answer to that question.

Dale

HarryT
02-11-2008, 04:03 AM
Has anyone tried asking Mobi for a specification of the compression format?

kovidgoyal
02-11-2008, 04:07 AM
I'd guess it would be some kind of huffman code, since that's optimal for data on which you have a good prior. See http://en.wikipedia.org/wiki/Huffman_coding

darkninja
02-11-2008, 04:53 AM
If someone can provide me with mobipocket files that use the HuffDic compression scheme, I could attempt to write a decoder, assuming the compression format isn't too complicated and/or it would take too much time to figure out how it works.

Jaapjan
02-11-2008, 05:02 AM
If you want to do such a thing then the easiest thing you can do is to get the free mobipocket creator from their website, generate a miniature book and compress it with various kinds including the c2 option so you can check how it proceeds from raw uncompressed to compressed state. Really, all you need you can download for free already.

tompe
02-11-2008, 07:43 AM
Has anyone tried asking Mobi for a specification of the compression format?

It was asked in

http://www.mobipocket.com/forum/viewtopic.php?t=6712&highlight=decompressing

by DMcCunney but no answer.

DMcCunney
02-11-2008, 11:43 AM
Has anyone tried asking Mobi for a specification of the compression format?Yes, on their Creator forum. As expected, no response.
______
Dennis

tompe
02-11-2008, 11:46 AM
Yes, on their Creator forum. As expected, no response.
______
Dennis

I wonder why they could not have responded with just "No"?

TallMomof2
02-11-2008, 07:05 PM
Thank-you, DarkNinja for liberating my DRMed books! Even with the flu I feel like dancing!

darkninja
02-12-2008, 01:35 PM
I wrote a decompressor for the new huffdic compressed files. Maybe this code can be incorporated into mobiperl?

Note. This program does not break any DRM encryption, so it's not illegal. It just decompresses files compressed with the new compression into a raw html file.

Thanks to Igor Skochinsky for the valuable assistance.

http://pastebin.com/m656dfbda

llasram
02-12-2008, 02:41 PM
I wrote a decompressor for the new huffdic compressed files.

Nice! However for the one from-the-wild compressed mobipocket book I have the trailing data-entries size calculation is obviously spurious (e.g. values like 251929435 bytes), which results in significant quantities of clipped text. Any chance you could take a second look at your algorithm / post details of how you derived the algorithm you do have?

joewandy
02-12-2008, 10:15 PM
Thank-you, DarkNinja for liberating my DRMed books! Even with the flu I feel like dancing!

Thanks from me too :)

Ironically for MobiPocket, this development would just result in more business from me as I would be less hesitant in buying more buying more Mobi books from now on.

darkninja
02-13-2008, 01:31 PM
I made a blog!

http://darkreverser.wordpress.com/

Here you can read about my reversing!

badgoodDeb
02-13-2008, 02:01 PM
Oooo - I see on your blog that you've also got an eReader to html converter. THAT one I'll have to go try! I have a *bunch* of eReader books, that I haven't all read yet and want to read on my Kindle. :)

mores
02-13-2008, 05:45 PM
hmmmmmm ... what about protected eReader books?
There's a book I *really* want to read, but it's only available in pbook or eReader format. Could I buy it from eReader and then convert it to html? *ohpleaseohpleaseohplease*

EDIT: as I can see in another thread (http://www.mobileread.com/forums/showthread.php?p=149217), your tool will do just that! excellent!

FixB
02-13-2008, 07:16 PM
Hum, without any judgment on the interest of the scripts available on your blog, I don't know if posting a direct link to those scripts is compliant with the forum rules ??

DMcCunney
02-13-2008, 07:19 PM
Hum, without any judgment on the interest of the scripts available on your blog, I don't know if posting a direct link to those scripts is compliant with the forum rules ??The scripts aren't on the blog.
______
Dennis

FixB
02-14-2008, 01:41 PM
Quite true :)

Icarusbop
02-15-2008, 12:31 PM
OK:

So I want 'The Dark River' by john twelve hawks. on fictionwise it is $17.89 and on Amazon for Kindle it is $9.99! Big difference!!

I don't have a Kindle, but theoretically I could get the kindle version, and dismantle it with this tool, then format it for my Sony, with various tools.

How can I but the kindle version without a kindle though?

wallcraft
02-15-2008, 12:57 PM
How can I but the kindle version without a kindle though? You can't. I look on the $400 purchase price as including a subsidy for bestselling e-books (i.e. you are overpaying for the Kindle if you never buy discounted e-books from Amazon).

JSWolf
02-15-2008, 01:15 PM
The Dark River is $14.36 at BooksOnBoard.

Nate the great
02-15-2008, 01:46 PM
OK:

So I want 'The Dark River' by john twelve hawks. on fictionwise it is $17.89 and on Amazon for Kindle it is $9.99! Big difference!!

I don't have a Kindle, but theoretically I could get the kindle version, and dismantle it with this tool, then format it for my Sony, with various tools.

How can I but the kindle version without a kindle though?

You probably can't use this tool to dismantle that ebook. If they offer a sample chapter then this ebook was likely licensed to amazon through the publisher channel, not the DIY channel. The ebook probably has DRM that would make it incompatible.

There are actually 3 file types sold by Amazon: AZW, AZW1, and Topaz (TPZ or TAN). AZW is Mobipocket format and usually has no DRM. AZW1 is the DRMed Mobipocket format with one extra identifier added to the file header. Topaz is slightly different from the others and it has more features.

lovebeta
02-15-2008, 03:07 PM
You probably can't use this tool to dismantle that ebook. If they offer a sample chapter then this ebook was likely licensed to amazon through the publisher channel, not the DIY channel. The ebook probably has DRM that would make it incompatible.

There are actually 3 file types sold by Amazon: AZW, AZW1, and Topaz (TPZ or TAN). AZW is Mobipocket format and usually has no DRM. AZW1 is the DRMed Mobipocket format with one extra identifier added to the file header. Topaz is slightly different from the others and it has more features.
From my experiance, I think some AZW are DRMed, some are not (mostly the thirdparty production). And AZW1 and TPZ are the same thing. The topaz format is mostly used for tech manuscripts and the books with special formatting because it can use an embedded font and scanned text/equations.

curtw
02-21-2008, 10:08 AM
Sorry, but my e-mail and blog posting to darkreverser aren't getting any responses. Has anyone successfully run mobidedrm using the Python that comes with Mac OS 10.4? It's Python 2.35, and I get syntax errors. I could upgrade to 2.4 or 2.5, but it's not like I run Python for anything else, so I wouldn't go to the effort if it just plain won't work even with an upgrade.

(If it's any help, the book I'm trying to "liberate" is the free "Around the world in 80 Days" from fictionwise.)

joewandy
02-22-2008, 05:02 AM
Sorry, but my e-mail and blog posting to darkreverser aren't getting any responses. Has anyone successfully run mobidedrm using the Python that comes with Mac OS 10.4? It's Python 2.35, and I get syntax errors. I could upgrade to 2.4 or 2.5, but it's not like I run Python for anything else, so I wouldn't go to the effort if it just plain won't work even with an upgrade.

(If it's any help, the book I'm trying to "liberate" is the free "Around the world in 80 Days" from fictionwise.)

The version of Python used probably would matters more rather than which platform (Windows, Mac, ...) that you use. I can confirm that the script works on Python 2.5 / XP, so try to upgrade your version. It's not too much of an effort anyway :P

badgoodDeb
02-22-2008, 02:12 PM
I *have* done it on a mac, 10.4.11 -- but I didn't realize python was already here. I downloaded and installed the new one pointed to. It works great with that! Quite easy.

I never got the mobiperl set of scripts to work, though ..... I eventually download the executable for a PC, and used it easily that way.

curtw
02-23-2008, 01:03 PM
I *have* done it on a mac, 10.4.11 -- but I didn't realize python was already here. I downloaded and installed the new one pointed to. It works great with that! Quite easy.

I never got the mobiperl set of scripts to work, though ..... I eventually download the executable for a PC, and used it easily that way.

When you said "new one pointed to," did you mean ActivePython at activestate.com? I was considering the "official" distro at python.org...

JSWolf
02-23-2008, 01:35 PM
I have Python 2.5 for XP and I've not had any issues with Darkreverser's scripts due to the version of Python.

flubu
03-03-2008, 06:29 AM
I have Python 2.5 for XP and I've not had any issues with Darkreverser's scripts due to the version of Python.


D:\temp>python mobydedrm.py Aroundtheworldin80days.prc test.prc *******$**
MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Decrypting. Please wait...
Traceback (most recent call last):
File "mobydedrm.py", line 176, in <module>
file(outfile, 'wb').write(DrmStripper(data_file, pid).getResult())
File "mobydedrm.py", line 159, in __init__
extra_size = getSizeOfTrailingDataEntries(data, len(data), extra_data_flags)

File "mobydedrm.py", line 74, in getSizeOfTrailingDataEntries
num += getSizeOfTrailingDataEntry(ptr, size - num)
File "mobydedrm.py", line 64, in getSizeOfTrailingDataEntry
v = ord(ptr[size-1])
IndexError: string index out of range


I'm having errors running the script. I have activestate python on XP and I'm trying to liberate the free Around the world in 80 days from fictionwise. The PID I have is from my laptop installation of mobipocket reader. Could it be problematic that it contains a $, which could be badly expanded as a variable at some point?

flubu
03-03-2008, 07:09 AM
I feel like I'm missing something very obvious. Granted, it is monday morning, but still...

I've gotten the python script to work (for some reason, it does not like my XP box but seems quite happy to work under linux) and converted Aroundtheworldin80days.prc from fictionwise. Having said that, I tried to use the python script to decompress to HTML that has been mentioned earlier in this thread and get the following error:


MobiHuff v0.02
Copyright (c) 2008 The Dark Reverser <dark.reverser@googlemail.com>
Decompressing...
Error: invalid compression type


Furthermore, if I try ABC Palm Converter (heck, the file has a PRC extension, might as well try), I get gibberish as HTML output.

The end goal I'm trying to achieve here is to convert a DRM mobi file into plain HTML so that I can put it on my sony reader.

What's the missing step here folks?

Gudy
03-03-2008, 09:16 AM
AFAIK, MobiHuff only properly decompresses HuffDic-compressed files. For uncompressed or palm-compressed files, use mobi2html from the MobiPerl tool collection, available in the Content sub-forum.

IceHand
03-03-2008, 09:20 AM
The MobiHuff script is only for huffdic compressed mobi files, you should try mobi2html (http://www.mobileread.com/forums/showthread.php?t=17718).

EDIT: Heh, Gudy was faster ...

wallcraft
03-03-2008, 11:30 AM
The other option is mobi2oeb (http://www.mobileread.com/forums/showthread.php?t=20626). This should explode any DRM-free MOBI file.

JSWolf
03-03-2008, 12:30 PM
flubu try the official Python from http://www.python.org

JSWolf
03-03-2008, 12:30 PM
I feel like I'm missing something very obvious. Granted, it is monday morning, but still...

I've gotten the python script to work (for some reason, it does not like my XP box but seems quite happy to work under linux) and converted Aroundtheworldin80days.prc from fictionwise. Having said that, I tried to use the python script to decompress to HTML that has been mentioned earlier in this thread and get the following error:


MobiHuff v0.02
Copyright (c) 2008 The Dark Reverser <dark.reverser@googlemail.com>
Decompressing...
Error: invalid compression type


Furthermore, if I try ABC Palm Converter (heck, the file has a PRC extension, might as well try), I get gibberish as HTML output.

The end goal I'm trying to achieve here is to convert a DRM mobi file into plain HTML so that I can put it on my sony reader.

What's the missing step here folks?
ABC converters are not good. I've tried some to convert content into PDF and RTF and found that the files generated were just barely usable. For example, the RTF was awful and the only way to fix it was to load it into Word and resave it. PDF there's no hope for. Also, the LIT converter is buggy so that's out. Yes it converts, but it has bugs so the conversion is not all that wonderful. The LRF converter strips out all styles and graphics on conversion. When it first came out I messages the author and asked about that and was told soon and soon has now become never.

brecklundin
03-04-2008, 02:09 AM
tomorrow I just have to try the scripts on my Nokia N800...I have Python 2.5 installed so it should run...I too send many thanks and definitely will be much less reluctant to buy DRM'd mobi ebooks as it was not previously possible to read them in Fbreader.

So, well, I guess my book budget is shot to heck now too...great... :)

brecklundin
03-04-2008, 05:38 AM
D:\temp>python mobydedrm.py Aroundtheworldin80days.prc test.prc *******$**
MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Decrypting. Please wait...
Traceback (most recent call last):
File "mobydedrm.py", line 176, in <module>
file(outfile, 'wb').write(DrmStripper(data_file, pid).getResult())
File "mobydedrm.py", line 159, in __init__
extra_size = getSizeOfTrailingDataEntries(data, len(data), extra_data_flags)

File "mobydedrm.py", line 74, in getSizeOfTrailingDataEntries
num += getSizeOfTrailingDataEntry(ptr, size - num)
File "mobydedrm.py", line 64, in getSizeOfTrailingDataEntry
v = ord(ptr[size-1])
IndexError: string index out of range


I'm having errors running the script. I have activestate python on XP and I'm trying to liberate the free Around the world in 80 days from fictionwise. The PID I have is from my laptop installation of mobipocket reader. Could it be problematic that it contains a $, which could be badly expanded as a variable at some point?

I could not wait and tried to run the script on both the N800 as well as my XPP-PC. Both running Python 2.5. I get the same error in both:




C:\>c:\python25\python c:\drm\mobidedrm.py c:\drm\book1.prc c:\drm\book1-open.prc XXXXXXXXXX
MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Decrypting. Please wait...
Traceback (most recent call last):
File "c:\drm\mobidedrm.py", line 176, in <module>
file(outfile, 'wb').write(DrmStripper(data_file, pid).getResult())
File "c:\drm\mobidedrm.py", line 159, in __init__
extra_size = getSizeOfTrailingDataEntries(data, len(data), extra_data_flags)
File "c:\drm\mobidedrm.py", line 74, in getSizeOfTrailingDataEntries
num += getSizeOfTrailingDataEntry(ptr, size - num)
File "c:\drm\mobidedrm.py", line 64, in getSizeOfTrailingDataEntry
v = ord(ptr[size-1])
IndexError: string index out of range



So it's not my system. I can say this file contains two books. But I am unsure if that really matters.

IceHand
03-04-2008, 06:50 AM
There's a bug in v.0.02 of MobiDeDrm that will cause it to fail on some files. Try version 0.01.

Tulkas
03-04-2008, 09:38 AM
-deleted, found solution-

brecklundin
03-04-2008, 01:17 PM
There's a bug in v.0.02 of MobiDeDrm that will cause it to fail on some files. Try version 0.01.

thanks Ice, will give it a fast try. It was cool that it failed on my systems in the same fashion on both the N800 tablet running ITOS2008. Off to d/l v0.01...

JSWolf
03-04-2008, 01:18 PM
best idea is to keep both .01 and .02 just in case.

brecklundin
03-04-2008, 02:20 PM
yup, got them both as well as all three versions of HuffDiff.

v0.01 did the trick and I now can read my secure mobi books on my N800 tablet...super job folks!! thanks a bunch as using the tablet as an ebook reader is one of the two primary functions of the device for me.

IceHand
03-04-2008, 03:48 PM
Glad that it worked out.

By the way instead of HuffDiff you should take a look at mobi2oeb (http://www.mobileread.com/forums/showthread.php?t=20626), if you haven't done so already.

RWood
03-04-2008, 07:15 PM
I feel like I'm missing something very obvious. Granted, it is monday morning, but still...

I've gotten the python script to work (for some reason, it does not like my XP box but seems quite happy to work under linux) and converted Aroundtheworldin80days.prc from fictionwise. Having said that, I tried to use the python script to decompress to HTML that has been mentioned earlier in this thread and get the following error:


MobiHuff v0.02
Copyright (c) 2008 The Dark Reverser <dark.reverser@googlemail.com>
Decompressing...
Error: invalid compression type


Furthermore, if I try ABC Palm Converter (heck, the file has a PRC extension, might as well try), I get gibberish as HTML output.

The end goal I'm trying to achieve here is to convert a DRM mobi file into plain HTML so that I can put it on my sony reader.

What's the missing step here folks?
Certain PRC creation applications can be converted easily with ABC Palm Converter while others will result in a mish-marsh. Almost all of the PRC files that I have converted with the free ABC Palm Converter have worked fine.

brecklundin
03-04-2008, 08:07 PM
Glad that it worked out.

By the way instead of HuffDiff you should take a look at mobi2oeb (http://www.mobileread.com/forums/showthread.php?t=20626), if you haven't done so already.

Outstanding!! Thanks for the link!

pdurrant
06-22-2008, 09:33 AM
It's possible to patch the 0.02 script to make it work with all the files that work with 0.01. Try the following changes:

Add two lines before line 63 (while True: )

if size <= 0:
return result


Comment out line 72 (while flags: ) and remove one indent tab from each of the following three lines
(if flags & 1:
num += getSizeOfTrailingDataEntry(ptr, size - num)
flags >>= 1)

And that should do it. It's worked on all my DRMed files - around 50 or so, some of which wouldn't work with 0.01 and some wouldn't work with 0.02.

Paul

There's a bug in v.0.02 of MobiDeDrm that will cause it to fail on some files. Try version 0.01.

IceHand
06-22-2008, 11:07 AM
Thank you, Paul! It worked with all of my 49 DRMed files – no switching back and forth between version 0.01 and 0.02 anymore.

bwaldron
06-24-2008, 04:05 PM
Thank you, Paul! It worked with all of my 49 DRMed files – no switching back and forth between version 0.01 and 0.02 anymore.

Yes, thanks indeed!

raymino
06-24-2008, 09:28 PM
I’ve had success with Mobidedrm before, now all I’m getting is …

MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Removes protection from Mobipocket books
Usage mobidedrm infile.mobi outfile.mobi PID

The result is the same whether I just type "mobidedrm", or "mobidedrm" with input file name, both file names, or the complete statement with both file names and my PID.

I am in the python25 folder and my DRM'd book is in that folder.

Any help would be appreciated. Thanks.

Ray

wallcraft
06-24-2008, 11:38 PM
I’ve had success with Mobidedrm before, now all I’m getting is …

MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Removes protection from Mobipocket books
Usage mobidedrm infile.mobi outfile.mobi PID

The result is the same whether I just type "mobidedrm", or "mobidedrm" with input file name, both file names, or the complete statement with both file names and my PID. This should only happen if there are fewer than 3 arguments after mobidedrm. For example, mobidedrm A B C should give a different error (no such file or directory A).

raymino
06-25-2008, 12:41 AM
Thanks wallcraft,

Yeah, thats right. I get the same message whether I put in 0, 1, 2 or all three arguments.

I use CMD from XP Run. I cd\python25
then I get the prompt c:\python25>
then i type mobidedrm triumph.mobi mytri.mobi BV38BEF$ND

I always get the same message.

When it worked before, it worked on some mobipocket books I downloaded 3 years ago. This is happening with one I downloaded recently. The old ones don't even work anymore.

I uninstalled and reinstalled python 2.5. When I use the python editor and choose "Run", with debugging, it seems to hang on the first line where it says "import sys,struct,binascii". I don't know where this stuff is to import from.

Ray

JSWolf
06-25-2008, 12:45 AM
With Python 2.5 installed, I don't need to go to the Python directory. I just have a directory that has the Python programs there and use the command (most of the time)...

mobidedrm.py DRMladenebook.prc nonDRMladenebook.prc PID and it works. If it doesn't work, it means I need to use verison 0.01. But with the new fix, I might not need 0.01 any longer.

raymino
06-25-2008, 12:51 AM
Thanks JSWolf,

I noticed you began you statement with "mobidedrm.py" instead of just "mobidedrm". I think I've tried that, but will try again. I just tried it and same result.

Do I have to have something running in the background? Something that should be in my startup folder?

Ray

wallcraft
06-25-2008, 01:32 AM
Yeah, thats right. I get the same message whether I put in 0, 1, 2 or all three arguments. Try EXACTLY mobidedrm A B C (arguments are "A" "B" and "C") this should not give you the usage message but instead (something like) A not found. If it does give the same usage message, then something very strange is happening. The other thing to try is:

.\mobidedrm.py "triumph.mobi" "mytri.mobi" "BV38BEF$ND"

The ".\" forces windows to use the copy of mobidedrm.py in the current directory and the quotes should ensure that the command sees exactly the expected arguments.

JSWolf
06-25-2008, 09:04 AM
I have nothing special running in the background. All I have is Python 2.5 installed on Windows XP Pro.

pilotbob
06-25-2008, 12:21 PM
Thanks JSWolf,

I noticed you began you statement with "mobidedrm.py" instead of just "mobidedrm". I think I've tried that, but will try again. I just tried it and same result.

Do I have to have something running in the background? Something that should be in my startup folder?

Ray

What happens if you just type python in your command window?

BOb

bwaldron
06-25-2008, 03:25 PM
I noticed you began you statement with "mobidedrm.py" instead of just "mobidedrm". I think I've tried that, but will try again. I just tried it and same result.

Do I have to have something running in the background? Something that should be in my startup folder?


Installing Python on your system should add it to your path. This allows you to execute mobidedrm.py from anywhere.

Depending upon which version of Python you installed, it may have modified your system PATHEXT environment variable to include .py . This allows you to run .py files without specifying the extension; i.e., run the script as just "mobidedrm." You can change this manually via Control Panel if it is important to you to be able to drop the .py.

JSWolf
06-25-2008, 07:00 PM
I run Python here and have to add the .py to the command. Other then that, it works fine.

raymino
06-25-2008, 08:42 PM
Thanks to you all for helping me with this. The attached Word file has a screen shot of my commands and the results.

I'm beginning to think that my method for creating mobidedrm.py is faulty. I open the text file in Notepad, I select all and copy. Then I open the Python editor, create new script file, paste, then save to Python25 folder where the drm'd book and the python program files reside.

I think I will try to manually copy the text file with the script, the paste it into the Python editor. Maybe selecting all is bringing over some garbage.

It seems Python is working, and mobidedrm is executing on a limited basis, so I'm thinking that somehow mobidedrm.py is getting screwed up.

Also, do I need to have Mobireader installed?

Thanks,
Ray

JSWolf
06-25-2008, 08:50 PM
Edit the file with Notepad and see if you've anything wrong in there. If so, fix it. Then save it. There is no need to run it from the Python command prompt. Just run it from a command prompt without using any Python command first. Also try it without the quotes. It could be the quotes around the PID that is causing a problem. But dump ALL the quotes to start with.

raymino
06-25-2008, 09:00 PM
Thanks JSWolf,

I do not run the Python command. It's just included in the screenshot in response to pilotbob's question. I don't think mobidedrm even runs fron the Python prompt. "not recognized".

I have looked at mobidedrm.py in both Notepad and Python Editor, and nothing jumps out as being wrong. Of course I know nothing of Python coding.

As for trying it without the quotes, I've done that many many times with the same result. I guess now I'll take a closer look at the downloaded text file and compare it to the mobidedrm.py file.

By the way, should I be using CMD or COMMAND from XP's Run?

Thanks,
Ray

JSWolf
06-25-2008, 09:02 PM
CMD is the Run command to use to bring up the command prompt.

raymino
06-25-2008, 11:38 PM
Thank you to wallcraft, JSWolf, pilotbob and bwaldron,

I was able to find version 3.0 of mobidedrm, but when running it from the command prompt, I still got the same disppointing results.

However when using "run" from within the Python Editor, and filling in the arguments in the second box, I finally got my dedrm'd file.

Conclusion: There's something wrong with my command prompt on my computer.

Anyway, I'm very grateful for all the help I got here.

Ray

JSWolf
06-25-2008, 11:39 PM
At least it now works. Well done!

pilotbob
06-26-2008, 12:21 AM
Conclusion: There's something wrong with my command prompt on my computer.


Did you actually install python? It sounds like the .py extension is not registered with python on your machine. When you browse the folder with the .py files in windows explorer does it list the file as python script or does it just say .py?

BOb

splat
06-26-2008, 05:58 AM
I was able to find version 3.0 of mobidedrm, but when running it from the command prompt, I still got the same disppointing results.

3.0! was this a typo or do I have to go searching for a new version again?

raymino
06-26-2008, 10:48 AM
Hi pilotbob,

Yes, I have python installed. When I browse the folder, the file type for mobidedrm.py is listed as "Python File". It has the same icon as the Python applications, but their type is listed as "Application".

Ray

wallcraft
06-26-2008, 11:06 AM
3.0! was this a typo or do I have to go searching for a new version again? There is a fix to version 0.2 in post #76 of this thread.

TallMomof2
06-26-2008, 11:45 AM
I had to add Python to my Path command in order to run the scripts from the command prompt. When I installed Python it was not automatically added to the the Path command.

SeaWolf
07-07-2008, 01:19 PM
After a bit of fiddling around, I've been trying to get mobidedrm to work. I've taken the .02 script and made the tweaks described in post #76, but when I go to run it I hit a brick wall.
./MobiDeDRM.py:49: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up
crc = (~binascii.crc32(s,-1))&0xFFFFFFFF
MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Traceback (most recent call last):
File "./MobiDeDRM.py", line 178, in ?
file(outfile, 'wb').write(DrmStripper(data_file, pid).getResult())
File "./MobiDeDRM.py", line 146, in __init__
found_key = self.parseDRM(sect[drm_ptr:drm_ptr+drm_size], drm_count, pid)
File "./MobiDeDRM.py", line 103, in parseDRM
pid = pid.ljust(16,'\0')
TypeError: ljust() takes exactly 1 argument (2 given)
I don't know Python at all so I'm hoping someone here with a better idea than me can explain why the seemingly totally broken line 103 works for everyone else, but not for me. From the error it seems like a fundamental, fatal flaw in the code. Yet clearly that can't be the case since it's working for everyone else...

I'm running
Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin

Anyone have any ideas?

IceHand
07-07-2008, 06:58 PM
I think you need to have at least Python version 2.4 to get it running. Try upgrading it.

SeaWolf
07-11-2008, 07:04 AM
I copied the files across to my Leopard machine, which has Python 2.5.1 on it and tried again. No problems at all this time, worked flawlessly.
Thanks for your help.

pdurrant
07-18-2008, 03:50 AM
I copied the files across to my Leopard machine, which has Python 2.5.1 on it and tried again. No problems at all this time, worked flawlessly.


If you're on Mac OS X, you might be interested in an Applescript wrapper I have for the decoder. I think it's OK to attach here, as without the MobiDeDRM.py script it can do nothing.

Once you copy the MobiDeDRM.py script into the package Resources folder, you can drag & drop files and/or folders onto the script and they'll all get decoded, you just need to enter your Mobipocket ID once. (& if you edit the AppleScript to include your code, not even that.)

Paul

Edited script to remove my Mobipocket ID, as that was causing confusion. Previous file had 15 downloads.

Edited script again to add quotes to PID on command line, as PIDs with $ in them cause problems on unix command lines.

Edited script again to add single quotes to PID on command line, as PIDs with $ in them cause problems on unix command lines. Also added in error reporting dialog if the python script returns text with "error" in it. Also added instructions for new fixes for 0.02 script to the readme.

Moved to own thread.

garygibsonsf
07-23-2008, 11:44 AM
PDurrant - sorry if this is a terribly newbie question ... but where would I find a Mobipocket ID, if I had a mobipocket file I wished to run the script on, on my mac?

I should add that when I first click on the script you put up there, it asks me to navigate to a folder with a .prc file in it: I do that, select a file and up pops a window with some letters and numbers I assume are the associated mobipocket id. The mobidedrm v3 doesn't work at all, but the v2 does; however, the resultant file is zero k in size, so something's not quite right (I did rename the file to mobidedrm.py precisely inside the resources folder, yes).

I have MacPython 2.5 on my mac, which is a ppc. I note now I'm having similar problems to Seawolf - I recognised the

'./MobiDeDRM.py:49: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up
crc ='

bit from the error message I keep getting when I run the decoder.

wallcraft
07-23-2008, 12:30 PM
where would I find a Mobipocket ID, if I had a mobipocket file I wished to run the script on, on my mac? The site where you bought the MOBI file will have the PID, typically in your account info. It is typically also displayable on any device running MobiPocket Reader. See Using the Mobipocket Reader at Fictionwise (http://fictionwise.com/help/mobi_help.htm) for example. The PID of each device is different, and any MOBI file can have up to 4 PIDs associated with it.

petermillard
07-23-2008, 05:04 PM
Hi

I'm also (trying) to use PDurrant's Applett/Droplett (for which a big thank you!) and what you say is exactly the problem I'm having:

...however, the resultant file is zero k in size, so something's not quite right ... I recognised the

'./MobiDeDRM.py:49: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up
crc ='

bit from the error message I keep getting when I run the decoder.

I'm on an intel Mac, python 2.5, OSX 10.4.

Any help much appreciated.

Thanks, Peter.

JSWolf
07-23-2008, 05:18 PM
There are multiple versions of MobiDeDRM and you may be using the wrong one for the eBook you are trying to strip the DRM from.

petermillard
07-23-2008, 06:05 PM
Thanks JSW.

I've tried both MobiDeDRM 0.01 and 0.02 scripts, on several eBooks (different sources) and always the same result - an "Unlocked_YourBook.prc" of 0 KB :(

Hey ho; we'll sort it eventually...

Thanks, Pete.

garygibsonsf
07-24-2008, 01:44 AM
Same thing here, I tried them all, except the ereader2html script (I might try it just for the hell of it) and still got the zerok size file. And like Peter, I'd like to say thanks to Pdurrant (I think it was) for coming up with this in the first place. And like Peter, I'm sure we'll sort it out in the end.

edit. Peter - I had a look at the 'script' inside the resources folder inside the decoder Pdurrant put together. I don't understant scripting or python or whatever, but I did notice scrolling down that the numbers and letters that automatically appear in the window when you select a .prc file are set as a kind of 'default', so presumably I have to go to the site where I bought a particular file and find the mobipocket id. Unfortunately, all I've bought so far are multiformat magazines, and I don't appear therefore to have any associated id's listed on the appropriate page.

It may be that Peter or someone else has secure mobi files they can test the program on; or may already have. I could purchase a secure mobi file and run the script on that, but I'd rather wait and hear if anyone's been able to run the script on secure mobi files, as opposed to multiformat ones.

llasram
07-24-2008, 09:47 AM
Hi

I'm also (trying) to use PDurrant's Applett/Droplett (for which a big thank you!) and what you say is exactly the problem I'm having:

I'm on an intel Mac, python 2.5, OSX 10.4.

Any help much appreciated.

Thanks, Peter.

The error that you're posting is reported by Python versions earlier than 2.4, so even if you do have Python version 2.5 installed, something in your system configuration is causing the script to run with an older version.

Pop open a command-line and run:

python --version

If that does report a 2.5.x version, copy the mobidedrm.py script and your mobi file to the same directory and run:

python mobidedrm.py inbook.mobi outbook.mobi PID

(substituting the arguments with the correct file names and PID).

llasram
07-24-2008, 09:49 AM
It may be that Peter or someone else has secure mobi files they can test the program on; or may already have. I could purchase a secure mobi file and run the script on that, but I'd rather wait and hear if anyone's been able to run the script on secure mobi files, as opposed to multiformat ones.

Well, you don't need it for "multiformat" Mobipocket books -- those are unencrypted. As for encrypted "secure" books, I can assure you it works just fine.

petermillard
07-24-2008, 10:16 AM
Quick update; I've had no joy getting the scripts to run under MacOSX, but just for fun I installed activepython on XP running under Parallels on my MacBook, and that works a treat, so success in a slightly convoluted sort of way!

@ garygibson

All the files I've tried are secure mobipocket files - wouldn't be much point otherwise, right? When the script runs, there's a pop-up that lets you enter your PID. You can find your PID either from your device (under the 'advanced' menu on my Cybook) or through Mobipocket Reader if you have the software installed (PC only).

Edit: Just seen the other responses; will give the 'python --version' a try and see what happens, but at least for now I have something that works!

Thanks all!

Pete.

garygibsonsf
07-24-2008, 10:18 AM
I think it might be a problem with my PID after all. I got hold of a drm-ed file, a .prc. I then borrowed a windows laptop (as opposed to my usual ibook) and downloaded and installed mobireader onto it. The book opened on it fine. I clicked on devices, and there was a ten-digit number in the mobireader program that was, or so I got the impression, the PID. I emailed that to my ibook and tried it just now using that command line and with both the .py and the prc file in the same directory; but no luck. Except this time it did tell me I had an invalid PID. So maybe I'm looking in the wrong place for it. Hm.

Edit: I had a look under 'devices' in the mobipocket reader program on a windows xp machine, and there was a ten digit figure listed there (under the details for that pc) that I believe must be the PID, but it didn't work, unfortunately. Back to the drawing board for me.

petermillard
07-24-2008, 04:07 PM
OK, update; I ran the "python --version' thing and it reported python 2.5.2. I copied the script and my book into the same directory, and I get an error message effectively (sorry, can't remember the exact words) saying the mobidedrm.py is not recognised.

So, the identical file works under windows through an emulator/virtual machine, but not under OSX. Weird, but I have something that works so I'm not too fussed.

Thanks for all the help.

Cheers, Peter

llasram
07-24-2008, 05:04 PM
OK, update; I ran the "python --version' thing and it reported python 2.5.2. I copied the script and my book into the same directory, and I get an error message effectively (sorry, can't remember the exact words) saying the mobidedrm.py is not recognised.

Is the script file named 'mobidedrm.py'? If not then substitute the actual name of the script file.

petermillard
07-24-2008, 06:10 PM
Hi

Yes, identical filenames, right down to the capitalisation. I'll have another play tomorrow as it's irritating, but to be honest as I have a solution that works (via windows/activepython) then it's not a priority. Sure, it would've been nice to stay within OSX and have drag & drop conversion with PDurrant's droplet, but what I have works well enough for now, and the command-line thing makes me feel almost nostalgic, lol!

Cheers, Peter.

pdurrant
07-25-2008, 03:50 AM
Hi Everyone,

I thought I'd removed my PID from the AppleScript, but I'd forgotten that it was on two places - once for drag&drop of files, and once for running the script on its own.

I've uploaded a new version of the applescript to my original message, number 103.

To decode DRMed Mobipocket files, you must have one of the PIDs for which the file is encrypted.

All Mobipocket Reader programs have a PID, usually visible in an "About" box, and consisting of ten characters and digits.

When buying a DRMed Mobipocket book, you have to supply the PID of the device on which you're going to read it. You can supply up to four separated PIDs for the same encrypted book.

To use the Python Mobipocket decoder, you need to know once of the PIDs used when the DRMed file was downloaded. The Python script does not break the encryption from a standing start, it just uses the known key to do the decoding.

I'm on Mac OS X 10.5.4 with the XCode 3.0 developer tools installed. I don't recall having to do anything in particular to get python running correctly.

So far I haven't come across a DRMed Mobipocket eBook that my modified MobiDeDRM 0.02 script won't handle. See

http://www.mobileread.com/forums/showpost.php?p=202684&postcount=76

for the modifications I use.

If anyone's had success with the Applescript it would be good to hear from them.

I do have another AppleScript for use with encrypted eReader files, using the eReader2html python script that usually accompanies the MobiDeDRM script. If anyone's interested, I'd be happy to upload that in the appropriate forum (well, without the eReader2html python script, of course.)

Paul

JSWolf
07-25-2008, 09:49 AM
So far I haven't come across a DRMed Mobipocket eBook that my modified MobiDeDRM 0.02 script won't handle. See

http://www.mobileread.com/forums/showpost.php?p=202684&postcount=76

for the modifications I use.
Actually, I've come across a couple of eBooks that your mod caused to actually break the eBooks so that it causes Mobipocket Reader to crash every time you try to view it.

I used MobiDeDRM.py version 0.01 on those eBooks without a hitch.

garygibsonsf
07-25-2008, 10:43 AM
Well, I did try ... I bought a mobiformat encrypted ebook: downloaded it to my girlfriend's laptop (running XP), after registering the PID from a copy of mobipocket reader I downloaded to it; the book opened fine in mobipocket reader on the windows machine; emailed the same file to my ibook; ran pdurrant's script on it (or rather, three versions of it, each one containing a different version of mobidedrm.py); and no luck still.

Then I took jswolf's suggestion; opened terminal; put the prc ebook I bought into the same folders as each of the altered mobipocket unlocker scripts; ran the python script on it as he typed it; except that this time, it said something like 'invalid PID checksum'.

I did, by the way, notice a second file accompanying the purchased ebook, with the same name but the extension '.mbp'. I get the impression, however, this jsut tells the mobipocket software how to display the cover of the book.

Butg no luck yet so far I'm afraid, sigh ...

llasram
07-25-2008, 03:14 PM
Then I took jswolf's suggestion; opened terminal; put the prc ebook I bought into the same folders as each of the altered mobipocket unlocker scripts; ran the python script on it as he typed it; except that this time, it said something like 'invalid PID checksum'.

Does your PID have a '$' (dollar sign character) in it? I assume so, and that means you need to put your PID in "'" (single quotes). So you should be running something like: python mobidedrm.py book-drmed.prc book-clean.mobi 'FAKEPID$42' With the real filenames and PID, but with the single-quotes in-place.

JSWolf
07-25-2008, 05:11 PM
Using Windows command prompt, you don't need any quotes around the PID eevne if the PID has a $ in it.

llasram
07-25-2008, 09:37 PM
Using Windows command prompt, you don't need any quotes around the PID eevne if the PID has a $ in it.

Oh, whoops. Someone else who had been having a similar problem was on OS X, where one would require the quotation marks. My mistake.

-Marshall

nekokami
07-25-2008, 09:58 PM
The fact that some folks are getting it to work on a PC but then it fails on a Mac when the file has been transferred between the two systems makes me suspect that something to do with differences between those two platforms might be involved, e.g. the byte order or line ending characters. But that's just a wild guess.

garygibsonsf
07-26-2008, 01:51 AM
Words cannot express my relief; it finally worked, by the simple act of placing single quotes around the PID in the command line version. Thank you, llasram, for your help in that corner, and thank you, pdurrant, for your offer of help; I tried running your script on my mac and putting single quotes around the PID when the box popped up, but unfortunately that didn't work. But, most importantly ... I got my book, and I can now buy mobi books and be able to read them on my Sony 500, despite owning an ibook.

Ah, the overwhelming sense of relief. I feel like a nice cup of tea and a read.

pdurrant
07-26-2008, 10:09 AM
Many thanks to JSWolf for helping me see what's going wrong with the 0.02 (& my 0.03 patch version) of the MobiDeDRM script.

Since I now have examples of files that work with 1 but not 2 and 2 but not 1, and a little more experience with the Mobipocket file format, I think I've got to the bottom of the problem, and so I now have a new set of patches for the original 0.02 code. Here's the instructions for my new patch, line by line.

Also thanks to others who helped find a problem with the 0.04 patch version. These instructions now convert 0.02 to 0.05.

change line 165:
print "MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser"

to
print "MobiDeDrm v0.05. Copyright (c) 2008 The Dark Reverser"

just so that you don't get confused at the command line.

Add a tab and make changes to line 136:
[tab][tab]extra_data_flags, = struct.unpack('>L', sect[0xF0:0xF4])

to make it
[tab][tab][tab]extra_data_flags, = struct.unpack('>H', sect[0xF2:0xF4])

After line 135:
[tab][tab]records, = struct.unpack('>H', sect[0x8:0x8+2])

add in the following three lines
[tab][tab]mobi_length, = struct.unpack('>L',sect[0x14:0x18])
[tab][tab]extra_data_flags = 0
[tab][tab]if mobi_length >= 0xE4:

(note that tricky comma after the first instance of mobi_length)

And finally, after line 63:
[tab][tab]bitpos, result = 0,0

add in the following two lines:
[tab][tab]if size <= 0:
[tab][tab][tab]return result

These changes should mean that any file that works with either 0.01 or 0.02 will work with 0.05. I'd love to hear about any problems.

Paul

Actually, I've come across a couple of eBooks that your mod caused to actually break the eBooks so that it causes Mobipocket Reader to crash every time you try to view it.

I used MobiDeDRM.py version 0.01 on those eBooks without a hitch.

igorsk
07-26-2008, 10:33 AM
Use [code] tags to keep the tabs.

IceHand
07-26-2008, 11:53 AM
Haven't had any problems with your last patch, pdurrant, but thanks for the new one.

wallcraft
07-26-2008, 12:02 PM
The fact that some folks are getting it to work on a PC but then it fails on a Mac when the file has been transferred between the two systems makes me suspect that something to do with differences between those two platforms might be involved, e.g. the byte order or line ending characters. But that's just a wild guess. I think it is the "$" in the PID that is causing the problem, this does not matter under Windows but requires single quotes (double quotes won't work) on a Mac or under Linux.

pdurrant
07-26-2008, 02:44 PM
I've uploaded a new version of my Applescript that can cope with $ in PIDs, and yes, it does that by enclosing the PID in single quotes.

It's worth a download even if your PIDs don't have $ in them, as it also now reports errors returned from the python script, and the readme has the new fix instructions for the 0.02 version of the MobiDeDRM.py script.

http://www.mobileread.com/forums/showpost.php?p=216881&postcount=103


Paul

I think it is the "$" in the PID that is causing the problem, this does not matter under Windows but requires single quotes (double quotes won't work) on a Mac or under Linux.

JSWolf
07-26-2008, 08:04 PM
pdurrant ... Thanks for fixing things. Glad I could help you debug the problem. I'm hoping this is it and we have one program for now.

FizzyWater
08-10-2008, 02:45 AM
I'm not a python programmer (have some exposure to VBA and VbScript only), so my notes below may be obvious to those of you who are, but for "idiots" like me, who are just trying to make a great tool work even better:

Here's the instructions for my new patch, line by line.

After line 63:

Don't know why they'd be different, but when I displayed this in Pythonwin, this was line 62 for my copy.


After line 135:
Add a tab to line 136:
and change line 165:


The rest of the line numbers matched in my copy...BUT!...only if I worked the corrections from the bottom up. As soon as you follow the first correction's suggestion (to add three rows of code after line 62/63), the line numbers no longer match up.

Just thought I'd share it for the other novices like me, who might have tried this and gave up when it didn't seem to line up.

:thanks:

pdurrant
08-10-2008, 08:01 AM
Thanks for the clarification. I should have mentioned that any line numbers was the line numbers or the original file. Hopefully by quoting each line that I also referenced by number I didn't confuse too many.

Paul


The rest of the line numbers matched in my copy...BUT!...only if I worked the corrections from the bottom up. As soon as you follow the first correction's suggestion (to add three rows of code after line 62/63), the line numbers no longer match up.

Just thought I'd share it for the other novices like me, who might have tried this and gave up when it didn't seem to line up.

:thanks:

pdurrant
08-15-2008, 04:57 AM
I bought the Chambers 10th Edition dictionary. A DRMed Mobipocket book over 40MiB in size.

I'm glad to say that the new version worked perfectly on it, although it did take over 80 minutes running on a 2GHz Dual Core machine.

Paul


Many thanks to JSWolf for helping me see what's going wrong with the 0.02 (& my patch version) of the MobiDeDRM script.

Since I now have examples of files that work with 1 but not 2 and 2 but not 1, and a little more experience with the Mobipocket file format, I think I've got to the bottom of the problem, and so I now have a new set of patches for the original 0.02 code.

IceHand
08-15-2008, 08:04 AM
I bought the Chambers 10th Edition dictionary. A DRMed Mobipocket book over 40MiB in size.

I'm glad to say that the new version worked perfectly on it, although it did take over 80 minutes running on a 2GHz Dual Core machine.
Huh? I bought the Chambers too, but my version is only 24.7 MB in size. And MobiDeDrm worked here too, but took even longer (140 minutes with a 1.4 Ghz Celeron M).

pdurrant
08-15-2008, 08:39 AM
You're right. I was typing from memory and my memory was faulty. The time is about right though.

Paul

Huh? I bought the Chambers too, but my version is only 24.7 MB in size. And MobiDeDrm worked here too, but took even longer (140 minutes with a 1.4 Ghz Celeron M).

bbusybookworm
08-15-2008, 08:44 AM
Huh? I bought the Chambers too, but my version is only 24.7 MB in size. And MobiDeDrm worked here too, but took even longer (140 minutes with a 1.4 Ghz Celeron M).

I Had a similar experience DeDRMing the Chambers. Only in my case i used the version 1 of the script first and it ended up generating a invalid file.

Redoing it with Ver2 did generate a usable file, the only problem is that with the scrip just showing Working... I was unsure whether it was processing until I checked the Task manager and saw Python working away.

Anyone have any general guidelines as to how long it usually takes for scripts like this to run. Is it more dependent on size or on somthing else?

pdurrant
08-15-2008, 01:40 PM
It's size. And how much of that size is text rather than illustrations, as only the text is encoded. Most eBooks are about 1/100th the size of the Chambers dictionary (250KiB rather than 25MiB).

On my system most books decode in under a minute.

Paul


I Had a similar experience DeDRMing the Chambers. Only in my case i used the version 1 of the script first and it ended up generating a invalid file.

Redoing it with Ver2 did generate a usable file, the only problem is that with the scrip just showing Working... I was unsure whether it was processing until I checked the Task manager and saw Python working away.

Anyone have any general guidelines as to how long it usually takes for scripts like this to run. Is it more dependent on size or on somthing else?

bbusybookworm
09-27-2008, 07:35 PM
Edit - Found My Mistake

As a complete novice, I was taking the [Tab][Tab] in reference to the line above it as opposed to the whole script.

D'oh!

Still It does show that even silly things can trow you off.

D:\MobiDeDRM>mobiddrm04.py Aroundtheworldin80days.prc Aroundtheworldin80days-1.p
rc 5UMRXH2$UK
File "D:\MobiDeDRM\mobiddrm04.py", line 63
if size <= 0:
^
IndentationError: unexpected indent

D:\MobiDeDRM>pause
Press any key to continue . . .

JSWolf
09-27-2008, 07:44 PM
Python is a bit sticky with indents (I think). So if that is the case, that could be your problem.

If I can find the diff program and remember how to use it, I might be able to put up a diff file. I'll have to have a go and see what I can do.

bbusybookworm
09-27-2008, 07:51 PM
Python is a bit sticky with indents (I think). So if that is the case, that could be your problem.

If I can find the diff program and remember how to use it, I might be able to put up a diff file. I'll have to have a go and see what I can do.

Thanks

As I said, I ended up finding the mistake, it was as you would say PBCK, Problem between Chair and Keyboard, i.e. User Error.:o

JSWolf
09-27-2008, 07:57 PM
Thanks

As I said, I ended up finding the mistake, it was as you would say PBCK, Problem between Chair and Keyboard, i.e. User Error.:o
Then no need for a diff for the two versions. Well done sorting it out. I've not had a problem with 0.04 at all since I've been using it.

robcohen
10-22-2008, 08:59 AM
I have three files that cannot be processed by mobidedrm01/02/03/or 04. Return either
Error: invalid encryption type: 0
or
Error: invalid file format

Is it possible that something has changed and the scripts no longer work. Have been over the changes for 04 several times and can't find where I've made a mistake. Perhaps a .diff would indeed be simpler so at least the source is not a variable in solving these issues?

Thanks,
Rob

pdurrant
10-22-2008, 10:30 AM
Encryption type 0 is unencrypted. Are you sure these are DRMed files?

Paul

I have three files that cannot be processed by mobidedrm01/02/03/or 04. Return either
Error: invalid encryption type: 0
or
Error: invalid file format

Is it possible that something has changed and the scripts no longer work. Have been over the changes for 04 several times and can't find where I've made a mistake. Perhaps a .diff would indeed be simpler so at least the source is not a variable in solving these issues?

Thanks,
Rob

JSWolf
10-22-2008, 11:25 AM
Or could this be one of those PRC that need a UN/PW in Mobipocket Reader and then sent to another device?

robcohen
10-23-2008, 07:31 AM
Encryption type 0 is unencrypted. Are you sure these are DRMed files?

Paul

Yes, they're definitely encrypted.

I found the problem after re-creating MobiDeDRM 0.04 from a fresh copy of 0.02 -- and using the patch instructions from the bottom up.

Apparently there was a difference between the version of MobiDeDRM04.py that worked and the one that failed -- caused by me. Comparison of the two files shows an extra couple of blank lines after line 64.

It probably wouldn't be difficult to port diff from *nix over to Windows. I'm surprised this hasn't been done by someone. Not that it would be trivial for me necessarily, but sort of recall some info about diff from an intro programming class decades ago :=)

Anyway, as expected, the problem was mine. Happy camper, now!

rob

DMcCunney
10-23-2008, 11:52 AM
It probably wouldn't be difficult to port diff from *nix over to Windows. I'm surprised this hasn't been done by someone. Not that it would be trivial for me necessarily, but sort of recall some info about diff from an intro programming class decades ago :=)
I gather you haven't looked. Among others:

http://www.thefreecountry.com/programming/filecomparison.shtml

http://gnuwin32.sourceforge.net/packages/diffutils.htm

http://www.componentsoftware.com/Products/CSDiff/

http://winmerge.org/

http://www.prestosoft.com/edp_examdiff.asp

http://kdiff3.sourceforge.net/

Command line versions are available as part of Cygwin (http://www.cygwin.com) and MinGW (http://www.mingw.org).
______
Dennis

pilotbob
10-23-2008, 12:48 PM
It probably wouldn't be difficult to port diff from *nix over to Windows. I'm surprised this hasn't been done by someone. Not that it would be trivial for me necessarily, but sort of recall some info about diff from an intro programming class decades ago :=)

What are you porting? mobidedrm already work on Linux/Windows/Mac.

BOB

robcohen
10-24-2008, 01:47 AM
I gather you haven't looked. Among others:
...
Dennis

Hey Dennis,
Thanks for the pointers. I must have written the complaint about "no diff" just after I found there was no native DOS diff command (in Vista). Tried the COMP command and it did not actually report the differences, just "files are different sizes". It was a bit annoying to have to go look for a third party version of something that should just be there. I was spoiled by working on Unix many years ago :-)

I eventually found and installed a trial of DiffDoc which accomplished the immediate task. Your list of sites for tools gives me way more places to look than downloads.com or simtel.net. Much appreciated.

Rob

robcohen
10-24-2008, 01:51 AM
What are you porting? mobidedrm already work on Linux/Windows/Mac.

BOB

Hi Bob,
I was looking for a tool that did the diff function to produce a delta and show me the difference between the two hand-patched versions of mobidedrm04.py that I had produced. The person who produced the modifications simply supplied the lines to change and the expected location of the line preceding the change. I found that I had added one or two cr/lf pairs after one of the changes, causing the resulting code to be wacko.

Thanks,
Rob

DMcCunney
10-24-2008, 11:08 AM
Hey Dennis,
Thanks for the pointers. I must have written the complaint about "no diff" just after I found there was no native DOS diff command (in Vista). Tried the COMP command and it did not actually report the differences, just "files are different sizes". It was a bit annoying to have to go look for a third party version of something that should just be there. I was spoiled by working on Unix many years ago :-)
<shrug>

I'm a *nix admin, among other things, and had a *nix box at home before I had an MS-DOS PC. I've been keeping my eye out for things that add capabilities I'm used to from Unix to Windows for some time. The links a posted are just a surface scratch, biased toward free/open source.

The topic surfaced elsewhere recently: I'm on the mailing list for NaNoWriMo (an organized effort to write a novel in a month), and various folks involved in it were looking for things like revision control systems they could incorporate in their writing workflow.

I eventually found and installed a trial of DiffDoc which accomplished the immediate task. Your list of sites for tools gives me way more places to look than downloads.com or simtel.net. Much appreciated.
Simtel is hit-and-miss, and doesn't seem to be terribly well maintained. A lot of stuff listed proves not to be available. Downloads.com is fine if you know what you're looking for, but less fine if you don't. For *nix like tools, the first place I look is sourceforge.net, the biggest open source repository in existence.

If you want as full an emulation of Unix under Windows as possible, install Cygwin. Cygwin is an attempt by Cygnus Development (now part of Red Hat) to port the Gnu toolchain from *nix to Win32. Rather than rewrite every utility to use Win32 system calls, the Cygnus developers wrote a POSIX compatibility layer encapsulated as a DLL that includes the most common *nix system calls. Code built under Cygwin links against the DLL, sees the *nix calls it expects, and a lot of Unix code builds "out of the box" under Cygwin. Cygwin includes the Gnu compiler suite, plus all of the standard untilites you would expect like ls, cp, mv and ln, plus the vi editor and bash shell. It's a little quirky to use, because it uses *nix conventions, like / as a PATH separator and - as the option delimiter, so you can't jsut mix and match *nix and Windows commands, but it works very well.

Free, and open source, from http://www.cygwin.com.
______
Dennis

igorsk
10-24-2008, 07:34 PM
Something like this should work out of box, though it's not very pretty:
fc /N mobidedrm04.py mobidedrm04_1.py
See fc/? for more options.

pthwaite
10-25-2008, 04:36 PM
Well I've just successfully, after a lot of reading and running Pdurrant's little script, done my first de drm :thumbsup:

Like most of you, I don't mind paying for books, but I feel it is up to me what I do after I've got them, ie swap, share. or throw out etc. DRM stifles the spread of literature

JSWolf
10-25-2008, 08:45 PM
It probably wouldn't be difficult to port diff from *nix over to Windows. I'm surprised this hasn't been done by someone. Not that it would be trivial for me necessarily, but sort of recall some info about diff from an intro programming class decades ago :=)
I use WindowsXP Pro and I have a program called ExamDiff. There is a pro version you can purchase, but I find the non-pro version just fine for my needs.

http://www.prestosoft.com/edp_examdiff.asp

adinb
11-14-2008, 02:48 AM
Hmm, looks like I've run across a fictionwise mobipocket book that doesn't successfully decrypt (though the script runs/works fine).

I've successfully utilized mobidedrm many times -- and reran the scripts against old books just to make sure I hadn't dorked something up. I also brought out fresh versions of the scripts just to make absolutely sure.

Inspecting the file with a hex editor, everything looks good until a bit after the <head> element, with parts of text that are fine and parts that are garbled. Looks like either something odd with the copy I bought from fictionwise, or there's a weird variant that the script isn't picking up.

Since I'm on OSX, I'm sorta hosed for reading my book -- anyone out there interested in taking a gander at before/after versions of the book? This might be something that a certain someone might want to take a look at for additions to the script. :chinscratch:

JSWolf
11-14-2008, 03:52 AM
If you only have MobiDeDRM.py version 0.01 or 0.02 then yes, that sort of thing can happen where it appears to run with no error, but the resulting eBook is hosed. Only 0.04 has so far not had any errors that I know of.

So if you have 0.01, you also need 0.02 and if you have 0.02, you want to find the thread here with the patches to apply to convert 0.02 into 0.04.

adinb
11-14-2008, 06:18 AM
nope, I'm ran it against V4 (old books and new) *as well as* virgin V1 & V2 scripts with no dice.

From what I got partially running in crossover (my parallels machine is at home), the file appears to be valid encrypted mobipocket (though I'm not 100% sure since running inside a crossover bottle is a finicky affair).

So, it looks to be a mobipocket variant that's potentially not being handled by the script. Hmmm.

pdurrant
11-14-2008, 11:47 AM
Having looked at this, it seems that there is no problem with the decoded ebook, but just a bug in the Stanza desktop reader.

nope, I'm ran it against V4 (old books and new) *as well as* virgin V1 & V2 scripts with no dice.

From what I got partially running in crossover (my parallels machine is at home), the file appears to be valid encrypted mobipocket (though I'm not 100% sure since running inside a crossover bottle is a finicky affair).

So, it looks to be a mobipocket variant that's potentially not being handled by the script. Hmmm.

JSWolf
11-14-2008, 02:16 PM
That would have solved all the problems had we known that Stanza buggered it up. In order to verify that a Mobipocket eBook works properly is to view it using official software such as Mobipocket Desktop.

pilotbob
11-14-2008, 02:21 PM
In order to verify that a Mobipocket eBook works properly is to view it using official software such as Mobipocket Desktop.

Which doesn't run on a Mac.

BOb

adinb
11-14-2008, 06:18 PM
That would have solved all the problems had we known that Stanza buggered it up. In order to verify that a Mobipocket eBook works properly is to view it using official software such as Mobipocket Desktop.

Which I would have attempted to do if I were at home with parallels installed. As it is, I'm on the road on a family emergency and the best I could try was crossover pro, which works with mobipocket *except* for the actual display panes.

If mobipocket reader worked on OS X (::hint:: ::hint::!), I wouldn't have a need to use the scripts in the first place.

As it is, I tried to confirm the format by comparing different .prc mobipocket books in a hex editor (something that most users wouldn't do). I was thrown off by several books having a fairly simple ascii/unicode html layout...and this book *not* following a similar layout.

Many thanks to @pdurrant for his assistance last night in helping check the validity of the output file.

It looks like mobitohtml is stable/robust enough to use as a validity checker in situations where the official mobipocket reader is unavailable. (which is my lesson learned out of this). The only downside to using mobitohtml (IMHO) is that you lose a lot of the metadata tags.

The bug has been emailed to the stanza team (though I haven't received ack from them yet), so hopefully this particular issue will be resolved.

@JSWolf -- OT, and maybe a followup should be a thread link, but what tool would you use on OSX to verify mobipocket validity when the official reader isn't available?

wallcraft
11-14-2008, 08:30 PM
what tool would you use on OSX to verify mobipocket validity when the official reader isn't available? You might try FBReader, but it does not read MOBI files with high compression. The other option is to use Calibre and convert the MOBI to ePub. The ePub is then readable by Stanza, FBReader, Calibre, and Adobe Digital Editions.

pilotbob
11-14-2008, 08:44 PM
You might try FBReader, but it does not read MOBI files with high compression. The other option is to use Calibre and convert the MOBI to ePub. The ePub is then readable by Stanza, FBReader, Calibre, and Adobe Digital Editions.

Actually, I think the newest version of calibre will display a mobi file in its new webkit based viewer.

BOb

JSWolf
11-15-2008, 06:58 AM
@JSWolf -- OT, and maybe a followup should be a thread link, but what tool would you use on OSX to verify mobipocket validity when the official reader isn't available?

One thing you could do is to install Calibre and use mobi2oeb and see if the resulting HTML is good. If it is, then you'll know the file is good.

My guess is that you may have been comparing standard compress Mobi to a huffdic compressed Mobi and that would be why things looked different enough to suspect the eBook was corrupted. Could be that Stanza does not handle the higher compression.

IceHand
11-15-2008, 07:04 AM
It looks like mobitohtml is stable/robust enough to use as a validity checker in situations where the official mobipocket reader is unavailable. (which is my lesson learned out of this). The only downside to using mobitohtml (IMHO) is that you lose a lot of the metadata tags.Calibre's mobi2oeb is a better choice—you don't lose the meta tags and it works with huffdic compression too.

Btw, I have Mobipocket Reader running on Linux with Wine. You could try if it works for you with the latest version of Wine for Mac OSX. (http://wiki.winehq.org/MacOSX/Installing)

AZed
11-15-2008, 02:17 PM
Calibre's mobi2oeb is a better choice—you don't lose the meta tags and it works with huffdic compression too.
Just to toot my own horn a bit, I'd point out the EBook::Tools unpacker keeps even more metadata than mobi2oeb, and as of v0.3.0 (just uploaded to CPAN, not yet indexed), supports HUFF/CDIC as well.

orwell2k
11-18-2008, 07:52 AM
I've uploaded a new version of my Applescript that can cope with $ in PIDs, and yes, it does that by enclosing the PID in single quotes.

It's worth a download even if your PIDs don't have $ in them, as it also now reports errors returned from the python script, and the readme has the new fix instructions for the 0.02 version of the MobiDeDRM.py script.

http://www.mobileread.com/forums/showpost.php?p=216881&postcount=103


Paul

You could also use the original script and place a backslash before the $ symbol - this is the standard Unix (Mac, Linux, etc.) way of cancelling the special meaning of the character immediately following the backslash.

So, entering the PID as 12345\$67 (or whatever) with the normal script will interpret that PID string as the intended 12345$67

JSWolf
11-18-2008, 08:38 AM
Just to toot my own horn a bit, I'd point out the EBook::Tools unpacker keeps even more metadata than mobi2oeb, and as of v0.3.0 (just uploaded to CPAN, not yet indexed), supports HUFF/CDIC as well.
Do you have a direct link please?

taltman711
11-18-2008, 09:00 AM
Do you have a direct link please?

Ebook Tools 3.0 (http://search.cpan.org/~azed/EBook-Tools-0.3.0/)

Tim

AZed
11-18-2008, 10:07 AM
Ebook Tools 3.0 (http://search.cpan.org/~azed/EBook-Tools-0.3.0/)

Tim

Technically, http://search.cpan.org/dist/EBook-Tools/ is a better link since it will always point to the most recent version, but yes, thank you, that works too.

Update: and that link is going to be important, because I just spotted a major problem in 0.3.0 -- the MSReader.pm file didn't get uploaded, so the convertlit support is missing. Fixed in 0.3.1.

Also, the main thread on MobileRead where I post updates is here:

http://www.mobileread.com/forums/showthread.php?t=31142

thanhtrang
11-18-2008, 11:44 PM
How about mobipocket files with content encrypted, do we have a solution ?

pilotbob
11-19-2008, 12:06 AM
How about mobipocket files with content encrypted, do we have a solution ?

A solution to what? removing the DRM? If so, did you read this thread?

BOb

AZed
11-19-2008, 02:05 AM
How about mobipocket files with content encrypted, do we have a solution ?
If you mean one-command unpacking of DRM-protected files, no nothing supports that yet (though it would be fairly trivial to write a plugin for EBook::Tools that would do it, I wouldn't be able to distribute it).

On the other hand, it's not really that much more work to downconvert and then unpack the downconverted file. If you stick a copy of MobiDeDrm into the EBook::Tools configuration directory and then add your PIDs to the configuration file, it'll even just work via "ebook downconvert" followed by "ebook unpack".

thanhtrang
11-19-2008, 02:38 AM
A solution to what? removing the DRM? If so, did you read this thread?

BOb

Yes, i had already read this thread.

I know the solution to remove DRM in PID encrypted mobipocket files (in case we know PID). But, i do not know how to deal with content encrypted files which are only read in MobiReader or devices support prc officially. When i open them in calibre and convert them, a message " It is DRMed book. You must first remove the DRM..."displayed. I guess content encrypted method using a default PID that mobireader knows and it can open, but we really do not know "default" PID.

Do i make it clear ?

wallcraft
11-19-2008, 03:11 AM
But, i do not know how to deal with content encrypted files From Security/Encryption Options (http://www.mobipocket.com/dev/article.asp?BaseFolder=creatorpublisher&File=security.htm): * No encryption: the content of your ebook is not encrypted. It can be opened in the Mobipocket Reader by any user.
* Content Encryption: the content of your ebook is encrypted. This means that the source content does not appear as clear text and cannot be displayed or copied by a third-party software. It can however be opened in the Mobipocket Reader by any user.
* Content Encryption with password: the content is both encrypted and password-protected. Specify a password in the input field. The user will be requested to enter this password in order to open the ebook in the Mobipocket Reader.
* Content Encryption with DRM (Digital Rights Management): the content is encrypted for digital rights management. Such an eBook has to be retargeted with PIDs in order to be legible in the Mobipocket Reader. I have never seen a "Content Encryption" MOBI so far as I know. I have not come across it on the MobiPocket Forums either, but Encryption strength in Mobipocket Creator 4.2 (http://www.mobipocket.com/forum/viewtopic.php?t=9096) says: Whether you choose the password or DRM encryption, both methods use the same algorithms but with subtle changes. However, mobidedrm currently only handles the DRM level of encryption.

thanhtrang
11-19-2008, 04:02 AM
Content Encryption: the content of your ebook is encrypted. This means that the source content does not appear as clear text and cannot be displayed or copied by a third-party software. It can however be opened in the Mobipocket Reader by any user


Exactly what i want to say.

I have never seen a "Content Encryption" MOBI so far as I know

I upload a "content encrypted" file. Do not care about languages, it is written in Vietnamese.

To know what kind of content encryption in a prc file, please open it in Mobireader, select propertise and summary tab, then find encryption label. You will see Content Encrypted (if Content Encryption with DRM it will be PID Encrypted).

I see a lot of content encrypted files which are only opened in Mobireader, and i am so surpprise that you never see it.

Thus, the question: "how to open these content encrypted files in another third-party software". In my case, i need to open them in calibre to convert them into lrf and put them in my Sony Readẻ

igorsk
11-19-2008, 06:04 AM
To decrypt such files, do the following changes in mobidedrm.py:


-temp_key = PC1(keyvec1, pid, False)
+temp_key = keyvec1
-if verification == ver and cksum == temp_key_sum and (flags & 0x1F) == 1:
+if verification == ver and cksum == temp_key_sum:

It can probably be made nicer but I guess you could keep two copies of the script.

thanhtrang
11-19-2008, 12:20 PM
To decrypt such files, do the following changes in mobidedrm.py:


-temp_key = PC1(keyvec1, pid, False)
+temp_key = keyvec1
-if verification == ver and cksum == temp_key_sum and (flags & 0x1F) == 1:
+if verification == ver and cksum == temp_key_sum:

It can probably be made nicer but I guess you could keep two copies of the script.

thank you! it seem work well.

AZed
11-19-2008, 01:07 PM
I see a lot of content encrypted files which are only opened in Mobireader, and i am so surpprise that you never see it.
Could you point me to a source of these, please? I'd be interested in looking at the structure.

thanhtrang
11-19-2008, 01:24 PM
Could you point me to a source of these, please? I'd be interested in looking at the structure.

in my previous post, i attached a content encrypted file.

Thank igorsk again for his new codes. I modified mobidedrm.py and it works well.

DixieGal
11-28-2008, 03:47 PM
FRAK!

How in bloody H3LL do I do this?

A couple of you have tried to teach me basics, but it just won't click in my stupid brain!!!!

I have python, mobidedrm, and someone who is trying to help sent me a secure book and a PID to practice with.


1. I put the book file into the folder with mobidedrm.
2. I open the python command prompt from the "start" menu at bottom of screen.
3. I type: mobidedrm.py booktitle.prc clearbooktitle.prc PID and "enter"
4. Invalid syntax.

ARRRRRGH!!! Please please help!!

pilotbob
11-28-2008, 04:20 PM
ARRRRRGH!!! Please please help!!

Follow the kindle visual guide on how to run kindlepid but just mentally replace kindlepid with mobidedrm and use the correct parameters too.

BOb

daesdaemar
11-28-2008, 06:15 PM
FRAK!

How in bloody H3LL do I do this?

A couple of you have tried to teach me basics, but it just won't click in my stupid brain!!!!

I have python, mobidedrm, and someone who is trying to help sent me a secure book and a PID to practice with.


1. I put the book file into the folder with mobidedrm.
2. I open the python command prompt from the "start" menu at bottom of screen.
3. I type: mobidedrm.py booktitle.prc clearbooktitle.prc PID and "enter"
4. Invalid syntax.

ARRRRRGH!!! Please please help!!

1) Make sure the book file is in the PythonXX\tools\scripts folder (where XX is the python version.

2) Open a command prompt DOS window (CMD) and cd\ to the folder in step number 1.

3) Same as your number 3.

Works for me.

DixieGal
11-28-2008, 08:47 PM
Oh so near and still so far!

I get up to ... 2008 The Dark Reverser...

And then INVALID PID CHECKSUM

What next?

wallcraft
11-28-2008, 09:35 PM
Try putting the filenames in quotes.

pilotbob
11-29-2008, 12:12 AM
Try putting the filenames in quotes.

Or use a valid PID. It must be the PID that the book was encrypted with.

BOb

DixieGal
11-29-2008, 02:22 PM
It's A Miracle!

Taking out the quotation marks and putting a > just before the PID did the trick. Now, how on earth do I turn it into a txt file so that I can get it onto my reader? Let's save that for another day.

Thank you to everyone who taught me to do this, both online and by private instruction, but especially to JSWolf in particular! He grabbed me by the email and spent days and days trying to kick the knowledge into my head. I never would have been able to do it alone.... heck, I never would have known where to begin without all of you!

:thanks:

bbusybookworm
11-29-2008, 03:47 PM
It's A Miracle!

Taking out the quotation marks and putting a > just before the PID did the trick. Now, how on earth do I turn it into a txt file so that I can get it onto my reader? Let's save that for another day.



Well, if you are able to convert HTML files for your reader, the the Mobi2HTML (MobiHuff for file with Huff Compression) script is very handy, and easier to use then the DeDRM script.

the syntex is

mobi2html.exe InFilename.prc OutFoldername

or

MobiHuff.py InFilename.prc Outfilename.html

DixieGal
11-29-2008, 04:07 PM
Really? I think I can do that, maybe. I finished reading Color of Magic just in the past hour or so, useing Mobipocket reader here on the PC. Now, seeing as it is 2:00 and between working on learning how to do the decoder and then reading the book, the morning is gone.

I NEED A SHOWER :o

After that, well, I'm going to try your suggestion while I'm still basking in the flow of success. I'll let you know how it turns out.

JSWolf
11-29-2008, 05:17 PM
No.. don't use mobihuff.py

Use mobi2oeb which is part of Calibre. It works a lot better.

DixieGal
11-30-2008, 10:14 AM
Success! The practice book is now on my device in nice clean large font. I can't thank you all enough, but JSWolf has been especially patient and kind. Now I'm going to buy The Light Fantastic, convert it, and get started reading the next book in the series.

In case this may be of help to anyone who wants to try it also, this works very well as a way to get a secure mobi book onto an EBW-1150.


BEFORE YOU BEGIN:

A. Download mobidedrm and Calibre from MobileRead

B. Download Python 2.6

C. In Python folder, place a copy of the secure book in Scripts folder.


STEP 1: Remove the protection

Go to the Start button at the bottom of the screen, click Programs, Accessories, Command Prompt.

Type cd\python26\tools\scripts and enter

Then type exactly what is after the ... Scripts>

C:\Python26\Tools\Scripts>mobidedrm.py exactbooktitle.prc clearbooktitle.prc <PID

Hopefully, you will see this:

MobiDeDrm v0.04. Copyright (c) 2008 The Dark Reverser
Decrypting. Please wait... done


STEP 2: Convert PRC to HTML

Put a copy of the new book in the Calibre folder

At the command prompt, type cd\program files and enter

Type everything after the first >

C:\Program Files>calibre mobi2oeb clearbooktitle.prc clear2booktitle.oeb

(This book magically appears in c:documents&setting\owner as an html)


STEP 3: Finish

Open html, save as txt, then convert via EBW Librarian.
For large fonts, choose "advanced" and get the little drop-down portion when you "create book"

DixieGal
11-30-2008, 11:04 AM
CRAP!!

I can't make mobidedrm happen again. My own PID has the $, so I've tried it with the slash, and tried it by not using the $, and nothing happens.

ARRRGH! I just want to read a book, not become a pirate!!!!

JSWolf
11-30-2008, 11:23 AM
CRAP!!

I can't make mobidedrm happen again. My own PID has the $, so I've tried it with the slash, and tried it by not using the $, and nothing happens.

ARRRGH! I just want to read a book, not become a pirate!!!!
Create a directory called mp on your C drive.
Copy mobidedrm.py and the eBook you want to decode into c:\mp
open a command prompt by going to start then run then type cmd
once the command prompt is open, type cd \mp
then type ...
mobidedrm.py nameofebook.prc newnameofebook.prc PID


So for the book I think you are doing it could be something like...
mobidedrm.py LightFantastic9780061367588.prc TheLightFantastic.prc XJ6M28H$B2
The only difference would be your PID instead of mine.

Then in c:\mp you will have a DRM free copy of the book. The next thing to type is...
mobi2oeb TheLightFantastic.prc

After that is done, you can use eBook Publisher to open the opf file.

DixieGal
12-01-2008, 01:09 PM
I gave up. This was too much confusion just to try to read. Went to buy a Sony, came home with a new laptop. Downloaded Mobipocket Reader, happily enjoying reading the 24 font book.

It's all because of my eyes. I can't see to read anymore, except for very large fonts. Bad news at the eye doc this morning: The "good" eye (the one that has been stable almost a whole year now) is beginning to hemorrhage. AGAIN. Insurance wouldn't cover it as emergency surgery, so they will do another laser procedure on the retina this coming Wed afternoon, then they will put a shot into the eye to sort of starve off the bleeding arteries.

Thanks again to all of you for helping!

JSWolf
12-01-2008, 06:43 PM
I gave up. This was too much confusion just to try to read. Went to buy a Sony, came home with a new laptop. Downloaded Mobipocket Reader, happily enjoying reading the 24 font book.
I'm glad you've found a solution that works for you. I am sorry your eyes make it not so easy to your your reader. But at least you can still read using your new laptop. I find on most laptops these days, the screen will be good enough to stare at to read a book. That is because you can move have the laptop at a hight and the screen at an angle that works for you. When I really got into eBooks, I first used my computer and also then sometimes used the laptop. It's an older laptop so the reading experience will be better on your new one.

If you do need any help that I might be able to provide, please feel free to let me know.

julia
12-02-2008, 03:27 PM
i gave up as well.
have tried all the directions given on the forum.
it isn't working on my mac.
getting frustrated. and i just want to read the books on any device.

and i have looked up the visual guide as well.
i'm a reader not a programmingspecialist...

JSWolf
12-02-2008, 04:39 PM
i gave up as well.
have tried all the directions given on the forum.
it isn't working on my mac.
getting frustrated. and i just want to read the books on any device.

and i have looked up the visual guide as well.
i'm a reader not a programming specialist...
Do you have Windows?

julia
12-02-2008, 06:19 PM
Do you have Windows?

i can borrow one.

JSWolf
12-02-2008, 07:24 PM
i can borrow one.
From what I am gathering, it seems it may be easier to run mobidedrm.py under windows with Python 2.5 or 2.6 install from http://www.python.org.

pilotbob
12-02-2008, 11:21 PM
i gave up as well.
have tried all the directions given on the forum.
it isn't working on my mac.
getting frustrated. and i just want to read the books on any device.

If you can be a bit more specific about what you did and what problems you are having I'll try to help.

BOb

jlbfoot
12-03-2008, 02:35 AM
Another newb here.....I've been trying all day and still stumped. I have installed Python latest version, found mobidedrm and updated it to v04 in notepad, resaved as .py file. I put the drm'd ebook in the scripts folder along with the mobidedrm04 script, cd in dos to the scripts folder. I followed the old/new/pid to a tee. I actually downloaded mobireader and redownloaded the book to be sure my pid was correct. When i finally get to the point to hit enter, I get "removes protection from...and usage..." and then I am retured to the prompt. It appears the script is not working on the decoding...well, not appears...it's not! I am about to get my new 505 and I want to get this worked out. I've read the two longest threads twice....help! and thanks!

JSWolf
12-03-2008, 06:22 AM
Another newb here.....I've been trying all day and still stumped. I have installed Python latest version, found mobidedrm and updated it to v04 in notepad, resaved as .py file. I put the drm'd ebook in the scripts folder along with the mobidedrm04 script, cd in dos to the scripts folder. I followed the old/new/pid to a tee. I actually downloaded mobireader and redownloaded the book to be sure my pid was correct. When i finally get to the point to hit enter, I get "removes protection from...and usage..." and then I am returned to the prompt. It appears the script is not working on the decoding...well, not appears...it's not! I am about to get my new 505 and I want to get this worked out. I've read the two longest threads twice....help! and thanks!

There is no need for the use of any scripts directory. That's just silly. That makes it harder then it needs to be. All I have done is create a directory called MP off of the root of my C drive. I have mobidedrm.py in there and I download my Mobipocket eBooks to that directory. So when the command prompt is run, all you have to type is cd \mp and you'll end up in the proper directory. Then you can type the command and away you go.

mobidedrm.py LightFantastic9780061367588.prc "The Light Fantastic.prc" XJ6M28H$B2

Then from there you can move the the two copies of the eBook to where you want.

This is assuming you have Windows and Python 2.5 or 2.6 from http://www.python.org and not that silly Active Python.

orwell2k
12-03-2008, 09:49 AM
i gave up as well.
have tried all the directions given on the forum.
it isn't working on my mac.
getting frustrated. and i just want to read the books on any device.

and i have looked up the visual guide as well.
i'm a reader not a programmingspecialist...

I haven't been following this thread closely, but I think these scripts should be easy to execute on the Mac, especially if you have Tiger or Leopard that come with Python included in the install. I have noticed that the example command lines in the later part of this thread do seem to be missing one thing - the word python at the beginning.

So keeping things simple: make a working directory wherever you like (off your home directory, on the desktop, whatever) and dump the python scripts and the Mobi books you wish to convert in there (if everything is in one place you will avoid any path errors, etc.).

Open a Terminal and go the the working directory you have created (e.g. if you make a directory called "ebook" on your desktop then):

cd ~/Desktop/ebook

Then type:

python mobidedrm.py infile.prc outfile.prc ABC123DE56

where:
infile.prc = source book (whatever name it has)
outfile.prc = destination book (whatever name you wish)
ABC123DE56 = device PID

If your PID happens to have a "$" symbol, then you need to type:

python mobidedrm.py infile.prc outfile.prc ABC123D\$56

Here the "\" is very important, because it prevents the "$" from being interpreted in its UNIX context, and rather just as a character - therefore the python script will take it in as part of the PID field. If you prefer you can also surround the PID in 'single' or "double" quotes without the "\" included:

python mobidedrm.py infile.prc outfile.prc 'ABC123D$56'

python mobidedrm.py infile.prc outfile.prc "ABC123D$56"

One of these should work. If you just want to make sure the script actually executes, try:

python mobidedrm.py

and you should receive this back:
MobiDeDrm v0.04. Copyright (c) 2008 The Dark Reverser
Removes protection from Mobipocket books
Usage:
mobidedrm infile.mobi outfile.mobi PID

- I'm guessing you are not typing the "python" at the start of the command line?

- Or perhaps your python script has not been updated to 0.04, in accordance with the instructions on this site?

- Or, unlikely, but python may not be installed on your Mac, although I think it's automatic unless you have a really old version or somehow it was intentionally not installed?

Basically, these scripts work on a Mac. Sometimes, for some reason, a book will not work with the latest script, but then using the older version (0.01 or 0.02) will do the trick.

On Windo$e, I'm guessing you won't need the "python" at the beginning, but I'm not sure about that. Try either of these:

mobidedrm infile.prc outfile.prc ABC123DE56

mobidedrm infile.prc outfile.prc "ABC123D$56" (use "quotes" around PID if it has $ in it)

Hope this helps!

jlbfoot
12-03-2008, 10:12 AM
This is assuming you have Windows and Python 2.5 or 2.6 from http://www.python.org and not that silly Active Python.

Bingo! I was using that "silly Active Python". I was suspicious that the python program was at fault, but I didn't know there were other versions until you pointed it out. A big THANKS!

The filing system you suggested works well and is simple. Thanks for that too!

Regards,

Joe Barefoot :thanks:

julia
12-03-2008, 02:43 PM
thank you orwell2k for your instructions!
it works. and since most of the books that i buy are nearly all drm-ed ones i'm pleased to get it working on my mac now. now i can apply it to all my drm-ed books that i bought from paperback digital as well. they closed and i changed devicec and wasn't able to read most of them anymore. so lots of thanks. used calibre to make it into a sony-format and really is without drm now.

petermillard
12-05-2008, 02:51 AM
If you're on a Mac then the easiest way to run the script is to use PDurrant's Applescript - link at post #103 of this very thread! Drag & drop simplicity, for which many thanks again...

Cheers, Pete.

Jaapjan
12-05-2008, 03:42 AM
Perhaps the book title has spaces in it which you haven't wrapped in quotes?

JSWolf
12-07-2008, 10:14 AM
For those who want to backup their Mobipocket eBooks, I suggest that once you've removed the DRM, also convert to HTML using mobi2oeb and back up both the DRM free Mobipocket eBook and the converted eBook. That way you'll always have a format you can convert to what you need.

tlrowley
12-07-2008, 11:44 AM
If you're on a Mac then the easiest way to run the script is to use PDurrant's Applescript - link at post #103 of this very thread! Drag & drop simplicity, for which many thanks again...

Cheers, Pete.

+1000 - Thanks, PDurrant!!

IDtheTarget
12-08-2008, 12:19 PM
Hi!

I would like to be able to read my purchased eReader books using the iPhone Bookshelf application, so that I have only one reader instead of two.

I've tried the following:

python mobidedrm_eReader2html.py MoonCalled-DRM.pdb . MoonCalled.pdb <credit card number masked>

I've tried with the full credit card number, as well as the last eight digits. I've verified on the eReader site that it's the credit card I used to purchase, and the one they have listed to unlock the book. I've also tried a FictionWise book. I keep getting the following:

eReader2Html v0.03. Copyright (c) 2008 The Dark Reverser
Processing... Error: Incorrect Name and/or Credit Card

The funny thing is that the MobiDeDRM works great on the books I've bought from MobiPocket.

Help?

wallcraft
12-08-2008, 12:28 PM
I've tried the following:

python mobidedrm_eReader2html.py MoonCalled-DRM.pdb . MoonCalled.pdb <credit card number masked>

The ereader2html.py script has different arguments than mobidedrm, try:

python ereader2html.py MoonCalled-DRM.pdb MoonCalled "User Name" <credit card number>

Here, MoonCalled is a subdirectory because it will end up containing HTML and images. I think this gets created for you if it does not exist. The "User Name" needs to be the name as it appears on your Credit Card (or as you registered it with FictionWise/eReader). Only the last 8 digits of your CC number are required.

The result is HTML (not a drm-free .pdb version), so you may have to format shift it again.

IDtheTarget
12-08-2008, 12:58 PM
Thank you! I misunderstood the "your name" in the "Usage" message of the python script. I thought it was the name I wanted the book to become. Silly, eh?

Thank you! I am very happy to purchase my books (since I want to support authors and have them keep writing), but after the Microsoft fiasco where people who had purchased music were no longer able to access it, I prefer to keep the content I've purchased available no matter what happens to the DRM provider.

Thanks again!

The ereader2html.py script has different arguments than mobidedrm, try:

python ereader2html.py MoonCalled-DRM.pdb MoonCalled "User Name" <credit card number>

Here, MoonCalled is a subdirectory because it will end up containing HTML and images. I think this gets created for you if it does not exist. The "User Name" needs to be the name as it appears on your Credit Card (or as you registered it with FictionWise/eReader). Only the last 8 digits of your CC number are required.

The result is HTML (not a drm-free .pdb version), so you may have to format shift it again.

JSWolf
12-12-2008, 12:50 PM
Why are we talking about eReader2HTML in a thread about MobiDeDRM?

Artair
12-13-2008, 02:55 AM
Where is source code?There is no inbuild source code.Saw a dropped down box where i found many languages.Is that means whenever i write any code in the big box at first i have to choose any of the language.

kiwi
12-15-2008, 01:15 PM
There still seems to be a bug in MobiDeDRM v0.04
Was wondering if anyone can help to try to fix it or track it down?

DeDRMed file crashed MobiReader.

Details:
I bought a book from amazon.
Used DeDRM v0.04
DeDRMed file crashed MobiReader.
I used MOBIPerl tools
(from here http://www.mobileread.com/forums/showthread.php?t=17718 )
to debug the file
and looking inside records -
it seems that the text was corrupted after about 2000 bytes into the records

JSWolf
12-15-2008, 01:57 PM
Are you sure the eBook is AZW and not topaz (AZW1 or TPZ (I think))?

pdurrant
12-17-2008, 06:32 PM
Hopefully 0.05 will fix your problem.

http://www.mobileread.com/forums/showthread.php?p=309292

If it doesn't, please let me know.

Paul


There still seems to be a bug in MobiDeDRM v0.04
Was wondering if anyone can help to try to fix it or track it down?

DeDRMed file crashed MobiReader.

Details:
I bought a book from amazon.
Used DeDRM v0.04
DeDRMed file crashed MobiReader.
I used MOBIPerl tools
(from here http://www.mobileread.com/forums/showthread.php?t=17718 )
to debug the file
and looking inside records -
it seems that the text was corrupted after about 2000 bytes into the records

kiwi
12-20-2008, 12:25 PM
Hopefully 0.05 will fix your problem.

http://www.mobileread.com/forums/showthread.php?p=309292

If it doesn't, please let me know.

Paul

WOW!!
Paul!! You are the man!!
Much obliged!
Thanks

French
12-30-2008, 07:40 PM
I am, admittedly, getting tired. And need help.

I have python installed.

I have successfully run the ereader2html script.

I have version 5 of the mobidedrm script.

I have tried running and seem to be getting hung up on the PID. I placed a > in front of the PID. This results in a file that basically has the directions that come up when you first open the DOS window and enter the script name (and no extension...the file name is the PID number).

I'm trying to take purchased DRMd mobi books and convert them to NON drmd mobibooks.

Am I using the wrong tool?

wallcraft
12-30-2008, 10:29 PM
I have tried running and seem to be getting hung up on the PID. I placed a > in front of the PID. This results in a file that basically has the directions that come up when you first open the DOS window and enter the script name (and no extension...the file name is the PID number). Don't use a ">".

If you remove the PID (i.e. only two arguments) you should get a "Usage:" error message. If you put the PID back, you should get a "invalid PID checksum" error. This indicates that the PID is actually wrong. Watch out for 0 vs O and 1 vs I.

French
12-31-2008, 09:15 AM
Don't use a ">".

If you remove the PID (i.e. only two arguments) you should get a "Usage:" error message. If you put the PID back, you should get a "invalid PID checksum" error. This indicates that the PID is actually wrong. Watch out for 0 vs O and 1 vs I.

Thank you for the response.

I actually tried entering it without the > and that resulted in the checksum error. I took the PID information directly out of Mobi (copied and pasted it into a Word document so I had easy access to it). I'll go back and try again...I did notice that the PID I copied and pasted had an LR at the end of it, but somewhere I saw it without the LR (just numbers). I thought I had tried that, too...but I tried so many things it might not be bad to go back with fresh eyes. However, I don't usually give up easy and I committed quite a bit of time to it last night (having already conquered the ereader2html the night before).

I'll post back here when I get the chance to try it again. But it sounds like you are at least confirming that a Mobi PID should be able to be used with this script (most of the posts in this thread are about a Kindle PID).

pilotbob
12-31-2008, 12:10 PM
I actually tried entering it without the > and that resulted in the checksum error. I took the PID information directly out of Mobi (copied and pasted it into a Word document so I had easy access to it). I'll go back and try again...I did notice that the PID I copied and pasted had an LR at the end of it, but somewhere I saw it without the LR (just numbers). I thought I had tried that, too...but I tried so many things it might not be bad to go back with fresh eyes. However, I don't usually give up easy and I committed quite a bit of time to it last night (having already conquered the ereader2html the night before).

What OS are you running on? Can you give us the exact command line you are using? Do you have more than one PID registered in your store? Are you sure you are using a book encoded with the PID? Some have d/led books before putting a PID in the book store, and of course those will not work.

BOb

wallcraft
12-31-2008, 12:26 PM
But it sounds like you are at least confirming that a Mobi PID should be able to be used with this script Yes. Any MobiPocket PID from any device should do, providing it is encoded into the DRMed MOBI file in question. These are 10 characters long, with the last 2 being the checksum of the 1st 8. If you are on Linux or Mac, try putting the PID in single quotes (quotes should not be necessary under Windows).

French
12-31-2008, 01:35 PM
I'm not at my home computer so I can't try anything else you might suggest right now, but I'll try to answer your questions so you can better help me.

I'm using Windows Vista.

For the string, in the DOS window I change my directory to the directory where I have my ebooks stored.

mobidedrm nameofbook.prc newnameofbook.prc PID

Without the > in front of the PID I get the check sum error. With the > I get a new prc file with 0 kb size and another file with my PID as the name that can be opened with Notepad and it basically spells out what the command line should be.

My PID has 2 letters at the end of it...so if there is some kind of "checksum" going on, and as the name would imply it is a calculation of sorts, I don't see how my PID can be valid with this script since the beginning of the PID is numbers and the end is letters.

Hope this helps.

ETA: My PID is 10 digits long including the letters at the end.

Also...I don't if I mentioned this...the device I'm using is a Blackberry. I have Mobipocket installed on the Blackberry so the PID is for the Blackberry.

ETA (again): I tried the string with several different books that have been purchased at different times and I couldn't get any of them to work. The error was always the checksum error.

pilotbob
12-31-2008, 01:40 PM
With the > I get a new prc file with 0 kb size and another file with my PID as the name that can be opened with Notepad and it basically spells out what the command line should be.


That makes sense since the ">" is a "redirect" pipe. Any output of the command line is sent to the file with that name.

I'm not sure why you are getting the invalid checksum though. Are you using version .5 of mobidedrm? You are entering the full 10 digits of your PID, including the $ sign? Are you copy/past the PID from mobireader software to the command line to ensure that you aren't confusing zero's with O's or ones with I's or something?

BOb

French
12-31-2008, 01:46 PM
That makes sense since the ">" is a "redirect" pipe. Any output of the command line is sent to the file with that name.

I'm not sure why you are getting the invalid checksum though. Are you using version .5 of mobidedrm? You are entering the full 10 digits of your PID, including the $ sign? Are you copy/past the PID from mobireader software to the command line to ensure that you aren't confusing zero's with O's or ones with I's or something?

BOb

I am using .5 of mobidedrm.

I am entering all 10 digits of the PID...but my PID doesn't have a dollar sign.

I tried to copy and paste it but control V doesn't work in the DOS window (that I could quickly figure out) so I did free hand type it. The only character that could be questionable is the 0 in my PID as all letters are upper case. But the 0 is very clearly a 0 (at least to me). However...I have not tried to change it to a O to be sure so when I get back to my computer I'll give that a shot. The checksum has me concerned though. If it's truly a sum of the first 8 characters, there's no way an L and R as the last 2 digits of the PID could work.

wallcraft
12-31-2008, 01:47 PM
My PID has 2 letters at the end of it...so if there is some kind of "checksum" going on, and as the name would imply it is a calculation of sorts, I don't see how my PID can be valid with this script since the beginning of the PID is numbers and the end is letters. This is ok. All the PIDs I have seen contain numbers, upper case letters, and perhaps "$" or "*". The "checksum" can be letters.

Since you have a Windows PC, one thing you could try is to register the PC as a 2nd device with your ebook vendor. Then redownload the ebook and confirm that it can be opened by Windows MobiPocket Reader (it will then be in your MobiPocket ebook directory, which is My Documents\My eBooks by default). Now try mobdedrm using the Windows PID, which will probably have a $ in it. Note that Windows MobiPocket Reader can do the registration and redownload for you from many MOBI sites, or you can do this manually via a web browser.

pilotbob
12-31-2008, 02:10 PM
I tried to copy and paste it but control V doesn't work in the DOS window

Try a right mouse click or the F3 key.

Hmm... I thought they all had $ in them. Perhaps igor will chime in here.

BOb

French
12-31-2008, 02:18 PM
I can definitely open the files in the Windows Mobipocket software (and could all along)...it didn't even occur to me to try that PID and that is most likely the last "registered" place I had opened any of the files.

I'll definitely try this method next (getting the Windows Mobipocket PID and trying it with that).

Thank you...that was a great suggestion. I'll post back with the results but it may not be today. If it's not today...Happy New Year to all and thank you so much pilotbob and wallcraft for your help thus far.

French
12-31-2008, 09:21 PM
I'm b-a-a--c-k.....

O.k., tried the command with the pid from my computer, which, by the way, does have a dollar sign in it.

I'm still stuck at the Invalid Checksum PID.

There is definitely no possibility of confusion with letters versus numbers.

ProfJulie
12-31-2008, 09:36 PM
For the string, in the DOS window I change my directory to the directory where I have my ebooks stored.

mobidedrm nameofbook.prc newnameofbook.prc PID

Have you tried inputting this instead?

mobidedrm.py nameofbook.prc newnameofbook.prc PID

pilotbob
01-01-2009, 12:01 AM
O.k., tried the command with the pid from my computer, which, by the way, does have a dollar sign in it.

I'm still stuck at the Invalid Checksum PID.


I have heard people having problems when there is more than 1 PID registered at the store. Try removing your blackberry PID and just having your PC PID in your bookstore. Re-download the book and then try it.

BOb

pilotbob
01-01-2009, 12:01 AM
I'm b-a-a--c-k.....

O.k., tried the command with the pid from my computer, which, by the way, does have a dollar sign in it.

I'm still stuck at the Invalid Checksum PID.

There is definitely no possibility of confusion with letters versus numbers.

Also, you still haven't shown use the "exact" command line you are using. Can you paste in your command window stuff... or attach a print screen of it?

BOb

wallcraft
01-01-2009, 01:09 AM
I'm still stuck at the Invalid Checksum PID. The attached zip file contains pid_checksum.py. This does not remove DRM, it just checks the MobiPocket PID. Use exactly the same command line as before but replace mobidedrm with pid_checksum or pid_checksum.py. This can also be used to find the right checksum for any 8-character PID, and can be run with 1 argument (<PID>) or 3 arguments (like mobidedrm, the first two are then ignored though).

French
01-01-2009, 10:20 AM
Alright...the update.

First, thank you for the right click for the paste function in the DOS window. That worked.

Second, I believe that pilotbob may have hit the nail on the head with my problem. I think my books being registered to multiple PIDs is causing an issue. Also, it appeared a couple of them I had redownloaded and I had not yet opened so they weren't registered at all.

In my case I am having to use the PID of my computer rather than the PID of my Blackberry.

Now if I could just figure out how to keep those nice little thumbnail book covers (some stay, some don't)...

Thank you very much to all.

And to recap, in case anyone else runs into this, when converting Mobi DRM to Mobi non DRM, in my case I had to use the PID of my computer rather than the device I read on.

Everything else works as explained in this thread with the command line.

THANK YOU!

Leep
01-01-2009, 01:19 PM
Check out the Mobi2Mobi tool for putting the covers back.

cheers

French
01-01-2009, 01:50 PM
Check out the Mobi2Mobi tool for putting the covers back.

cheers

Thank you! Off to do that right now.

nsmith52
01-29-2009, 01:44 AM
I'm fairly new at this, but so far have only been getting a "post not found error" in pastebin. Any ideas?

JSWolf
01-29-2009, 02:17 AM
Take a look at the blog once again and you'll see a link to a working copy.

nsmith52
01-29-2009, 06:04 PM
Thank you. Got it. I guess the posts expire every so often. Thanks for taking the time to put it back.

pozo
02-01-2009, 03:45 PM
Thanks for the info in this thread, worked like a charm :-)

jotache
02-16-2009, 06:30 AM
I’m afraid that after many attempts I still can’t get mobidedrm to work. I’ve read all the messages on two long threads in the forum and followed all the instructions – or so I believe. I installed Python 2.6 then copied to \tools\scripts the script mobidedrm version 0.01 and 0.02 and changed the extension to .py. Whichever version I run I get the ‘usage’ message. I guess this means that the script is recognised as I don’t get any error message.

The script usage asks for infile.mobi, outfile.mobi and PID. I have two PIDs one for my laptop one for Palm XT (I would also like to try a Sony). I started with the PID for the PC I’m using to run the script, then the other one, but it didn’t help.

The books I’m trying to process have the extension .prc which doesn’t match the required .mobi extension for the infile. I tried without much conviction changing the extension of the book from .prc to .mobi but it didn’t help. I then tried to convert from prc to mobi using calibre but a message says that first the drm protection has to be removed using a third party program. So I’m back to square one.

The exact command I’m using is:
‘mobidedrm book1.prc book2.prc mymobipidxxxxxxx’ where xxxx is the PID.

This seems to obey the instruction of pdurrant in message #10 of 12-07-2008 that I quote. Am I still doing something wrong?

I changed the names of the ebook files to make them shorter and more meaningful. However if I input the original file name or the exact name of the ebook as it appears in the metadata, it doesn’t help either. I’ve also tried with and without a space between ’mymobipid’ and the actual number. I also tried the actual downloaded file in the ‘my ebooks’ folder and not a copy. In the command line I used underscores like this _ instead of spaces. I also tried several different books. The PID for my PC has a $ sign, the PID for my Palm XT has no symbols, only uppercase letters and digits.

I’m out of ideas and would welcome any help for which thanks in advance.

Pdurrant wrote: You're not using the correct command line.

MobiDeDRM says:
Usage: mobidedrm infile.mobi outfile.mobi PID

You enter:
mobidedrm.py Name_of_Book.prc mymobipid#

You should enter:
mobidedrm.py Name_of_Book.prc Name_of_Unlocked_Book.prc mymobipid#

llasram
02-16-2009, 09:10 AM
The exact command I’m using is:
‘mobidedrm book1.prc book2.prc mymobipidxxxxxxx’ where xxxx is the PID.

You don't say exactly what error you're getting, but at the very least you should not have the text "mymobipid" in your command. If the book-file you want to remove DRM from were "book1.prc" and the book-file you want to create were "book2.prc" and your PID were "FUZZY$BUNNY" then the command you should type is:

mobidedrm book1.prc book2.prc "FUZZY$BUNNY"

Keeping the quote marks (") around the PID. If you've named the script something like mobidedrm.py instead of just mobidedrm, then you should type that instead -- whatever you were doing before that actually ran the command albeit unsuccessfully.

wallcraft
02-16-2009, 10:26 AM
The extensions .mobi and .prc are both used for MOBI ebooks, and both are ok for mobidedrm. As llasram says, the 3rd argument is the actual PID which is 10 characters long. Putting this is quotes may help on some machine types, and should not hurt. Finally, the latest version is 0.05. I suggest looking for it first in recent comments to the Darkreverser's Weblog (New Blog), which often contains links to the scripts.

jotache
02-16-2009, 10:54 AM
 You don't say exactly what error you're getting
Jotache: I’m not getting any error, just the usage message.
 If the book-file you want to remove DRM from were "book1.prc" and the book-file you want to create were "book2.prc" and your PID were "FUZZY$BUNNY"
Jotache: Yes, that is correct (except of course for the PID example).
 then the command you should type is: mobidedrm book1.prc book2.prc "FUZZY$BUNNY"
Jotache: I have tried all variants of this except that I include the extension .py as part of mobidedrm which then reads mobidrm.py
If I remove the extension from the script name and don’t put the extension in the command I get the usual error message ‘not a command or batch file etc. etc.’
 at the very least you should not have the text "mymobipid" in your command.
Originally I didn’t have it, but inserted it when I read the message from pdurrant that I quoted in my message.
 Keeping the quote marks (") around the PID.

Jotache: I tried with and without the quote marks and neither works. BTW I am typing the whole command directly in the command window and not copying or pasting anything or running a batch file. Once I get it to work I’ll probably write a small batch file, but I have to get there first.

 If you've named the script something like mobidedrm.py instead of just mobidedrm, then you should type that instead

Jotache: Indeed. My command(s) reflect the file name of the script: in one case mobidedrm.py and in another case (a separate command run independently of the other) mobidedrm002.py – I did it this way so I can have both scripts in the same directory / folder. Tha ‘usage’ message tells me which version of the script I have run.

 -- whatever you were doing before that actually ran the command albeit unsuccessfully.

Noted. Many thanks for your help.

pilotbob
02-16-2009, 10:57 AM
Jotache: I’m not getting any error, just the usage message.


Then you are doing something wrong. Can you post a screen capture of your command window after you run the command. Make sure to clear the cmd window, run the command, then just show that here.

You can obscure your PID if you like in the screen cap.

BOb

jotache
02-16-2009, 11:00 AM
> The extensions .mobi and .prc are both used for MOBI ebooks, and both are ok for mobidedrm.

Yes, that is how I understand it after reading the messages in the forum.

> the 3rd argument is the actual PID which is 10 characters long. Putting this is quotes may help on some machine types, and should not hurt.

Noted


> Finally, the latest version is 0.05. I suggest looking for it first in recent comments to the Darkreverser's Weblog (New Blog), which often contains links to the scripts.

I saw the references to version 0.05 but I also read that the earlier versions are supposed to work also. Instead of amending the script I prefer to wait and see if the a link to the amended script turns up.

jotache
02-16-2009, 11:12 AM
I can't get the Prt Sc key to work. Here is a copy and paste of the screen.


C:\Python26\Tools\scripts>mobidedrm.py age.prc age2.prc "xxxxxxxxxx"
MobiDeDrm v0.01. Copyright (c) 2008 The Dark Reverser
Removes protection from Mobipocket books
Usage: mobidedrm infile.mobi outfile.mobi PID

C:\Python26\Tools\scripts>mobidedrm age.prc age2.prc "xxxxxxxxxx"
'mobidedrm' is not recognized as an internal or external command,
operable program or batch file.

C:\Python26\Tools\scripts>mobidedrm002.py age.prc age2.prc "xxxxxxxxxx" MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Removes protection from Mobipocket books
Usage:
mobidedrm infile.mobi outfile.mobi PID

C:\Python26\Tools\scripts>mobidedrm002.py age.prc age2.prc xxxxxxxxxx
MobiDeDrm v0.02. Copyright (c) 2008 The Dark Reverser
Removes protection from Mobipocket books
Usage:
mobidedrm infile.mobi outfile.mobi PID

C:\Python26\Tools\scripts>

pilotbob
02-16-2009, 11:14 AM
C:\Python26\Tools\scripts>mobidedrm.py age.prc age2.prc "xxxxxxxxxx"
MobiDeDrm v0.01. Copyright (c) 2008 The Dark Reverser
Removes protection from Mobipocket books
Usage: mobidedrm infile.mobi outfile.mobi PID


This looks right. Is age.prc in the C:\Python26\Tools\scripts folder?

BOb

wallcraft
02-16-2009, 11:17 AM
I’m not getting any error, just the usage message. The usage message should only come up if you have 0 or 1 or 2 arguments. If you have 3 or more, then the script should try to do something and you should get a different message.

Try using my pid_checksum.py (http://www.mobileread.com/forums/showpost.php?p=317502&postcount=233) as a drop in replacement for mobidedrm.py. This does not strip DRM, so it is perfectly ok to post its results here. It will give a Usage message if it does not have exactly 1 or 3 arguments (you should have 3 with the 3rd the PID).

jotache
02-16-2009, 11:22 AM
pilotbob - Thanks and yes, age.prc is in the folder - I just rerereverified.

wallcraft - Thanks, I'll try your suggestion later. I'm going for a walk. This is driving me nuts!