Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeDRM with Nook #814

Open
Melsuvia opened this issue Apr 26, 2019 · 163 comments
Open

DeDRM with Nook #814

Melsuvia opened this issue Apr 26, 2019 · 163 comments

Comments

@Melsuvia
Copy link

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
Copy link

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
Copy link
Author

How would I know if my device is rooted?

@ElleKayEm
Copy link

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
Copy link

kurda13 commented Apr 28, 2019

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
Copy link

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
Copy link

kurda13 commented Apr 29, 2019

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
Copy link

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
Copy link

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<username>\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<username>\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
Copy link

Thanks for the detailed explanation!

@tjmhsdca
Copy link

tjmhsdca commented Jun 7, 2019

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
Copy link

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
Copy link

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 --

'�� �E�dvjyB6xkLB3LGlHL6pGbOdnkpHEk=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
Copy link

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

@tjmhsdca
Copy link

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
Copy link

DracoSentien commented Jun 29, 2019

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
Copy link

@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
Copy link

@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
Copy link

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

@tjmhsdca
Copy link

tjmhsdca commented Jul 12, 2019 via email

@ElleKayEm
Copy link

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

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

@tjmhsdca
Copy link

tjmhsdca commented Jul 13, 2019 via email

@acavender
Copy link

@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.

@acavender
Copy link

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.474/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
Copy link

How did you download the books and was it recently?

@fitzshayla
Copy link

fitzshayla commented Aug 1, 2019

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:

  • OnePlus 6 running OxygenOS 9.0.6
  • Rooted with Magisk
  • Nook for Android Vers 5.0.2.38

@acavender
Copy link

@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
Copy link

@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
Copy link

fitzshayla commented Aug 1, 2019

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

@Valinur32
Copy link

Just wanted to leave my experience in case it helps others. Thanks for the assistance to everyone in the thread, especially Aric.

My goal was to strip the DRM off Nook manga, which needed more steps than a standard ebook.

