apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.56k stars 1.52k forks source link

DeDRM with Nook #814

Open Melsuvia opened 5 years ago

Melsuvia commented 5 years ago

Hello:

I have been a Nook owner for years, and recently decided to switch over to Kindle. Looking to covert my Nook books to my Kindle and have tried everything there is available on the net, but can't seem to get anything to work. No matter what program I use, I get to the point where I have to enter my Nook account login info, and it always come back telling me that I do not have the correct information. I have checked, double checked and triple checked, and I am positive that I have the correct information. I have seen in posts here that Barnes and Noble my have changed the way to get keys to remove the DRM. Is that the case, and is there no way to remove the DRM now?

BTW, I am working with a Windows 10 PC and a Nook HD. Any information would be a great help and much appreciated.

ElleKayEm commented 5 years ago

Right now the ways these tools use to retrieve the key are broken. If you already had your key, you would still be able to remove DRM. If your Nook HD is rooted or if you have a rooted Android device with the Nook app, it's possible to find the key and manually import it into DeDRM.

Melsuvia commented 5 years ago

How would I know if my device is rooted?

ElleKayEm commented 5 years ago

If you don't know, it's not. Unless you have some tech savvy person who you let mess about with your devices. If so, ask them.

kurda13 commented 5 years ago

Right now the ways these tools use to retrieve the key are broken. If you already had your key, you would still be able to remove DRM. If your Nook HD is rooted or if you have a rooted Android device with the Nook app, it's possible to find the key and manually import it into DeDrm.

Where is the key located on a rooted device?

ElleKayEm commented 5 years ago

Not sure exactly. I've seen it on an old rooted Nook device, but it's been a while. Someone recently commented on the Alf blog that they found it on a rooted Android device. It will be in an unencrypted SQLite database. Look for something called "ccHash." 28 characters long ending in an equal sign =. Copy it into a plain text file with nothing else. Change the file extension to .b64. Import it into the plugin customization.

kurda13 commented 5 years ago

Not sure exactly. I've seen it on an old rooted Nook device, but it's been a while. Someone recently commented on the Alf blog that they found it on a rooted Android device. It will be in an unencrypted SQLite database. Look for something called "ccHash." 28 characters long ending in an equal sign =. Copy it into a plain text file with nothing else. Change the file extension to .b64. Import it into the plugin customization.

Good to know. On a Glowlight 3, I'll be sure to bring it here if I find it. So far I haven't been able to find either ccHash (which I imagine means credit card hash?) or the SQLite Database. Still searching though.

ElleKayEm commented 5 years ago

Yes, ccHash is from when the key was based on your default credit card. They stopped doing that at the end of 2014, but the key is still called that. I'll be curious to see if it can be found on the Glowlight 3. Hopefully they haven't encrypted it, as they apparently have in the Windows 10 Nook app.

cleo2525 commented 5 years ago

I know this is an old thread, but here are the steps I took to strip the DRM from my nook epubs on Windows 10. This worked on 5/27/2019 on regular ebooks. It didn't work for the one comic in my library. Also, my nook seems to be functioning ok after removing root, however I wasn't really concerned with it as I'm switching to a kindle. Please remember that rooting your device could brick it.

Downloaded my nook epubs

  1. Install the Nook app from the Windows Store
  2. Log into the app with your barnesandnoble.com account
  3. Choose to download each book in your library
  4. Located the downloaded epubs at C:\Users\\AppData\Local\Packages\BarnesNoble.Nook_ahnzqzva31enc\LocalState (replace with your username)

Download Android SDK

  1. Download the latest Android SDK from: https://developer.android.com/studio/releases/platform-tools.html#tos-header
  2. Extract the Platform-Tools zip file somewhere on your PC

Download the rootGLP scripts

  1. Download the rootGLP scripts from: https://forum.xda-developers.com/attachment.php?attachmentid=3572604&d=1449830207
  2. Extract the rootGLP-3.zip file somewhere on your PC

Enable debugging on your nook glowlight plus

  1. On your nook, go to Settings > About > click the Nook icon at the top of the page three or four times
  2. Choose Android Development Settings
  3. Check Enable USB Debugging

Enable root shell on your nook glowlight plus

  1. Connect your nook to your PC with a USB cable
  2. Launch a command line and change into the directory where you extracted the Android SDK
  3. Run 'adb devices' and make sure your nook is showing up as a device
  4. Run 'rootnook.cmd' from wherever you extracted it, the script should detect your nook is an available device in adb and enable a root shell on it
  5. Run 'adb shell'
  6. In the nook's shell, run su
  7. SuperSU Free on your nook should prompt you to allow the root shell session, click allow
  8. In the nook's shell, run 'cat /data/data/bn.ereader/databases/cchashdata.db
  9. You should get some garbled output, however in the output you should see a 28 character hash ending in =
  10. Copy the hash to a text file and save it with a .b64 extension
  11. Use this hash in the DeDRM plug-in for calibre
  12. Import your nook epubs from C:\Users\\AppData\Local\Packages\BarnesNoble.Nook_ahnzqzva31enc\LocalState and they should be stripped of their DRM

Remove SuperSU from your nook and return it to normal

  1. On your nook, in the SuperSU settings page, scroll down and choose Full unroot
  2. Reboot your nook
ElleKayEm commented 5 years ago

Thanks for the detailed explanation!

tjmhsdca commented 5 years ago

Cleo,

Thank you for going to the trouble of explaining your process. I don't currently have a Nook e-reader. The one I had was pretty worn out and was stolen, in any case. I have an Onyx Nova Pro, which I am generally liking as an e-ink reader. I have a ton of content that I purchased from B&N. Without purchasing a Nook, can I get the epubs I purchased without DRM? I can't even seem to find an epub file to bring into Calibre. I have successfully converted my Kindle and my Google Play Books, but so far haven't figured this one - the big one. Any direction you can point me in would be great! I'd hate to repurchase things if I don't have to. Thank you, in advance.

ElleKayEm commented 5 years ago

As Cleo said, you can get the epubs from the Windows 8/10 Nook app. But if you don't have your key from before Nook for PC and Nookstudy stopped working, then the only other way I know to get the key (and the books) would be a rooted Android device with the Nook app.

DracoSentien commented 5 years ago

Cleo, I know you probably moved to your kindle already but I have a rooted nook and some ebooks. None of the ebooks are comics. Anyway, I get two hashes --

' EdvjyB6xkLB3LGlHL6pGbOdnkpHEk=BLANK

E vjyB6xkLB3LGlHL6pGbOdnkpHEk=root@ntx_6sl:/data/data/bn.ereader/databases

I tried it with just the 28 characters from each set -- did not work-- then I tried it using various incarnations with it truncated at places and it did not work. Can you please give me some insight here ?

DracoSentien commented 5 years ago

BTW, I am using the nook Glowlight 3 but I just ordered a glowlight plus today.

tjmhsdca commented 5 years ago

Hi Cleo, I also have a question. I have a Samsung Galaxy Tab S2 that I can root with Nook app on it, but no longer have an actual Nook. Can I root that tablet to get the hashes needed, or will I need an actual Nook device. I can try to find a refurbished or older version used or discounted somewhere, if that's the case. I appreciate your help. I've been able to remove all but B&N DRM, and Iused B&N the most when I still had my Nook.

Thank you!

DracoSentien commented 5 years ago

I figured out the problem. The cchashdata.db file had limited permissions so I did a "chmod 755 cchashdata.db" because pulling the file with adb did not work before that command. Then I pulled the file and ran the sqlite3 database command line on it then issued the command “sqlite3.exe cchashdata.db”. At the database prompt, enter “select hash from cc_hash_data;”. Don’t forget the semicolon. Viola ! Then it gave me my hash.

ElleKayEm commented 5 years ago

@DracoSentien This is your key: vjyB6xkLB3LGlHL6pGbOdnkpHEk=

@tjmhsdca Yes, you can find your key on a rooted Android device with the Nook app as well.

DracoSentien commented 5 years ago

@DracoSentien This is your key: vjyB6xkLB3LGlHL6pGbOdnkpHEk=

@tjmhsdca Yes, you can find your key on a rooted Android device with the Nook app as well.

Thanks but no thanks , I already figured it out ! I already stripped the DRM of all my nook ebooks before you even posted that reply ! See my third comment above.

ElleKayEm commented 5 years ago

Yup, I see you posted while I was still looking at something else. Glad you figured it out.

tjmhsdca commented 5 years ago

Thank you, again, for your patience. I had my Dell XPS have a fit of Blue Screens of Death, so I had to postpone my de-DRMing. So, currently, I do not have my Galaxy S2 rooted. I bought a newer tablet, so I'm fine rooting it. Do you have a recommendation for what I use in place of the Samsung setup? Any guidance would be great. I'm tempted to just get a Nook and possibly return it after since I have so much content there that really needs to be portable. Thank you, again!

On Sat, Jun 29, 2019 at 3:26 PM ElleKayEm notifications@github.com wrote:

@DracoSentien https://github.com/DracoSentien This is your key: vjyB6xkLB3LGlHL6pGbOdnkpHEk=

@tjmhsdca https://github.com/tjmhsdca Yes, you can find your key on a rooted Android device with the Nook app as well.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apprenticeharper/DeDRM_tools/issues/814?email_source=notifications&email_token=AL36UGTZCB7GBO2SC44MFL3P47OPTA5CNFSM4HI2BJBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY4BGWQ#issuecomment-506991450, or mute the thread https://github.com/notifications/unsubscribe-auth/AL36UGUUPH6HQ6GNS7LMIPLP47OPTANCNFSM4HI2BJBA .

ElleKayEm commented 5 years ago

I don't know, but you can probably find something at the xda forums:

https://forum.xda-developers.com/

tjmhsdca commented 5 years ago

Thank you!

On Fri, Jul 12, 2019, 3:45 AM ElleKayEm notifications@github.com wrote:

I don't know, but you can probably find something at the xda forums:

https://forum.xda-developers.com/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apprenticeharper/DeDRM_tools/issues/814?email_source=notifications&email_token=AL36UGRAG2GGFQCXI73P3YDP7BOELA5CNFSM4HI2BJBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZNEIY#issuecomment-510841379, or mute the thread https://github.com/notifications/unsubscribe-auth/AL36UGXESWLTFFV62BBN6QLP7BOELANCNFSM4HI2BJBA .

acavender commented 5 years ago

@cleo2525 @DracoSentien @tjmhsdca I'm wondering if there's something I'm missing.

I installed Nook for Android on a virtual device, and signed in. I was able to access the relevant database and extract the hash from it. Following the instructions @cleo2525 posted, I created the key file.

The DeDRM plugin in Calibre allows me to import the file. However, my books aren't stripped of their DRM when I import them. I continually get the dreaded "This book has DRM" popup.

When the problem occurred on my Mac, I tried the same on a Windows virtual machine, with the same result.

If any of your experience might suggest something I've missed, I'd be grateful.

ElleKayEm commented 5 years ago

Post a log:

https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md#i-cannot-solve-my-problem-with-the-dedrm-plugin-and-now-i-need-to-post-a-log-how-do-i-do-that

acavender commented 5 years ago

Many thanks, @ElleKayEm, for the instructions on how to get the log.

If it makes a difference, this is from a Mac running 10.14.6.

Here's what the log says:

