Llink:changelog: Difference between revisions

From Lundman Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''llink is a media streamer''' that lets you play movies, view online trailers, browse images or play music over a network using the http protocol. It should work with most Syabas NMT hardware (NetworkedMediaTank middleware based players), such as the Popcorn Hour A- and B-series, HDX, iSTAR, Egreat a whole range of others, possibly even a couple of older ones like the LinkTheater. Some of the best reasons to run llink is that it can run on a great many platforms, including most popular NAS devices - even on the NMT player itself - and it can play media directly from RAR files.
== Network Media Tank Firmware ==


I downloaded a random version of the firmware, which looks like:


[[Image:llink.screen2.jpg|right|thumb|100px|llink-2.2.0 aqua skin]]
-rw-rw-r-- 1 lundman lundman  32380583 Nov  8 00:58 01-13-071101-13-POP-402.zip
[[Image:llink.screen3.jpg|right|thumb|100px|llink-1.9.9 jukebox skin]]
[[Image:llink.screen4.jpg|right|thumb|100px|llink-2.2.0 clterm skin]]
[[Image:llink.screen5.jpg|right|thumb|100px|llink-2.2.0 nmt skin]]
[[Image:Kamaishi_skies.jpg|right|thumb|100px|llink-2.2.0 kamaishi_skies skin]]


=== llink overview ===


* [[Llink:compatible_players|List of compatible players]]
32Megs compressed. Inside that we have:
==== Features ====


* Parses various video containers: vob, avi, ts, mkv, tp, mov, m2ts, evo.
-rw-rw-r-- 1 lundman lundman 17970150 Nov  2 11:11 01-13-071101-13-POP-402-000.bin
* Streams any file type the NMT player can handle: mp3, flac, jpeg, png etc.
  -rw-rw-r-- 1 lundman lundman      723 Nov  7 23:32 README.txt
* Can play straight '''from rar files''': no more need to unrar your media. (Comes with special unrar-3.7.8-seek.)
-rw-rw-r-- 1 lundman lundman 14536029 Nov  7 15:44 syb8634.nmt
* SSDP / UPnP discovery support (although minimal).
-rw-rw-r-- 1 lundman lundman      108 Nov  2 22:27 usbupdate.html
* [[Llink:skins|Skin support]]: make your own html templates or choose from pre-built.
* Simple iMDb querying to look up media information for Jukebox skins.
* Both HD and SD skins available.
* Light, tiny and clean code for Unix, OsX and Windows. Compiles to most platforms.
* Paginating: support to send listings in pages, with tags for Next/Prev.
* PlayAll cgi tag, and PlayAllFrom.
* External subtitles: subtitle files can be consolidated in one directory.  
* libdvdnav support (and libdvdcss): provides basic playback of DVD .iso and .img files and from DVD drives.
* UDF 2.50 BD5-ISO support: provides basic playback of Bluray and HD-DVD.
* (External process support, like mencoder: incomplete).
* Can initiate custom shell scripts.
* Keep track of what you have already seen: small database for 'watched' media.


<paypal></paypal>
Looking at the large '''01-13-071101-13-POP-402-000.bin''' file first, we notice that it has a 76 bytes header.


It is a 3des encrypted header which contains information about the image. The first 4 bytes contains the length of the header and should match 76.
Next we have the size of the flash counted in DWORDS and next we have the number of blocks. It also includes a CRC and for each block we have an ASCII
description of the block type followed by the length.
The header ends with a couple of version strings. A small program parsing and decrypting the header gives the following:


=== Todo ===
Flash size is 33554432? and number of blocks is 3
Block 1 type: ker, length 5368832
Block 2 type: xos, length 33012
Block 3 type: app, length 13161224
Version 1: xPe0t2, Version 2: c402dPOPk14


In no particular order:
The first block is a romfs called '''SPLASH_BOOT'''.
* Add a transparent FTP fs layer? this would be well nice if it worked with RAR. ''Be quite easy to do now as a 'unrar' replacement, 'unftp'.''
* Scraping/parsing of .NFO files (for media info).
* mms:// protocol support (libmms looks ok, but has own select() call, needs deeper inspection).
** Implemented as unmms (unrar clone) but Stream support on PCH is lacking. Please bug Syabas about letting us set stream-mode
* Scrape/look for subtitles (ex. http://www.subtitlesource.org/title/tt0325710/).
* Proposed [[llink:menus|menus]]. Partly working since v2.2.0
* Configuration via web page.
* [http://www.teamavalaunch.com/ Avalaunch] style backgrounds. (Ex. fetch picture from [http://apod.nasa.gov/apod/archivepix.html NASA] every 30s and refresh) for mp3/playlists.
* Playing mp3s, and photos from RAR files don't appear to work.
* When playing music, allow to specify pictures to view.
* <s>Explore what more power we get from libdvdnav: choose audio tracks etc.</s> ALso, subtitle streams since C200 can display!
* Support [http://www.antp.be/software/moviecatalog ANT's Movie Database] .xml files.
** Difficult. ANT did weird things like put entire DB in one giant XML, with no references to the disk path.
* Support [http://www.movienizer.com Movienizer's Movie Database] .xml files.  Please provide sample .xml files for inspection.
* Remote skin support, e.g. invoke play from an iPhone or any other web enabled device.
* Apparently directories/files with "&" may not get a tick in the visited db. URL decoding?
* Make ticked directories become un-ticked when new files (unticked) files are added to the directory.
* Add NMJ sqlite DB support. Test MediaInfo source [http://www.lundman.net/ftp/test-mediainfo.c] is working.
* BUG: upnp missing filters/sortcriteria.


=== User guide and other documentation ===
00000000  4c 00 00 00 22 5b 91 94  6c 2f 9f 6e 37 20 a1 2e  |L..."[..l/.n7 ..|
00000010  8f 31 3c cd 61 59 d4 c4  53 aa 66 5b e6 00 ae 58  |.1<.aY..S.f[...X|
00000020  ee 3a 1a 92 0c e6 02 b3  22 8b 29 7c 50 9f 8e d0  |.:......".)|P...|
00000030  87 8a 91 09 32 a9 df df  68 0a 86 43 3d 7c 59 93  |....2...h..C=|Y.|
00000040  ce 85 27 59 56 bd 36 bf  76 8d 6d db 2d 72 6f 6d  |..'YV.6.v.m.-rom|
00000050  31 66 73 2d 00 53 18 f0  40 a7 b4 ad 53 50 4c 41  |1fs-.S..@...SPLA|
00000060  53 48 5f 42 4f 4f 54 00  00 00 00 00 00 00 00 49 |SH_BOOT........I|


Feel free to contribute to the wiki documentation:
If we cut out the first 76 bytes and mount it, we get:


* [[Llink:user_guide|User guide]] for functions.
-rw-r--r-- 1 root root  881252 Jan  1  1970 10xrpc_xload_audio_ucode_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
* [[Llink:Windows_installation|Installation guide]] for Windows.
-rw-r--r-- 1 root root  326500 Jan  1  1970 11xrpc_xload_video_ucode_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
* [[llink:Linux_installation|Installation guide]] for Linux.
-rw-r--r-- 1 root root  30724 Jan  1  1970 12xrpc_xload_demux_ucode_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
* [[llink:macros|Macros]] supported by the HTML engine in llink.
-rwxr-xr-x 1 root root    773 Jan  1  1970 30vsyncparam_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.zbf
* [[llink:Samples|Sample Files]] for configuring llink Jukebox xml.
-rwxr-xr-x 1 root root  34262 Jan  1  1970 31bitmap_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.zbf
* [[llink:Compiling|Compiling]] Guide for compiling, cross-compiling and compiling on Windows.
-rw-r--r-- 1 root root    6404 Jan  1  1970 32xrpc_xload_dviinit_prod.bin
-rw-r--r-- 1 root root  189524 Jan  1  1970 33xrpc_xload_irq_handler_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
-rw-r--r-- 1 root root 3975492 Jan  1  1970 50xrpc_xload_vmlinux_ES4_prod.bin
-rwxr-xr-x 1 root root      64 Jan  1  1970 dvi.bin


=== Download binaries ===
Definitely hardware boot. Loads the various microcodes for the Sigma 8635 chip, which personally I am not interested in. Lastly we appear to have the kernel itself at about 4Megs. However, all up, the whole thing is only '''5MB''' in size. So there is more in the first file '''after the romfs'''. One of the values in the header is probably an offset. The size of the romfs is '''roughly''' 5.2MB, or 00531c00 in hex. Romfs header has '''005318f0''', plus 76 bytes at a guess.


Note: if you are in luck, devices not listed here may share platform and architecture.
But romfs are padded up to nearest 1024. So the size will be '''00531c00''', plus 76 bytes. This becomes '''00531c4c'''.
Please report your success/failure.


* [[llink:windows|Windows]] 2.3.0 binaries for Windows OS
005318e0  00 00 00 00 00 00 00 40  39 20 28 88 64 76 69 2e  |.......@9 (.dvi.|
* [[llink:osx|OsX]] 2.3.1 binaries for Apple Macintosh Os X. App Store submitted.
005318f0  62 69 6e 00 00 00 00 00  00 00 00 00 00 00 00 00  |bin.............|
* [[llink:nmt|NMT]] 2.3.0 binaries for the Network Media Tank (Popcornhour A-100, C200 etc.) '''Please use CSI to install'''
00531900  01 00 00 00 00 00 64 00  72 00 00 00 02 00 00 00  |......d.r.......|
* [[llink:linux|Linux]] 2.3.0 binaries for Linux OS, Intel (add more if you can)
00531910  08 00 00 00 37 00 00 00  0c 00 00 00 89 00 00 00  |....7...........|
* [[llink:opensolaris|OpenSolaris]] 2.2.5 binaries for OpenSolaris (Solaris 11) OS, Intel
00531920  0f 00 00 00 04 00 00 00  33 00 00 00 30 00 00 00  |........3...0...|
* [[llink:readynas|ReadyNAS]] 2.2.2 binaries and instructions for Infrant/Netgear ReadyNAS
00531930  3e 00 00 00 00 00 00 00  03 fe 9b ff 00 00 00 00  |>...............|
* [[llink:synology|Synology]] 2.2.4 binaries and older, instructions for Synology NAS (ppc and arm)
00531940  00 00 00 00 00 00 00 00  00 00 00 00 '''00 00 00 00''' |................|
* [[llink:asus_wl-500gl|Asus WL-500GL]] binaries for Asus router running OpenWrt
00531c50  '''05 00 00 00 c0 7c 00 00  00 00 00 00 00 00 00 00'''  |.....|..........|
* [[llink:Asus WL-500g Premium|Asus WL-500g Premium]] binaries for Asus router running Oleg's firmware
00531c60  '''00 00 00 00 00 00 00 00  f4 80 00 00 04 00 ff 07'''  |................|
* [[llink:landisk|landisk]] binaries for IO-Data landisk uhdl-av, cpu-SH4
00531c70  '''d5 94 c5 33 40 8d 18 9e  17 41 5c e2 ad 49 9e 19'''  |...3@....A\..I..|
* "[[llink on a stick]]" let's you run llink from a USB stick or external USB drive (unmaintained)
00531c80  '''11 6b a1 d5 21 76 76 4e  10 60 40 9e 7a 1d 01 52'''  |.k..!vvN.`@.z..R|
* [[Llink:dlink_dns323|D-Link DNS-323]] binaries and instructions for D-Link NAS
00531c90  '''89 5f c7 3a 98 bc 7f ef  b5 fe fd fa 7b 36 0b 32''' |._.:........{6.2|
* [http://forum.excito.net/viewtopic.php?p=6195 Bubba server] 2.2.0 Linux compile instructions (no binaries)
00531ca0  '''7f 29 ba 91 91 85 2c 77  fe 4a 14 c8 cf 91 0c 34'''  |.)....,w.J.....4|
* [http://www.azboxworld.com/index.php?page=Thread&postID=66741#post66741 AzBox HD] 2.2.0 plugin binaries
00531cb0  '''5b 55 44 45 32 85 c7 9f  ed d0 26 d7 93 3d c7 b1'''  |[UDE2.....&..=..|
* [[llink:buffalo|Buffalo]] 2.2.3 binaries and instructions for Buffalo Linkstation (arm)
00531cc0  '''1a 7c 59 6b de db 10 c5  48 da 73 c7 6c a2 f1 0e'''  |.|Yk....H.s.l...|
* [[llink:Thecus|Thecus]] N5200-N0503 2.2.2 binaries (intel Atom)
* [[llink:qnap|QNAP]] 2.2.4 binaries for QNAP TS-109/209 series (arm)


''(Compilers, you can upload new versions directly in the wiki, see Synology page as example)''
It is not clear what this block contains but at offset '''00531c68''' we find the length, leading us to the next block at '''0053194c+000080f4'''.


=== Sources ===
Let us take a look at 01-15-071218-14-POP-402-000.bin:


* [[llink:sources|Sources]] Build your own for your platform. Includes autoconf for Unix and project files for Windows Visual Studio.
0051EC50  05 00 00 00  C0 7C 00 00  00 00 00 00  00 00 00 00  .....|..........
* libdvdcss sources are: [http://download.videolan.org/pub/libdvdcss/1.2.10/ libdvdcss-1.2.10.tar.gz]
0051EC60  00 00 00 00  00 00 00 00  '''F4 80 00 00'''  04 00 FF 07  ................
* [[llink:mime|mime.types]] defining MIME types, generally not needed, only if you use it with a browser.
0051EC70  D5 94 C5 33  40 8D 18 9E  17 41 5C E2  AD 49 9E 19  ...3@....A\..I..
* <s>libdvdnav sources are: [http://www.mplayerhq.hu/MPlayer/releases/dvdnav/ libdvdnav-4.1.2]</s> ''libdvdnav sources now included.''
* <s>libdvdread with MSVC++ Project files: [http://www.lundman.net/ftp/llink/libdvdread-0.9.7-win32.tar.gz</s>
* <s>libdvdread sources for llink v2.0.8 to 2.1.1 only are: [http://www.dtek.chalmers.se/groups/dvd/downloads.shtml libdvdread-0.9.7.tar.bz]</s>


=== Known issues ===
Next block is thus at '''0051ec50+0000f480''':


Although llink is capable of many things, there are limitations that should be known to users.
00526D40  E8 D2 C8 00  31 34 00 00  50 4F 50 00  34 30 32 00  ....14..POP.402.
Please read here for details: [[Llink:Known_issues]]
00526D50  EE DB 2F 12  00 00 00 00  00 00 00 00  00 00 00 00  ../.............
00526D60  1F 8B 08 00  BD D3 67 47  00 03 EC 9A  7B 9C 96 53  ......gG....{..S


=== Changelog ===
What we have at '''00526D60''' is a gzipped tar-image.


The [[llink:changelog|llink changelog]] contains the basic release notes history.
00526D40  E8 D2 C8 00  31 34 00 00  50 4F 50 00  34 30 32 00  ....14..POP.402.
00526D50  EE DB 2F 12  00 00 00 00  00 00 00 00  00 00 00 00  ../.............
00526D60  1F 8B 08 00  BD D3 67 47  00 03 EC 9A  7B 9C 96 53  ......gG....{..S
 
Unpack with <code>dd if=01-15-071218-14-POP-402-000.bin bs=5401952 skip=1|tar xzfv -</code>
 
At '''00526D50''' is the CRC of the filesystem. It can be calculated using the following code:
 
<pre>
      for(j = 0; j < length; j++) {
  unsigned int b = buffer[j]<<8;
  for(k=0; k<8; k++) {
    if((b ^ crc) & 0x8000) {
      crc = (crc << 1) ^ 0x1021;
    } else {
      crc <<= 1;
    }
    b <<= 1;
  }
      }
</pre>
 
If you read the kernel image itself (to find out what filesystems it supports), you will find it has the same header:
 
00000000  00 00 00 00 05 00 00 00  20 a6 3c 00 00 00 00 13  |........ .<.....|
00000010  02 00 00 00 03 00 00 00  04 00 00 00 44 a9 3c 00  |............D.<.|
00000020  0c 00 01 ff 97 80 fc f4  6b 69 38 93 ef 8a 6e cf  |........ki8...n.|
00000320  3c 0f e2 a6 46 4e 49 42  11 00 00 10 00 00 02 90  |<...FNIB........|
00000330  00 00 02 90 ac f6 e5 ba  00 00 03 02 f1 a5 3c 00  |..............<.|
00000340  00 00 00 00 1f 8b 08 08  26 a6 2a 47 02 03 76 6d  |........&.*G..vm|
00000350  6c 69 6e 75 78 2e 62 69  6e 00 ec 5b 0f 6c 1c 55  |linux.bin..[.l.U|
00000360  7a ff 76 76 76 bd 0e 1b  3c 76 36 61 43 02 d9 b1  |z.vvv...<v6aC...|
 
 
Indeed all files inside the romfs has this header. Could just mean they are signed. It is interesting that the filename is there is plain-text.
 
The '''syb8634.nmt''' contains a gzipped tarball, which can be extracted with
 
dd if=syb8634.nmt skip=1 bs=60 | tar -xzvf -
 
=== 50xrpc_xload_vmlinux_ES4_prod.bin ===
 
The kernel resides in this file and to unpack we can do:
dd if=50xrpc_xload_vmlinux_ES4_prod.bin skip=1 bs=836 |zcat >vmlinux.bin
 
This image also contains the initial ramdisk which can be extracted to cwd with:
dd if=vmlinux.bin skip=1 bs=4399104|zcat|cpio -id --no-absolute-filenames
 
=== fw_image ===
 
The tool '''fw_image''' that is on the platform, has extern references to '''des3_decrypt_block''', so that makes me think it uses des3 on the image, it also has the CRC functions for each part, before flashing them to '''/dev/mtd*'''
 
The function '''des3_decrypt_block''' is found in /lib/libdes.so.1.0.0 and confirmed to be a standard 3des (at least it is compatible with the one in OpenSSL).
 
The function prototype looks like this:
extern void des3_decrypt_block(void *data, int size, uint8_t *key);
 
The key has a length of 16 bytes and includes parity bits. The data buffer serves as both input and output.
 
This makes me confident that I can find the decryption keys should I need to. I have no interest in doing so at this time, I only wanted to know I had the option should Syabas decide to attempt to plug the hole that lets me have root. So even if they did so now, I believe I have all the information needed to decrypt any future firmware (yes, even if they change it in future).
 
 
=== Other firmwares ===
 
Pull out anything starting with '''gzip''' header from a binary file:
 
perl -e '$file="test" ; $A=`cat $file` ; while ($A =~ /\x1f\x8b\x08/g) { $pos = length $`; $pos += 0; printf "%X\n", $pos; system("dd if=$file  of=2test.$pos.gz bs=$pos skip=1 > /dev/null 2>&1 "); system("gunzip -c 2test.$pos.gz > 2test.$pos")};'
 
You can then run '''file test.*''' to see interesting things, in particular tarball rootfs, and kernels.

Latest revision as of 03:57, 16 October 2011

Network Media Tank Firmware

I downloaded a random version of the firmware, which looks like:

-rw-rw-r--  1 lundman lundman  32380583 Nov  8 00:58 01-13-071101-13-POP-402.zip


32Megs compressed. Inside that we have:

-rw-rw-r-- 1 lundman lundman 17970150 Nov  2 11:11 01-13-071101-13-POP-402-000.bin
-rw-rw-r-- 1 lundman lundman      723 Nov  7 23:32 README.txt
-rw-rw-r-- 1 lundman lundman 14536029 Nov  7 15:44 syb8634.nmt
-rw-rw-r-- 1 lundman lundman      108 Nov  2 22:27 usbupdate.html

Looking at the large 01-13-071101-13-POP-402-000.bin file first, we notice that it has a 76 bytes header.

It is a 3des encrypted header which contains information about the image. The first 4 bytes contains the length of the header and should match 76. Next we have the size of the flash counted in DWORDS and next we have the number of blocks. It also includes a CRC and for each block we have an ASCII description of the block type followed by the length. The header ends with a couple of version strings. A small program parsing and decrypting the header gives the following:

Flash size is 33554432? and number of blocks is 3
Block 1 type: ker, length 5368832
Block 2 type: xos, length 33012
Block 3 type: app, length 13161224
Version 1: xPe0t2, Version 2: c402dPOPk14

The first block is a romfs called SPLASH_BOOT.

00000000  4c 00 00 00 22 5b 91 94  6c 2f 9f 6e 37 20 a1 2e  |L..."[..l/.n7 ..|
00000010  8f 31 3c cd 61 59 d4 c4  53 aa 66 5b e6 00 ae 58  |.1<.aY..S.f[...X|
00000020  ee 3a 1a 92 0c e6 02 b3  22 8b 29 7c 50 9f 8e d0  |.:......".)|P...|
00000030  87 8a 91 09 32 a9 df df  68 0a 86 43 3d 7c 59 93  |....2...h..C=|Y.|
00000040  ce 85 27 59 56 bd 36 bf  76 8d 6d db 2d 72 6f 6d  |..'YV.6.v.m.-rom|
00000050  31 66 73 2d 00 53 18 f0  40 a7 b4 ad 53 50 4c 41  |1fs-.S..@...SPLA|
00000060  53 48 5f 42 4f 4f 54 00  00 00 00 00 00 00 00 49  |SH_BOOT........I|

If we cut out the first 76 bytes and mount it, we get:

-rw-r--r-- 1 root root  881252 Jan  1  1970 10xrpc_xload_audio_ucode_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
-rw-r--r-- 1 root root  326500 Jan  1  1970 11xrpc_xload_video_ucode_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
-rw-r--r-- 1 root root   30724 Jan  1  1970 12xrpc_xload_demux_ucode_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
-rwxr-xr-x 1 root root     773 Jan  1  1970 30vsyncparam_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.zbf
-rwxr-xr-x 1 root root   34262 Jan  1  1970 31bitmap_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.zbf
-rw-r--r-- 1 root root    6404 Jan  1  1970 32xrpc_xload_dviinit_prod.bin
-rw-r--r-- 1 root root  189524 Jan  1  1970 33xrpc_xload_irq_handler_SMP8634_2.7.176sybs1.7972x_GCC4_facsprod.bin
-rw-r--r-- 1 root root 3975492 Jan  1  1970 50xrpc_xload_vmlinux_ES4_prod.bin
-rwxr-xr-x 1 root root      64 Jan  1  1970 dvi.bin

Definitely hardware boot. Loads the various microcodes for the Sigma 8635 chip, which personally I am not interested in. Lastly we appear to have the kernel itself at about 4Megs. However, all up, the whole thing is only 5MB in size. So there is more in the first file after the romfs. One of the values in the header is probably an offset. The size of the romfs is roughly 5.2MB, or 00531c00 in hex. Romfs header has 005318f0, plus 76 bytes at a guess.

But romfs are padded up to nearest 1024. So the size will be 00531c00, plus 76 bytes. This becomes 00531c4c.

005318e0  00 00 00 00 00 00 00 40  39 20 28 88 64 76 69 2e  |.......@9 (.dvi.|
005318f0  62 69 6e 00 00 00 00 00  00 00 00 00 00 00 00 00  |bin.............|
00531900  01 00 00 00 00 00 64 00  72 00 00 00 02 00 00 00  |......d.r.......|
00531910  08 00 00 00 37 00 00 00  0c 00 00 00 89 00 00 00  |....7...........|
00531920  0f 00 00 00 04 00 00 00  33 00 00 00 30 00 00 00  |........3...0...|
00531930  3e 00 00 00 00 00 00 00  03 fe 9b ff 00 00 00 00  |>...............|
00531940  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00531c50  05 00 00 00 c0 7c 00 00  00 00 00 00 00 00 00 00  |.....|..........|
00531c60  00 00 00 00 00 00 00 00  f4 80 00 00 04 00 ff 07  |................|
00531c70  d5 94 c5 33 40 8d 18 9e  17 41 5c e2 ad 49 9e 19  |...3@....A\..I..|
00531c80  11 6b a1 d5 21 76 76 4e  10 60 40 9e 7a 1d 01 52  |.k..!vvN.`@.z..R|
00531c90  89 5f c7 3a 98 bc 7f ef  b5 fe fd fa 7b 36 0b 32  |._.:........{6.2|
00531ca0  7f 29 ba 91 91 85 2c 77  fe 4a 14 c8 cf 91 0c 34  |.)....,w.J.....4|
00531cb0  5b 55 44 45 32 85 c7 9f  ed d0 26 d7 93 3d c7 b1  |[UDE2.....&..=..|
00531cc0  1a 7c 59 6b de db 10 c5  48 da 73 c7 6c a2 f1 0e  |.|Yk....H.s.l...|

It is not clear what this block contains but at offset 00531c68 we find the length, leading us to the next block at 0053194c+000080f4.

Let us take a look at 01-15-071218-14-POP-402-000.bin:

0051EC50   05 00 00 00  C0 7C 00 00  00 00 00 00  00 00 00 00  .....|..........
0051EC60   00 00 00 00  00 00 00 00  F4 80 00 00  04 00 FF 07  ................
0051EC70   D5 94 C5 33  40 8D 18 9E  17 41 5C E2  AD 49 9E 19  ...3@....A\..I..

Next block is thus at 0051ec50+0000f480:

00526D40   E8 D2 C8 00  31 34 00 00  50 4F 50 00  34 30 32 00  ....14..POP.402.
00526D50   EE DB 2F 12  00 00 00 00  00 00 00 00  00 00 00 00  ../.............
00526D60   1F 8B 08 00  BD D3 67 47  00 03 EC 9A  7B 9C 96 53  ......gG....{..S

What we have at 00526D60 is a gzipped tar-image.

00526D40   E8 D2 C8 00  31 34 00 00  50 4F 50 00  34 30 32 00  ....14..POP.402.
00526D50   EE DB 2F 12  00 00 00 00  00 00 00 00  00 00 00 00  ../.............
00526D60   1F 8B 08 00  BD D3 67 47  00 03 EC 9A  7B 9C 96 53  ......gG....{..S

Unpack with dd if=01-15-071218-14-POP-402-000.bin bs=5401952 skip=1|tar xzfv -

At 00526D50 is the CRC of the filesystem. It can be calculated using the following code:

      for(j = 0; j < length; j++) {
	  unsigned int b = buffer[j]<<8;
	  for(k=0; k<8; k++) {
	    if((b ^ crc) & 0x8000) {
	      crc = (crc << 1) ^ 0x1021;
	    } else {
	      crc <<= 1;
	    }
	    b <<= 1;
	  }
      }

If you read the kernel image itself (to find out what filesystems it supports), you will find it has the same header:

00000000  00 00 00 00 05 00 00 00  20 a6 3c 00 00 00 00 13  |........ .<.....|
00000010  02 00 00 00 03 00 00 00  04 00 00 00 44 a9 3c 00  |............D.<.|
00000020  0c 00 01 ff 97 80 fc f4  6b 69 38 93 ef 8a 6e cf  |........ki8...n.|

00000320  3c 0f e2 a6 46 4e 49 42  11 00 00 10 00 00 02 90  |<...FNIB........|
00000330  00 00 02 90 ac f6 e5 ba  00 00 03 02 f1 a5 3c 00  |..............<.|
00000340  00 00 00 00 1f 8b 08 08  26 a6 2a 47 02 03 76 6d  |........&.*G..vm|
00000350  6c 69 6e 75 78 2e 62 69  6e 00 ec 5b 0f 6c 1c 55  |linux.bin..[.l.U|
00000360  7a ff 76 76 76 bd 0e 1b  3c 76 36 61 43 02 d9 b1  |z.vvv...<v6aC...|


Indeed all files inside the romfs has this header. Could just mean they are signed. It is interesting that the filename is there is plain-text.

The syb8634.nmt contains a gzipped tarball, which can be extracted with

dd if=syb8634.nmt skip=1 bs=60 | tar -xzvf -

50xrpc_xload_vmlinux_ES4_prod.bin

The kernel resides in this file and to unpack we can do:

dd if=50xrpc_xload_vmlinux_ES4_prod.bin skip=1 bs=836 |zcat >vmlinux.bin

This image also contains the initial ramdisk which can be extracted to cwd with:

dd if=vmlinux.bin skip=1 bs=4399104|zcat|cpio -id --no-absolute-filenames

fw_image

The tool fw_image that is on the platform, has extern references to des3_decrypt_block, so that makes me think it uses des3 on the image, it also has the CRC functions for each part, before flashing them to /dev/mtd*

The function des3_decrypt_block is found in /lib/libdes.so.1.0.0 and confirmed to be a standard 3des (at least it is compatible with the one in OpenSSL).

The function prototype looks like this:

extern void des3_decrypt_block(void *data, int size, uint8_t *key);

The key has a length of 16 bytes and includes parity bits. The data buffer serves as both input and output.

This makes me confident that I can find the decryption keys should I need to. I have no interest in doing so at this time, I only wanted to know I had the option should Syabas decide to attempt to plug the hole that lets me have root. So even if they did so now, I believe I have all the information needed to decrypt any future firmware (yes, even if they change it in future).


Other firmwares

Pull out anything starting with gzip header from a binary file:

perl -e '$file="test" ; $A=`cat $file` ; while ($A =~ /\x1f\x8b\x08/g) { $pos = length $`; $pos += 0; printf "%X\n", $pos; system("dd if=$file  of=2test.$pos.gz bs=$pos skip=1 > /dev/null 2>&1 "); system("gunzip -c 2test.$pos.gz > 2test.$pos")};'

You can then run file test.* to see interesting things, in particular tarball rootfs, and kernels.