Successful steps to get decrypted manga:

  1. Followed Aric's instructions using the same emulated device model and software versions and successfully retrieved my key.
  2. Added the key to Calibre version 5.13 using deDRM 7.1.0.
  3. Pulled books off emulated device in epub format.
  4. Added books to Calibre to remove encryption. The books should have basic metadata and the covers, but nothing else will be accessible.
  5. Select "Save as" on books. Save as epub format in a convenient location, I chose my desktop. Don't remove these books from Calibre after saving, they'll be handy for saving time later.
  6. Change the format of the new epubs that you just saved to zip. Unzip the files, navigate to pages folder of each (I think it was OPS -> images -> pages, or similar), run a search for "thumb" and delete all the thumbnail files, then re-zip all the remaining images found in there. Name the zip folder with the same name as the corresponding original epub in Calibre.
  7. Import the new zip folder containing the images, which should be recognized as CBZ format. Since you named the zip folder similar to the book name, Calibre will warn you that you're adding a duplicate.
  8. (Alternate method for 6-7) The fastest way I found to steps 6 and 7 for a large number of files was to use 7Zip. Right click on file -> 7Zip menu -> open as archive -> navigate to pages folder -> shift A to select all -> hit extract -> hit okay for all images to be extracted. All pages will be extracted into the base folder which should have the exact same name as the original novel. Remove thumbnails using search and any non-image files (there should be 3 files that calibre left that you'll have to remove). Shift A to select all -> 7Zip menu -> add as "bookname.zip", then drag-and-drop into Calibre.
  9. After adding the new CBZ, select the file, then hit the title button in Calibre. This will shift it so that the old unreadable epub and the new decrypted CBZ are next to each other. Select the old epub first, then the new decrypted CBZ, and hit alt-shift-M. This will merge the new CBZ format into existing metadata for the original epub. Remove the epub from the merged record.
  10. If you want, update metadata using the download tool and then use the "Embed Comic Metadata" plugin to update the metadata in the CBZ.
  11. You now have a readable CBZ with fully updated metadata.

Note: all attempts to use the Nook Windows app failed. Calibre was never able to properly decrypt the files, even with attempting to manually add the "rights.xml" file into the epub and using the same encryption key that worked for books retrieved from the emulator.

Honestly, it's hard to justify this level of effort for new manga purchased from B&N, but sometimes they're the only option for certain series.

Cheers, everyone.

@BucketListMod
Copy link

BucketListMod commented May 8, 2021

As an added note RE: Vlinur32's guide for comics, manga, and graphic novels

I followed all the instructions to a T, but the page order of my book was scrambled on some devices (my phone/ereader but not my main computer, oddly).

The solution to this if you have it is, after deleting all the "thumbs" files, make sure all the pages have leading 0s so that the page number has the same number of integers in it. For example, in a 200+ page graphic novel, add two leading 0s to pages 1-9, and one leading 0 to pages 10-99

So instead of BN_DRP_PAGE_1.jpg, change it to BN_DRP_PAGE_001.jpg; change BN_DRP_PAGE_10.jpg to BN_DRP_PAGE_010.jpg; etc etc.

Best of luck all!

@spartanhooah
Copy link

I'm another poor sod whose cc_hash_data table is empty (although it does exist in cchashdata.db). Besides AVD (I have a Pixel 4 using the Google APIs version of Android 11), what emulators have folks had success with? I don't really see any successes with other emulators in this thread.

@ElleKayEm
Copy link

With AVD, Aric's writeup has a Nexus 5 device using Android 7.1.1 (Google APIs) as the base image. Someone else upthread mentions a Nexus 6 with Android 11 working.

@ElleKayEm
Copy link

I've also heard that now the BN key will change with new installations of the Nook app. So be sure to grab new copies of books as well as key at the same time.

@spartanhooah
Copy link

I tried both of those combinations and still nothing in the table.

@ElleKayEm
Copy link

I don't know. Maybe this just doesn't work anymore. You were able to download and read your books in the app?

@spartanhooah
Copy link

Yup, in all cases.

@ElleKayEm
Copy link

Hmmm, it doesn't seem like it needs to put the cchash in there. I don't know what triggers it to do so in some cases and not in others. What version of the Nook app are you using? I see Aric used 5.0.2.38 which looks like it's from a couple years ago.

@spartanhooah
Copy link

I used the newest version from APK Mirror, which was 5.5.x. I'll try the older version and see if that makes any difference. In my defense, I figured the post referenced older versions of Android and the Nook app because the post itself was pretty old, but I see that's not the case.

@spartanhooah
Copy link

Haha, I did need the old version! I got my key and successfully de-DRM-ed my books. Thanks for the suggestion!

@ElleKayEm
Copy link

Good to hear! I was worried this method just wasn't working any longer.

@digitalfreaknyc
Copy link

Has anyone used these instructions?
https://kmhilton.wordpress.com/2021/05/25/dedrm-your-nookbooks-for-dummies/

Stuck on 19. No idea how to find where the books are. On the emulator, it’s in SDCard/Android/data/bn.ereader but I can’t find that at all on windows file explorer. Any advice? Show hidden items is ticked.

@captn3m0
Copy link

captn3m0 commented Sep 28, 2021

@digitalfreaknyc They won't show up in Windows Explorer. You need to use adb pull to actually fetch the files from the Virtual Device to your desktop.

I used the instructions against a rooted android device, and they worked perfectly. I installed 5.0.2.38 but the file paths on the device used bn.ereader instead of com.nook.app:

  • /data/data/bn.ereader/databases/cchashdata.db
  • /data/data/bn.ereader/files/B&N Downloads/Books/*.epub

Used the latest DeDRM release (7.2.1).

@baqlias
Copy link

baqlias commented Nov 20, 2021

I'm stuck trying to install the Nook app in my virtual device. Either I get a message that my device has insufficient storage, I get a parsing error, or that the app is incompatible with my device. I've tried four virtual devices so far, and different versions of Android. The device/Android combo in Aric Renzo's description wouldn't work for me, either. Still looking for a combination that will work. I'm on a Mac, if that makes a difference. I'm open to any suggestions of what has worked for you!

@baqlias
Copy link

baqlias commented Nov 20, 2021

I discovered my problem. I have a Mac with an M1 chip. Even with installing the Android Studio version for M1, the virtual devices do not work as expected. Some won't work at all. Now attempting with my Intel Microsoft Surface Go.

@baqlias
Copy link

baqlias commented Nov 20, 2021

Well, I went through the whole process, extracted the key a 28 digit key ending in =, added it to the DeDRM plugin in Calibre... and it didn't strip the DRM. I'm using the Nook app for Windows 10-11. I'll try again later.

@baqlias
Copy link

baqlias commented Nov 20, 2021

I decided to try the key on my Mac Calibre setup. I downloaded three Nook books on the Nook Windows app and copied them to my Mac. Calibre on Mac removed DRM from two out of the three books.

@ElleKayEm
Copy link

Try the books from the app where you got the key. Are they all epubs?

@baqlias
Copy link

baqlias commented Nov 20, 2021

They are all epubs. I tried two from the app where I got the key. I had the same result. The one from which Calibre couldn't remove DRM is in this format: long number_epub.v4.epub, while the other, that Calibre successfully removed DRM from, is: long number_epub.v3.epub.

Some books are epub.v2.epub, and others epub.v1.epub. I don't know if those differences have any relevance to my DRM problem!

@ElleKayEm
Copy link

@baqlias
Copy link

baqlias commented Nov 21, 2021

tmp972pzot7.txt
That one is a book - almost all text - and not a comic or manga. I've uploaded a log - successfully, I hope!

@ElleKayEm
Copy link

Hmmm, doesn't seem to like those keys. Can we see a log from one of the ones that succeeded?

@baqlias
Copy link

baqlias commented Nov 29, 2021

Well, I tried one more thing. It finally dawned on me that I have an old rooted Nexus 7 which is now running Android 11, courtesy of XDA. I installed Nook 5.02.38 on it and, using sqlite on cchashdata.db, found a code that was different from the one I had from my Android emulator. I made a new key with this code for DeDRM. I downloaded a few books through that Nook app and tried importing them into Calibre. No books had their DRM removed.

Thank you for your help, but I wonder if it's worth it for me to keep chasing this. My Kindle setup with Alf and Calibre works fine.

@ElleKayEm
Copy link

Development of these tools has been picked up by someone calling themself noDRM here at GitHub. I haven't looked at it myself, but I've heard there are improvements to the Nook part of things in addition to merging pull requests that have been lingering here for a while. So maybe look for that and give it one more shot.

@baqlias
Copy link

baqlias commented Nov 29, 2021

Thanks for your response! In the meantime, I discovered noDRM, thanks to comments on the Mobileread forums. I decided to test it out. I installed Calibre on a Windows 11 VM I have on my Mac and then installed the noDRM plugin in Calibre. The noDRM plugin gives me the option to set up a key for Nook books using the old algorithm. I then tried some Nook books I downloaded from the Nook app for Windows 10/11.

Here's the result: the book that I couldn't remove DRM from before, noDRM removed! However, noDRM didn't remove DRM from other Nook books I tested. I noticed in the noDRM readme that no claim is made to be able to remove DRM from Nook books (because there are difficulties with such removal), even though the plugin itself has a B&N button. YMMV, I guess.

@ElleKayEm
Copy link

Anything in particular about the ones that didn't work? Downloaded from a different app? Fresh copies or downloaded some time ago? From the same publisher?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests