View Single Post
Old 05-07-2014, 06:16 PM   #1
kaito
Connoisseur
kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.kaito understands the mechanisms of the catecholamine pathways.
 
Posts: 52
Karma: 76234
Join Date: May 2013
Device: k3w, gloHD
Adding downloadable filetypes to browserd?

I would like to add allowable file extensions and mime types to the browserd file on my Kindle Keyboard v3.4 so I can download .azw3 and .pdf (and other) filetypes directly from Calibre web server.

My /usr/bin/browserd is 767060 bytes.

I am aware of the Free Download Hack but it seems like so much could go wrong and I'd rather not add background curl downloading if I don't have to.
https://www.mobileread.com/forums/sho...d.php?t=121008

After reading these forums it is my understanding that browserd has a hard coded list of file extensions and mime types that are allowed to be downloaded (by matching strings, and wildcards are not allowed). I would like to add to this list.

Calibre has the .azw3 has mime type:
application/x-mobi8-ebook
(I don't want to change it, I'd rather just modify my kindle ones and have it work with any Calibre server)

While using a hex editor I noticed that this older browserd was modified to allow .epub and .pdf files and it looks like they were just inserted in there?

https://code.google.com/p/gsnippet/s.../data/browserd

Code:
A8B10:  00 00 00 00-44 6F 77 6E-6C 6F 61 64-69 6E 67 2C      Downloading,
A8B20:  49 64 3D 25-70 2C 20 66-69 6C 65 3D-25 73 00 00  Id=%p, file=%s  
A8B30:  2E 61 7A 77-00 00 00 00-2E 61 7A 77-31 00 00 00  .azw    .azw1   
A8B40:  2E 70 72 63-00 00 00 00-2E 70 64 66-00 00 00 00  .prc    .pdf    
A8B50:  2E 65 70 75-62 00 00 00-2E 6D 6F 62-69 00 00 00  .epub   .mobi   
A8B60:  4C 4F 41 44-20 44 45 43-4C 49 4E 45-44 3A 20 42  LOAD DECLINED: B
But the number of 00's (nulls) between each extension seems variable. How is that determined? What is the right way to add more extensions and mime types? Doesn't inserting things into a binary harm other offsets?

Here is my unmodified binary (at a different location):

Code:
AAD40:  00 00 00 00-44 6F 77 6E-6C 6F 61 64-20 72 65 71      Download req
AAD50:  75 65 73 74-65 64 2C 20-64 6F 77 6E-6C 6F 61 64  uested, download
AAD60:  49 64 3D 25-70 2C 20 66-69 6C 65 3D-25 73 00 00  Id=%p, file=%s  
AAD70:  2E 61 7A 77-00 00 00 00-2E 61 7A 77-31 00 00 00  .azw    .azw1   
AAD80:  2E 70 72 63-00 00 00 00-2E 6D 6F 62-69 00 00 00  .prc    .mobi   
AAD90:  4C 4F 41 44-20 44 45 43-4C 49 4E 45-44 3A 20 42  LOAD DECLINED: B
Code:
AA540:  64 65 64 00-73 74 61 74-75 73 00 00-74 65 78 74  ded status  text
AA550:  2F 78 2D 70-72 63 00 00-61 70 70 6C-69 63 61 74  /x-prc  applicat
AA560:  69 6F 6E 2F-78 2D 6D 6F-62 69 70 6F-63 6B 65 74  ion/x-mobipocket
AA570:  2D 65 62 6F-6F 6B 00 00-61 70 70 6C-69 63 61 74  -ebook  applicat
AA580:  69 6F 6E 2F-6F 63 74 65-74 2D 73 74-72 65 61 6D  ion/octet-stream
AA590:  00 00 00 00-74 65 78 74-2F 70 6C 61-69 6E 00 00      text/plain  
AA5A0:  2E 74 78 74-00 00 00 00-44 65 66 61-75 6C 74 69  .txt    Defaulti
AA5B0:  6E 67 20 4D-49 4D 45 20-70 6F 6C 69-63 79 20 66  ng MIME policy f

Last edited by kaito; 05-07-2014 at 06:18 PM.
kaito is offline   Reply With Quote