calibre Debug log calibre 3.46 embedded-python: True is64bit: True Darwin-18.7.0-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '18.7.0', 'Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64') Python 2.7.15 OSX: ('10.14.6', ('', '', ''), 'x86_64') Interface language: None Successfully initialized third party plugins: DeDRM (6, 6, 3) calibre 3.46 embedded-python: True is64bit: True Darwin-18.7.0-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '18.7.0', 'Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64') Python 2.7.15 OSX: ('10.14.6', ('', '', ''), 'x86_64') Interface language: None Successfully initialized third party plugins: DeDRM (6, 6, 3) devicePixelRatio: 1.0 logicalDpi: 72.0 x 72.0 physicalDpi: 123.000001847 x 124.000001862 Using calibre Qt style: True [0.00] Starting up... [0.02] Showing splash screen... [0.19] splash screen shown [0.19] Initializing db... [0.20] db initialized [0.20] Constructing main UI... [1.00] main UI initialized... [1.00] Hiding splash screen [1.02] splash screen hidden [1.03] Started up in 1.03 seconds with 1 books DeDRM v6.6.3: Trying to decrypt 9780307273154.epub DeDRM v6.6.3: Verifying zip archive integrity DeDRM v6.6.3: “9780307273154.epub” is a secure Barnes & Noble ePub DeDRM v6.6.3: Trying Encryption key BNobleX Could not decrypt rkY50F.epub because of an exception: Traceback (most recent call last): File "calibre_plugins.dedrm.ignobleepub", line 280, in decryptBook File "calibre_plugins.dedrm.ignobleepub", line 211, in init File "calibre_plugins.dedrm.ignobleepub", line 160, in init IGNOBLEError: AES improper key used

DeDRM v6.6.3: Failed to decrypt with key BNobleX after 0.1 seconds DeDRM v6.6.3: Looking for new NOOK Study Keys after 0.1 seconds Found nookStudy log file: /Users/acavender/Library/Application Support/Barnes & Noble/DesktopReader/logs/BNClientLog.txt Found nookStudy log file: /Users/acavender/Library/Application Support/Barnes & Noble/DesktopReader/indices/BNClientLog.txt DeDRM v6.6.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "site-packages/calibre/customize/ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.dedrm.init", line 635, in run File "calibre_plugins.dedrm.init", line 304, in ePubDecrypt DeDRMError: DeDRM v6.6.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md

Debugging DND event text/uri-list 63 'file:///Users/acavender/Desktop/LocalState/9780307273154.epub\r\n'

Firefox rurl: None None URLS: [u'file:///Users/acavender/Desktop/LocalState/9780307273154.epub'] Paths: [u'/Users/acavender/Desktop/LocalState/9780307273154.epub'] Extensions: frozenset([u'epub']) Added Half the Sky: Turning Oppression into Opportunity for Women Worldwide to db in: 0.5

ElleKayEm commented 5 years ago

How did you download the books and was it recently?

fitzshayla commented 5 years ago

Has anyone else had trouble with a blank cchashdata.db file?

Using Nook for Android on my (rooted) phone. Followed the instructions of cleo2525 (allowing for slight variances due to a different device), and attempted to extract the hash. But the output of 'cat cchashdata.db' was the following:

                                                

@cleo2525 @tjmhsdca @DracoSentien I would be grateful for any help you might be able to provide!

ETA: One difference, which I assume is related to the OS but mentioning just in case. My cchashdata.db file is located in 'data/data/com.nook.app/databases', not '/data/data/bn.ereader/databases'.

And a couple extra details, in case they're relevant:

acavender commented 5 years ago

@ElleKayEm I used the Windows 10 Nook application in my Windows VM — that was the only app I could get to work.

I downloaded the books on Tuesday. The emulated Android device was a Nexus 5 running Nougat. I extracted the hash from there this afternoon (Wednesday).

ElleKayEm commented 5 years ago

@fitzshayla You were signed into the Nook app?

@acavender Can you download your books via the Android emulator? Usually the key is the same, but it might be different.

fitzshayla commented 5 years ago

@ElleKayEm Yup, and also made sure my books were downloaded to my device. (Which I double-checked by accessing them offline.)

acavender commented 5 years ago

@ElleKayEm I’ll give that a try later today and report back. Just in case, I’ll also remove the non-functional Nook Study app from my machine.

Thanks for your help!

ElleKayEm commented 5 years ago

@fitzshayla Hmm, /data/data/bn.ereader/databases was the location on Android devices as well as Nooks. Possibly something's changed since it does look like the Nook app was updated on Google Play on 7/26/19. I don't know what version others are using.

acavender commented 5 years ago

@ElleKayEm Thanks again for your help. I got things working -- apparently the key wasn't the same for books downloaded from the Windows 10 app as from the Android app.

In case it's helpful to anyone else, here's the process I used:

  1. Install Android Studio.
  2. Use the AVD Manager in Android Studio to create a virtual device. (I opted for a Nexus 5 running Android 7.1.1, since I'd tried a Pixel 2 running Android 9.0, and it was slow. Also, be sure to click on the "Other images" tab and choose a system image that shows "Google APIs" in the Target column. I couldn't get ADB to connect to any of the images in the "Recommended" tab, which have "Google Play" as their target.)
  3. Install the Nook app on the virtual device. (I couldn't log in to the Google Play store, so I had to use Chrome on the virtual device to grab it using APK Downloader.)
  4. Sign into the Nook app and download the books.
  5. Connect to the virtual device using ADB.
  6. Get the hash needed to create the key. The directions @cleo2525 gives above should work. I used the instructions Difflugia provides in a comment on Apprentice Alf's post.
  7. Create the key file, as @cleo2525 and @ElleKayEm explain above, and add it to Calibre.
  8. Pull the books from the virtual device. (I didn't want to fuss with directory names that have spaces, so I pulled a parent directory: ./adb pull /data/data/bn.ereader. The full path to the books is /data/data/bn.ereader/files/B&N Downloads/Books.)
  9. Import the downloaded books into Calibre as usual, and try converting one to see whether the DRM was indeed stripped. You should be good.

P.S. If, when trying the cat or pull command, you get a message saying that the file or directory you're trying to access doesn't exist, enter the command ./adb root, then re-run the command that produced the error. The data you're trying to access is only visible to root.

ElleKayEm commented 5 years ago

@acavender Glad you got it working, and thanks for giving details

fitzshayla commented 5 years ago

@ElleKayEm Got it working, thank you so much for your help!

Tried using a virtual machine, as per the instructions above from @acavender (which were excellent), and it worked perfectly. Why the file was essentially empty on my phone but not in the emulator... no idea.

The folder was still com.nook.app though. Perhaps that is something new, or perhaps it's related to the phone. (As all app folders in the /data/data/ directory are of the format com.<appName>.app.)

ElleKayEm commented 5 years ago

@fitzshayla Good to know. Were the books also in a different location?

fitzshayla commented 5 years ago

@ElleKayEm They were in data/data/com.nook.app/files/B&N Downloads/Books. So excepting the com.nook.app instead of bn.ereader aspect, the path for the books is the same.

bfollowell commented 5 years ago

Thanks for this detailed instructions!

Like all of you, I ran into this problem just recently. I've used the same decryption key for years, but was recently forced by B&N to change my account password, which broke my key. No idea if changing my password back will fix things, but I doubt it. I'll give it a try though. Otherwise, I'll use the instructions here to try and get my new key from my rooted Nook HD+.

bfollowell commented 5 years ago

OK, again, thanks for all of the info. It helped me find my cchashdata.db file. For what it's worth to anyone, my file wasn't in either of the directories that others have listed. On my rooted Nook HD+ it was located in /data/data/com.bn.nook.cloud.service/databases/ Just trying to add info that may be helpful to others in the future.

bfollowell commented 5 years ago

Something else I've just learned, since I rooted my Samsung Galaxy Tab S, the decryption keys are obviously based on something more than just username/email/password. If it was only based on those items, I would've expected the keys to be the same regardless of where they came from, but I have two distinctly different keys for the same account. One is from my rooted Nook HD+ and the other is from my newly rooted Galaxy Tab S, and both seem to be working without issue.

ElleKayEm commented 5 years ago

I don't think the keys have been based on anything since they switched from credit card based keys back in 2014. I know I've had the same key since then despite a least a couple password changes. I've also got the same one for every app I've used, but I have seen a few cases where others had a different one for a different device or app.

bfollowell commented 5 years ago

Has there ever been a work-around found for B&N pdf books? I only have a few, but I'd like to be able to remove the DRM from them as well. I'm not aware of a tool that works for them.

ElleKayEm commented 5 years ago

I don't believe one was ever figured out. At least not one that was shared with the Apprentices.

LavaIce commented 5 years ago

Trying to follow the instructions for using a virtual android device to get the hash needed and I don't seem to be having any luck I have gotten Android Studio installed and I've been using Pie Image. I've tried a couple of different versions of the Nook app without luck. It appears that I am able to get the cchashdata.db download but there doesn't appear to be any data. I have made sure to download some books onto the device. All I get is

generic_x86:/ # cat /data/data/com.nook.app/databases/cchashdata.db  or C:\Users\LavaIce\AppData\Local\Android\Sdk\platform-tools>sqlite3 cchashdata.db SQLite version 3.28.0 2019-04-16 19:49:53 Enter ".help" for usage hints. sqlite> select hash from cc_hash_data; Error: no such table: cc_hash_data sqlite>

Is there a better version of Android any or the Nook App that I should be using or has this method a no longer work now?

Thanks

bfollowell commented 5 years ago

It may sound silly, but have you tried just copying the cchash file over to your computer and looking at it with a text editor? What are you using to view the cchash file?

LavaIce commented 5 years ago

@bfollowell Just tried with Notepad++ and there isn't anything there really. Also, just tried viewing with DB Browser for SQLite and it shows a blank database.

bfollowell commented 5 years ago

When you say there isn't anything there, really, what do you mean by really? Is there nothing there, or is there something there? To someone not knowing what to expect, it just looks like garbage characters, but there should definitely be something there. If you open it, and it's just a blank file, no characters at all, then yes, something is definitely wrong. That would never be a normal situation.

LavaIce commented 5 years ago

@bfollowell All that's there is the shell text/code for the SQLite 3 DB. It contains no hash code, no tables etc. It doesn't copy very well but this should give you an idea.

SQLite format 3   @     .° 

DracoSentien commented 5 years ago

Well, if I remember correctly the vast majority of the file was junk , like 'shell text/code', but the hash was hidden in it randomly. Also, I guess it is possible, but perhaps not likely, the method does not work anymore since I have had two eReader firmware updates since I did it.

On Tue, Oct 1, 2019 at 9:02 PM LavaIce notifications@github.com wrote:

@bfollowell https://github.com/bfollowell All that's there is the shell text/code for the SQLite 3 DB. It contains no hash code, no tables etc. It doesn't copy very well but this should give you an idea.

SQLite format 3 � �� @ � � � � .�° �

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apprenticeharper/DeDRM_tools/issues/814?email_source=notifications&email_token=AMPPBXRSNCCDMWXGVL5AOODQMPXKHA5CNFSM4HI2BJBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEADGWSA#issuecomment-537291592, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPPBXTJOGVAQXH66O5RZGTQMPXKHANCNFSM4HI2BJBA .

bfollowell commented 5 years ago

Yes, the method still works. I just got my decryption key this way two weeks ago, and the file is still on my tablet and the contents still look the same. But, I'm pulling mine from a real rooted tablet, not a virtual, emulated Android device. Not sure if that's making a difference or not.

@LavaIce, would you consider sending me your cchashdata.db file so that I can look at it? Assuming I never received any books that were downloaded via your virtual device, I wouldn't be able to do anything with it anyway. I just want to be able to see exactly what you're seeing. If not, I understand.

LavaIce commented 5 years ago

@bfollowell no problem with sharing, my cchashdata.db is attached in a zip. I'm hoping I'm just missing something simple. I've attached the file. What version of android and the Nook App are you using? As stated I've been trying to use Android Pie and Nook v5.0.2.38 and v4.9.0.43

cchashdata.zip