Trendnet TEW-671BR firmware support

Started by dj__silver, January 03, 2013, 10:30:35 AM

Previous topic - Next topic

dj__silver

Is it possible to add support for TEW-671BR firmware in Firmware Modification Kit?
I've tried to extract firmware, but it returned me some errors saying that firmware image format isn't compatibile
Here are these errors:

Extracting TEW-671BR-APPS-V1-2-6-5.dlf to 1 ...
Error: filesystem not extracted properly.
firmware image format not compatible?

Extracting TEW-671BR-KNL-V1-2-6-6.dlf to 2 ...
Error: filesystem not extracted properly.
firmware image format not compatible?

There are some sources on http://www.trendnet.com/downloads/list_subcategory.asp?SUBTYPE_ID=1344 for this device

Jeremy Collake

Probably nobody has added support for that firmware image type. Whether anyone will, who knows. Submit as a ticket on the Google Code project site.
Software Engineer. Bitsum LLC.

dj__silver

Thanks for reply anyway.
I've created new issue:
http://code.google.com/p/firmware-mod-kit/issues/detail?id=83
What is the difference between Accepted and Started in status ??

Jeremy Collake

Accepted means someone intends to start it. Started means they actually have.
Software Engineer. Bitsum LLC.

dj__silver

  The TEW-671BR firmware cannot be extracted by Firmware Mod Kit because of 2 reasons.

1) Most importantly because of firmware files are encoded by unknown encoding algorithm
2) Firmware comes in 2 files, one with apps and another with kernel.

However what is most important and leading for my success in case of firmware extraction possibility is that the encoding
algorithm is simple enought that I was able figure out the most important part of how it works through reverse engineering
on about 250 diffrent ruter settings backup files which are also encoded same way as firmware image files. I said "the most
important part" because I don't exactly know how headers of these ancoded files are constructed(probably first 96 bytes),
but encoding is simple - original byte at given offset is mapped to some other byte. Byte at offset X ancodes axactly the
same as byte at offset Y if X % 8 == Y % 8, where X and Y are offsets in encoded files. Based on that fact I've written
little app for files decoding. Source of this decoder is at end of this post. I'm not sure if it'll compile with linux -
I'm not advanced programmer, just write only some little apps for windows only. However if it doesn't compile with linux
then it's very easy to modify code that it will. Using this app I converted TEW-671BR-APPS-V1-2-6-5.dlf file to app.bin file
and TEW-671BR-KNL-V1-2-6-6.dlf to knl.bin file.
Below is what I was able to do.

bash-4.2# binwalk app.bin

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
96              0x60            Squashfs filesystem, little endian, non-standard signature,  version 3.0, size: 2651422 bytes, 161 inodes, blocksize: 65536 bytes, created: Thu Dec 15 03:22:50 2011

bash-4.2#

*****************************************************************************************************************************

// after I delete first 96 bytes and write to app(1).bin file

bash-4.2# binwalk app\(1\).bin

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
0               0x0             Squashfs filesystem, little endian, non-standard signature,  version 3.0, size: 2651422 bytes, 161 inodes, blocksize: 65536 bytes, created: Thu Dec 15 03:22:50 2011

bash-4.2#

*****************************************************************************************************************************

// now I can extract files

bash-4.2# ./unsquashfs_all.sh app\(1\).bin 1
Attempting to extract SquashFS 3.X file system...

Skipping squashfs-2.1-r2 (wrong version)...

Trying ./src/squashfs-3.0/unsquashfs...
Trying ./src/squashfs-3.0/unsquashfs-lzma...
Trying ./src/squashfs-3.0-lzma-damn-small-variant/unsquashfs-lzma... Skipping others/squashfs-2.0-nb4 (wrong version)...

Trying ./src/others/squashfs-3.0-e2100/unsquashfs...
Trying ./src/others/squashfs-3.0-e2100/unsquashfs-lzma...
Trying ./src/others/squashfs-3.2-r2/unsquashfs...
Trying ./src/others/squashfs-3.2-r2-lzma/squashfs3.2-r2/squashfs-tools/unsquashfs...
created 120 files
created 27 directories
created 14 symlinks
created 0 devices
created 0 fifos
File system sucessfully extracted!
MKFS="./src/others/squashfs-3.2-r2-lzma/squashfs3.2-r2/squashfs-tools/mksquashfs"
bash-4.2#

*****************************************************************************************************************************
*****************************************************************************************************************************
bash-4.2# binwalk knl.bin

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
96              0x60            uImage header, header size: 64 bytes, header CRC: 0x461B2D3D, created: Thu Dec 15 03:21:34 2011, image size: 1017939 bytes, Data Address: 0x80000000, Entry Point: 0x80222000, data CRC: 0x98D1A6BD, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: Linux Kernel Image
160             0xA0            LZMA compressed data (sig 2), properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 2660383 bytes

bash-4.2#

*****************************************************************************************************************************

// after I delete first 96 bytes and write to knl(1).bin file

bash-4.2# binwalk knl\(1\).bin

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
0               0x0             uImage header, header size: 64 bytes, header CRC: 0x461B2D3D, created: Thu Dec 15 03:21:34 2011, image size: 1017939 bytes, Data Address: 0x80000000, Entry Point: 0x80222000, data CRC: 0x98D1A6BD, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: Linux Kernel Image
64              0x40            LZMA compressed data (sig 2), properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 2660383 bytes

bash-4.2#

*****************************************************************************************************************************

bash-4.2# ./unsquashfs_all.sh knl\(1\).bin 2
Attempting to extract SquashFS 0                0x0             uImage header, header size: 64 bytes, header CRC: 0x461B2D3D, created: Thu Dec 15 03:21:34 2011, image size: 1017939 bytes, Data Address: 0x80000000, Entry Point: 0x80222000, data CRC: 0x98D1A6BD, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: Linux Kernel Image.X file system...

Skipping squashfs-2.1-r2 (wrong version)...
Skipping squashfs-3.0 (wrong version)...
Skipping squashfs-3.0-lzma-damn-small-variant (wrong version)...
Skipping others/squashfs-2.0-nb4 (wrong version)...
Skipping others/squashfs-3.0-e2100 (wrong version)...
Skipping others/squashfs-3.2-r2 (wrong version)...
Skipping others/squashfs-3.2-r2-lzma (wrong version)...
Skipping others/squashfs-3.2-r2-lzma/squashfs3.2-r2/squashfs-tools (wrong version)...
Skipping others/squashfs-3.2-r2-hg612-lzma (wrong version)...
Skipping others/squashfs-3.2-r2-wnr1000 (wrong version)...
Skipping others/squashfs-3.2-r2-rtn12 (wrong version)...
Skipping others/squashfs-3.3 (wrong version)...
Skipping others/squashfs-3.3-lzma/squashfs3.3/squashfs-tools (wrong version)...
Skipping others/squashfs-3.3-grml-lzma/squashfs3.3/squashfs-tools (wrong version)...
Skipping others/squashfs-3.4-cisco (wrong version)...
Skipping others/squashfs-3.4-nb4 (wrong version)...
Skipping others/squashfs-4.2-official (wrong version)...
Skipping others/squashfs-4.2 (wrong version)...
Skipping others/squashfs-4.0-lzma (wrong version)...
Skipping others/squashfs-4.0-realtek (wrong version)...
Skipping others/squashfs-hg55x-bin (wrong version)...
File extraction failed!
bash-4.2#

*****************************************************************************************************************************

bash-4.2# ./extract_firmware.sh knl\(1\).bin 2

Firmware Mod Kit (extract) v0.78 beta, (c)2010-2012 Jeremy Collake, - Newer NG edition by Craig Heffner
Checking for updates ...
  ! WARNING: Could not check for update. No connectivity or server down?
LINUX system detected. Compatibility ok.
Testing file system of 2 ...
Building tools ...
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for size_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for memset... yes
checking for malloc... yes
checking for strstr... yes
checking for crc32 in -lz... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking lzma.h usability... yes
checking lzma.h presence... yes
checking for lzma.h... yes
configure: creating ./config.status
config.status: creating Makefile
/temp/firmware_mod_kit/firmware-mod-kit-read-only
Build seems successful.
Preparing working directory ...
Removing any previous files ...
Creating directories ...
Extracting firmware
! untrx failed, trying splitter3
Not recognized by splitter3
Attempting raw linux style firmware package (i.e. TEW-632BRP) ...
Extracting knl(1).bin to 2 ...
Error: filesystem not extracted properly.
  firmware image format not compatible?
bash-4.2#

*****************************************************************************************************************************

bash-4.2# binwalk knl\(1\).bin

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
0               0x0             uImage header, header size: 64 bytes, header CRC: 0x461B2D3D, created: Thu Dec 15 03:21:34 2011, image size: 1017939 bytes, Data Address: 0x80000000, Entry Point: 0x80222000, data CRC: 0x98D1A6BD, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: Linux Kernel Image
64              0x40            LZMA compressed data (sig 2), properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 2660383 bytes

bash-4.2#

*****************************************************************************************************************************

// after I delete uImage header from the file(first 64 bytes) and write to knl(2).lzma file

bash-4.2# binwalk knl\(2\).lzma

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
0               0x0             LZMA compressed data (sig 2), properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 2660383 bytes

bash-4.2#

*****************************************************************************************************************************

// now I can extract commprassed Image to knl(2) file. After extraction it rally takes 2660383 bytes as binwalk says

bash-4.2# binwalk knl\(2\)

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
408111          0x63A2F         88K BCS executable
1156823         0x11A6D7        mc68k executable (shared) not stripped
1649235         0x192A53        mc68k executable (shared) not stripped
2058328         0x1F6858        ASCII cpio archive (pre-SVR4 or odc)
2058336         0x1F6860        ASCII cpio archive (SVR4 with no CRC)
2241543         0x223407        88K BCS executable
2241883         0x22355B        88K BCS executable
2255523         0x226AA3        88K BCS executable
2255863         0x226BF7        88K BCS executable
2359296         0x240000        LZMA compressed data (sig 2), properties: 0x5D, dictionary size: 1048576 bytes, uncompressed size: 1118720 bytes

bash-4.2#

*****************************************************************************************************************************

// after I delete first 2359296 bytes from knl(2) file and write to knl(3).lzma

bash-4.2# binwalk knl\(3\).lzma

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
0               0x0             LZMA compressed data (sig 2), properties: 0x5D, dictionary size: 1048576 bytes, uncompressed size: 1118720 bytes

bash-4.2#

*****************************************************************************************************************************

// now I can extract commprassed Image to knl(3) file. After extraction it rally takes 1118720 bytes as binwalk says
// It's an archive

bash-4.2# binwalk knl\(3\)

DECIMAL         HEX             DESCRIPTION
-------------------------------------------------------------------------------------------------------
0               0x0             ASCII cpio archive (SVR4 with no CRC)
116             0x74            ASCII cpio archive (SVR4 with no CRC)
232             0xE8            ASCII cpio archive (SVR4 with no CRC)
360             0x168           ASCII cpio archive (SVR4 with no CRC)
476             0x1DC           ASCII cpio archive (SVR4 with no CRC)
604             0x25C           ASCII cpio archive (SVR4 with no CRC)
732             0x2DC           ASCII cpio archive (SVR4 with no CRC)
860             0x35C           ASCII cpio archive (SVR4 with no CRC)
988             0x3DC           ASCII cpio archive (SVR4 with no CRC)
1116            0x45C           ASCII cpio archive (SVR4 with no CRC)
1248            0x4E0           ASCII cpio archive (SVR4 with no CRC)
1376            0x560           ASCII cpio archive (SVR4 with no CRC)
1508            0x5E4           ASCII cpio archive (SVR4 with no CRC)
1640            0x668           ASCII cpio archive (SVR4 with no CRC)
1768            0x6E8           ASCII cpio archive (SVR4 with no CRC)
1900            0x76C           ASCII cpio archive (SVR4 with no CRC)
2028            0x7EC           ASCII cpio archive (SVR4 with no CRC)
2156            0x86C           ASCII cpio archive (SVR4 with no CRC)
2288            0x8F0           ASCII cpio archive (SVR4 with no CRC)
2420            0x974           ASCII cpio archive (SVR4 with no CRC)
2548            0x9F4           ASCII cpio archive (SVR4 with no CRC)
2672            0xA70           ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
338868          0x52BB4         ASCII cpio archive (SVR4 with no CRC)
339000          0x52C38         ASCII cpio archive (SVR4 with no CRC)
339128          0x52CB8         ASCII cpio archive (SVR4 with no CRC)
339260          0x52D3C         ASCII cpio archive (SVR4 with no CRC)
339388          0x52DBC         ASCII cpio archive (SVR4 with no CRC)
339516          0x52E3C         ASCII cpio archive (SVR4 with no CRC)
339644          0x52EBC         ASCII cpio archive (SVR4 with no CRC)
339772          0x52F3C         ASCII cpio archive (SVR4 with no CRC)
339900          0x52FBC         ASCII cpio archive (SVR4 with no CRC)
340032          0x53040         ASCII cpio archive (SVR4 with no CRC)
340160          0x530C0         ASCII cpio archive (SVR4 with no CRC)
340288          0x53140         ASCII cpio archive (SVR4 with no CRC)
340420          0x531C4         ASCII cpio archive (SVR4 with no CRC)
340548          0x53244         ASCII cpio archive (SVR4 with no CRC)
340676          0x532C4         ASCII cpio archive (SVR4 with no CRC)
340804          0x53344         ASCII cpio archive (SVR4 with no CRC)
340920          0x533B8         ASCII cpio archive (SVR4 with no CRC)
341212          0x534DC         ASCII cpio archive (SVR4 with no CRC)
341336          0x53558         ASCII cpio archive (SVR4 with no CRC)
341472          0x535E0         ASCII cpio archive (SVR4 with no CRC)
341604          0x53664         ASCII cpio archive (SVR4 with no CRC)
341736          0x536E8         ASCII cpio archive (SVR4 with no CRC)
342192          0x538B0         ASCII cpio archive (SVR4 with no CRC)
342352          0x53950         ASCII cpio archive (SVR4 with no CRC)
342472          0x539C8         ASCII cpio archive (SVR4 with no CRC)
342684          0x53A9C         ASCII cpio archive (SVR4 with no CRC)
342804          0x53B14         ASCII cpio archive (SVR4 with no CRC)
342932          0x53B94         ASCII cpio archive (SVR4 with no CRC)
343048          0x53C08         ASCII cpio archive (SVR4 with no CRC)
343168          0x53C80         ASCII cpio archive (SVR4 with no CRC)
343180          0x53C8C         ReiserFS filesystem V3.5
343192          0x53C98         ReiserFS filesystem V3.6
343204          0x53CA4         ReiserFS filesystem V3.6.19 block size 29253 num blocks 1768693818
343284          0x53CF4         ASCII cpio archive (SVR4 with no CRC)
343408          0x53D70         ASCII cpio archive (SVR4 with no CRC)
343532          0x53DEC         ASCII cpio archive (SVR4 with no CRC)
343660          0x53E6C         ASCII cpio archive (SVR4 with no CRC)
343780          0x53EE4         ASCII cpio archive (SVR4 with no CRC)
343900          0x53F5C         ASCII cpio archive (SVR4 with no CRC)
344020          0x53FD4         ASCII cpio archive (SVR4 with no CRC)
344148          0x54054         ASCII cpio archive (SVR4 with no CRC)
344276          0x540D4         ASCII cpio archive (SVR4 with no CRC)
344400          0x54150         ASCII cpio archive (SVR4 with no CRC)
344520          0x541C8         ASCII cpio archive (SVR4 with no CRC)
344648          0x54248         ASCII cpio archive (SVR4 with no CRC)
344772          0x542C4         ASCII cpio archive (SVR4 with no CRC)
344900          0x54344         ASCII cpio archive (SVR4 with no CRC)
345024          0x543C0         ASCII cpio archive (SVR4 with no CRC)
345144          0x54438         ASCII cpio archive (SVR4 with no CRC)
345268          0x544B4         ASCII cpio archive (SVR4 with no CRC)
345388          0x5452C         ASCII cpio archive (SVR4 with no CRC)
345508          0x545A4         ASCII cpio archive (SVR4 with no CRC)
345632          0x54620         ASCII cpio archive (SVR4 with no CRC)
345752          0x54698         ASCII cpio archive (SVR4 with no CRC)
345872          0x54710         ASCII cpio archive (SVR4 with no CRC)
345996          0x5478C         ASCII cpio archive (SVR4 with no CRC)
346120          0x54808         ASCII cpio archive (SVR4 with no CRC)
346240          0x54880         ASCII cpio archive (SVR4 with no CRC)
346364          0x548FC         ASCII cpio archive (SVR4 with no CRC)
346492          0x5497C         ASCII cpio archive (SVR4 with no CRC)
346616          0x549F8         ASCII cpio archive (SVR4 with no CRC)
346736          0x54A70         ASCII cpio archive (SVR4 with no CRC)
346864          0x54AF0         ASCII cpio archive (SVR4 with no CRC)
346984          0x54B68         ASCII cpio archive (SVR4 with no CRC)
347108          0x54BE4         ASCII cpio archive (SVR4 with no CRC)
347232          0x54C60         ASCII cpio archive (SVR4 with no CRC)
347360          0x54CE0         ASCII cpio archive (SVR4 with no CRC)
347484          0x54D5C         ASCII cpio archive (SVR4 with no CRC)
347608          0x54DD8         ASCII cpio archive (SVR4 with no CRC)
347732          0x54E54         ASCII cpio archive (SVR4 with no CRC)
347860          0x54ED4         ASCII cpio archive (SVR4 with no CRC)
347988          0x54F54         ASCII cpio archive (SVR4 with no CRC)
348108          0x54FCC         ASCII cpio archive (SVR4 with no CRC)
348236          0x5504C         ASCII cpio archive (SVR4 with no CRC)
348356          0x550C4         ASCII cpio archive (SVR4 with no CRC)
348484          0x55144         ASCII cpio archive (SVR4 with no CRC)
348604          0x551BC         ASCII cpio archive (SVR4 with no CRC)
348728          0x55238         ASCII cpio archive (SVR4 with no CRC)
348852          0x552B4         ASCII cpio archive (SVR4 with no CRC)
348976          0x55330         ASCII cpio archive (SVR4 with no CRC)
349100          0x553AC         ASCII cpio archive (SVR4 with no CRC)
349224          0x55428         ASCII cpio archive (SVR4 with no CRC)
349348          0x554A4         ASCII cpio archive (SVR4 with no CRC)
349468          0x5551C         ASCII cpio archive (SVR4 with no CRC)
349596          0x5559C         ASCII cpio archive (SVR4 with no CRC)
349716          0x55614         ASCII cpio archive (SVR4 with no CRC)
349836          0x5568C         ASCII cpio archive (SVR4 with no CRC)
349956          0x55704         ASCII cpio archive (SVR4 with no CRC)
350076          0x5577C         ASCII cpio archive (SVR4 with no CRC)
350204          0x557FC         ASCII cpio archive (SVR4 with no CRC)
350332          0x5587C         ASCII cpio archive (SVR4 with no CRC)
350452          0x558F4         ASCII cpio archive (SVR4 with no CRC)
350572          0x5596C         ASCII cpio archive (SVR4 with no CRC)
350692          0x559E4         ASCII cpio archive (SVR4 with no CRC)
350812          0x55A5C         ASCII cpio archive (SVR4 with no CRC)
350932          0x55AD4         ASCII cpio archive (SVR4 with no CRC)
351052          0x55B4C         ASCII cpio archive (SVR4 with no CRC)
351180          0x55BCC         ASCII cpio archive (SVR4 with no CRC)
351308          0x55C4C         ASCII cpio archive (SVR4 with no CRC)
351428          0x55CC4         ASCII cpio archive (SVR4 with no CRC)
351548          0x55D3C         ASCII cpio archive (SVR4 with no CRC)
351668          0x55DB4         ASCII cpio archive (SVR4 with no CRC)
351796          0x55E34         ASCII cpio archive (SVR4 with no CRC)
351924          0x55EB4         ASCII cpio archive (SVR4 with no CRC)
352044          0x55F2C         ASCII cpio archive (SVR4 with no CRC)
352168          0x55FA8         ASCII cpio archive (SVR4 with no CRC)
352288          0x56020         ASCII cpio archive (SVR4 with no CRC)
352408          0x56098         ASCII cpio archive (SVR4 with no CRC)
352528          0x56110         ASCII cpio archive (SVR4 with no CRC)
352644          0x56184         ASCII cpio archive (SVR4 with no CRC)
352776          0x56208         ASCII cpio archive (SVR4 with no CRC)
352912          0x56290         ASCII cpio archive (SVR4 with no CRC)
353028          0x56304         ASCII cpio archive (SVR4 with no CRC)
353168          0x56390         ASCII cpio archive (SVR4 with no CRC)
353292          0x5640C         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
409412          0x63F44         romfs filesystem, version 1 size: 0 bytes, named t: error while guessing filesystem type.
416932          0x65CA4         ASCII cpio archive (SVR4 with no CRC)
417068          0x65D2C         ASCII cpio archive (SVR4 with no CRC)
417948          0x6609C         ASCII cpio archive (SVR4 with no CRC)
418072          0x66118         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
427852          0x6874C         ASCII cpio archive (SVR4 with no CRC)
428672          0x68A80         ASCII cpio archive (SVR4 with no CRC)
428800          0x68B00         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
438708          0x6B1B4         ASCII cpio archive (SVR4 with no CRC)
438836          0x6B234         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
448932          0x6D9A4         ASCII cpio archive (SVR4 with no CRC)
449072          0x6DA30         ASCII cpio archive (SVR4 with no CRC)
449196          0x6DAAC         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
535800          0x82CF8         ASCII cpio archive (SVR4 with no CRC)
535940          0x82D84         ASCII cpio archive (SVR4 with no CRC)
536084          0x82E14         ASCII cpio archive (SVR4 with no CRC)
536224          0x82EA0         ASCII cpio archive (SVR4 with no CRC)
536452          0x82F84         ASCII cpio archive (SVR4 with no CRC)
536576          0x83000         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
546448          0x85690         ASCII cpio archive (SVR4 with no CRC)
546588          0x8571C         ASCII cpio archive (SVR4 with no CRC)
546712          0x85798         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
579132          0x8D63C         ASCII cpio archive (SVR4 with no CRC)
579256          0x8D6B8         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
589260          0x8FDCC         ASCII cpio archive (SVR4 with no CRC)
589384          0x8FE48         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
603536          0x93590         ASCII cpio archive (SVR4 with no CRC)
603664          0x93610         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
613520          0x95C90         ASCII cpio archive (SVR4 with no CRC)
613712          0x95D50         ASCII cpio archive (SVR4 with no CRC)
613852          0x95DDC         ASCII cpio archive (SVR4 with no CRC)
613980          0x95E5C         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
636744          0x9B748         ASCII cpio archive (SVR4 with no CRC)
636868          0x9B7C4         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
650980          0x9EEE4         ASCII cpio archive (SVR4 with no CRC)
651108          0x9EF64         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
673916          0xA487C         ASCII cpio archive (SVR4 with no CRC)
674060          0xA490C         ASCII cpio archive (SVR4 with no CRC)
674224          0xA49B0         ASCII cpio archive (SVR4 with no CRC)
674364          0xA4A3C         ASCII cpio archive (SVR4 with no CRC)
674492          0xA4ABC         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
697160          0xAA348         ASCII cpio archive (SVR4 with no CRC)
697300          0xAA3D4         ASCII cpio archive (SVR4 with no CRC)
697440          0xAA460         ASCII cpio archive (SVR4 with no CRC)
697580          0xAA4EC         ASCII cpio archive (SVR4 with no CRC)
697704          0xAA568         ELF new 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)
703264          0xABB20         ASCII cpio archive (SVR4 with no CRC)
703452          0xABBDC         ASCII cpio archive (SVR4 with no CRC)
703592          0xABC68         ASCII cpio archive (SVR4 with no CRC)
703732          0xABCF4         ASCII cpio archive (SVR4 with no CRC)
703956          0xABDD4         ASCII cpio archive (SVR4 with no CRC)
704100          0xABE64         ASCII cpio archive (SVR4 with no CRC)
704216          0xABED8         ASCII cpio archive (SVR4 with no CRC)
704364          0xABF6C         ASCII cpio archive (SVR4 with no CRC)
704488          0xABFE8         ASCII cpio archive (SVR4 with no CRC)
704632          0xAC078         ASCII cpio archive (SVR4 with no CRC)
704780          0xAC10C         ASCII cpio archive (SVR4 with no CRC)
704916          0xAC194         ELF new 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV)
731644          0xB29FC         ASCII cpio archive (SVR4 with no CRC)
731780          0xB2A84         ELF new 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV)
971723          0xED3CB         88K BCS executable
1100616         0x10CB48        ASCII cpio archive (SVR4 with no CRC)
1100960         0x10CCA0        ASCII cpio archive (SVR4 with no CRC)
1101112         0x10CD38        ASCII cpio archive (SVR4 with no CRC)
1101236         0x10CDB4        ASCII cpio archive (SVR4 with no CRC)
1101368         0x10CE38        ASCII cpio archive (SVR4 with no CRC)
1101516         0x10CECC        ASCII cpio archive (SVR4 with no CRC)
1101652         0x10CF54        ELF new 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV)
1110972         0x10F3BC        ASCII cpio archive (SVR4 with no CRC)
1111088         0x10F430        ASCII cpio archive (SVR4 with no CRC)
1111204         0x10F4A4        ASCII cpio archive (SVR4 with no CRC)
1111324         0x10F51C        ASCII cpio archive (SVR4 with no CRC)
1111448         0x10F598        ASCII cpio archive (SVR4 with no CRC)
1111580         0x10F61C        ASCII cpio archive (SVR4 with no CRC)
1111936         0x10F780        ASCII cpio archive (SVR4 with no CRC)
1112056         0x10F7F8        ASCII cpio archive (SVR4 with no CRC)
1112180         0x10F874        ASCII cpio archive (SVR4 with no CRC)
1112304         0x10F8F0        ASCII cpio archive (SVR4 with no CRC)
1112432         0x10F970        ASCII cpio archive (SVR4 with no CRC)
1112568         0x10F9F8        ASCII cpio archive (SVR4 with no CRC)
1112696         0x10FA78        ASCII cpio archive (SVR4 with no CRC)
1112816         0x10FAF0        ASCII cpio archive (SVR4 with no CRC)
1112944         0x10FB70        ASCII cpio archive (SVR4 with no CRC)
1113072         0x10FBF0        ASCII cpio archive (SVR4 with no CRC)
1113200         0x10FC70        ASCII cpio archive (SVR4 with no CRC)
1113324         0x10FCEC        ASCII cpio archive (SVR4 with no CRC)
1113444         0x10FD64        ASCII cpio archive (SVR4 with no CRC)
1113572         0x10FDE4        ASCII cpio archive (SVR4 with no CRC)
1113696         0x10FE60        ASCII cpio archive (SVR4 with no CRC)
1113824         0x10FEE0        ASCII cpio archive (SVR4 with no CRC)
1113940         0x10FF54        ASCII cpio archive (SVR4 with no CRC)
1114056         0x10FFC8        ASCII cpio archive (SVR4 with no CRC)
1114176         0x110040        ASCII cpio archive (SVR4 with no CRC)
1114320         0x1100D0        ASCII cpio archive (SVR4 with no CRC)
1114460         0x11015C        ASCII cpio archive (SVR4 with no CRC)
1114604         0x1101EC        ASCII cpio archive (SVR4 with no CRC)
1114748         0x11027C        ASCII cpio archive (SVR4 with no CRC)
1114892         0x11030C        ASCII cpio archive (SVR4 with no CRC)
1115036         0x11039C        ASCII cpio archive (SVR4 with no CRC)
1115180         0x11042C        ASCII cpio archive (SVR4 with no CRC)
1115336         0x1104C8        ASCII cpio archive (SVR4 with no CRC)
1115480         0x110558        ASCII cpio archive (SVR4 with no CRC)
1115628         0x1105EC        ASCII cpio archive (SVR4 with no CRC)
1115772         0x11067C        ASCII cpio archive (SVR4 with no CRC)
1115920         0x110710        ASCII cpio archive (SVR4 with no CRC)
1116064         0x1107A0        ASCII cpio archive (SVR4 with no CRC)
1116220         0x11083C        ASCII cpio archive (SVR4 with no CRC)
1116364         0x1108CC        ASCII cpio archive (SVR4 with no CRC)
1116508         0x11095C        ASCII cpio archive (SVR4 with no CRC)
1116656         0x1109F0        ASCII cpio archive (SVR4 with no CRC)
1116804         0x110A84        ASCII cpio archive (SVR4 with no CRC)
1116948         0x110B14        ASCII cpio archive (SVR4 with no CRC)
1117092         0x110BA4        ASCII cpio archive (SVR4 with no CRC)
1117236         0x110C34        ASCII cpio archive (SVR4 with no CRC)
1117380         0x110CC4        ASCII cpio archive (SVR4 with no CRC)
1117528         0x110D58        ASCII cpio archive (SVR4 with no CRC)
1117672         0x110DE8        ASCII cpio archive (SVR4 with no CRC)
1117816         0x110E78        ASCII cpio archive (SVR4 with no CRC)
1117964         0x110F0C        ASCII cpio archive (SVR4 with no CRC)
1118088         0x110F88        ASCII cpio archive (SVR4 with no CRC)
1118208         0x111000        ASCII cpio archive (SVR4 with no CRC)

bash-4.2#

*****************************************************************************************************************************

I can open the archive, but I don't know how to extract it. Ark returns me the fallowing error:
"this archive contains archive entries with absolute paths, which are not yet supported by ark"
When I try "cpio -idv < knl\(3\)" command line then it try to extract it in /.

How to extract cpio archive to specified folder ?

*****************************************************************************************************************************
*****************************************************************************************************************************

Decoder Code:

*****************************************************************************************************************************

#include <iostream>
#include <conio.h>
#include <fstream>
#include <sys/stat.h>

char enc_bytes0[] = {0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
                     0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
                     0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
                     0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
                     0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
                     0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
                     0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
                     0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
                     0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
                     0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
                     0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
                     0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
                     0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
                     0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
                     0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
                     0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87} ;

char enc_bytes1[] = {0x3C, 0x3D, 0x3E, 0x3F, 0x38, 0x39, 0x3A, 0x3B, 0x34, 0x35, 0x36, 0x37, 0x30, 0x31, 0x32, 0x33,
                     0x2C, 0x2D, 0x2E, 0x2F, 0x28, 0x29, 0x2A, 0x2B, 0x24, 0x25, 0x26, 0x27, 0x20, 0x21, 0x22, 0x23,
                     0x1C, 0x1D, 0x1E, 0x1F, 0x18, 0x19, 0x1A, 0x1B, 0x14, 0x15, 0x16, 0x17, 0x10, 0x11, 0x12, 0x13,
                     0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
                     0x7C, 0x7D, 0x7E, 0x7F, 0x78, 0x79, 0x7A, 0x7B, 0x74, 0x75, 0x76, 0x77, 0x70, 0x71, 0x72, 0x73,
                     0x6C, 0x6D, 0x6E, 0x6F, 0x68, 0x69, 0x6A, 0x6B, 0x64, 0x65, 0x66, 0x67, 0x60, 0x61, 0x62, 0x63,
                     0x5C, 0x5D, 0x5E, 0x5F, 0x58, 0x59, 0x5A, 0x5B, 0x54, 0x55, 0x56, 0x57, 0x50, 0x51, 0x52, 0x53,
                     0x4C, 0x4D, 0x4E, 0x4F, 0x48, 0x49, 0x4A, 0x4B, 0x44, 0x45, 0x46, 0x47, 0x40, 0x41, 0x42, 0x43,
                     0xBC, 0xBD, 0xBE, 0xBF, 0xB8, 0xB9, 0xBA, 0xBB, 0xB4, 0xB5, 0xB6, 0xB7, 0xB0, 0xB1, 0xB2, 0xB3,
                     0xAC, 0xAD, 0xAE, 0xAF, 0xA8, 0xA9, 0xAA, 0xAB, 0xA4, 0xA5, 0xA6, 0xA7, 0xA0, 0xA1, 0xA2, 0xA3,
                     0x9C, 0x9D, 0x9E, 0x9F, 0x98, 0x99, 0x9A, 0x9B, 0x94, 0x95, 0x96, 0x97, 0x90, 0x91, 0x92, 0x93,
                     0x8C, 0x8D, 0x8E, 0x8F, 0x88, 0x89, 0x8A, 0x8B, 0x84, 0x85, 0x86, 0x87, 0x80, 0x81, 0x82, 0x83,
                     0xFC, 0xFD, 0xFE, 0xFF, 0xF8, 0xF9, 0xFA, 0xFB, 0xF4, 0xF5, 0xF6, 0xF7, 0xF0, 0xF1, 0xF2, 0xF3,
                     0xEC, 0xED, 0xEE, 0xEF, 0xE8, 0xE9, 0xEA, 0xEB, 0xE4, 0xE5, 0xE6, 0xE7, 0xE0, 0xE1, 0xE2, 0xE3,
                     0xDC, 0xDD, 0xDE, 0xDF, 0xD8, 0xD9, 0xDA, 0xDB, 0xD4, 0xD5, 0xD6, 0xD7, 0xD0, 0xD1, 0xD2, 0xD3,
                     0xCC, 0xCD, 0xCE, 0xCF, 0xC8, 0xC9, 0xCA, 0xCB, 0xC4, 0xC5, 0xC6, 0xC7, 0xC0, 0xC1, 0xC2, 0xC3} ;

char enc_bytes2[] = {0x9E, 0x9F, 0x9C, 0x9D, 0x9A, 0x9B, 0x98, 0x99, 0x96, 0x97, 0x94, 0x95, 0x92, 0x93, 0x90, 0x91,
                     0x8E, 0x8F, 0x8C, 0x8D, 0x8A, 0x8B, 0x88, 0x89, 0x86, 0x87, 0x84, 0x85, 0x82, 0x83, 0x80, 0x81,
                     0xBE, 0xBF, 0xBC, 0xBD, 0xBA, 0xBB, 0xB8, 0xB9, 0xB6, 0xB7, 0xB4, 0xB5, 0xB2, 0xB3, 0xB0, 0xB1,
                     0xAE, 0xAF, 0xAC, 0xAD, 0xAA, 0xAB, 0xA8, 0xA9, 0xA6, 0xA7, 0xA4, 0xA5, 0xA2, 0xA3, 0xA0, 0xA1,
                     0xDE, 0xDF, 0xDC, 0xDD, 0xDA, 0xDB, 0xD8, 0xD9, 0xD6, 0xD7, 0xD4, 0xD5, 0xD2, 0xD3, 0xD0, 0xD1,
                     0xCE, 0xCF, 0xCC, 0xCD, 0xCA, 0xCB, 0xC8, 0xC9, 0xC6, 0xC7, 0xC4, 0xC5, 0xC2, 0xC3, 0xC0, 0xC1,
                     0xFE, 0xFF, 0xFC, 0xFD, 0xFA, 0xFB, 0xF8, 0xF9, 0xF6, 0xF7, 0xF4, 0xF5, 0xF2, 0xF3, 0xF0, 0xF1,
                     0xEE, 0xEF, 0xEC, 0xED, 0xEA, 0xEB, 0xE8, 0xE9, 0xE6, 0xE7, 0xE4, 0xE5, 0xE2, 0xE3, 0xE0, 0xE1,
                     0x1E, 0x1F, 0x1C, 0x1D, 0x1A, 0x1B, 0x18, 0x19, 0x16, 0x17, 0x14, 0x15, 0x12, 0x13, 0x10, 0x11,
                     0x0E, 0x0F, 0x0C, 0x0D, 0x0A, 0x0B, 0x08, 0x09, 0x06, 0x07, 0x04, 0x05, 0x02, 0x03, 0x00, 0x01,
                     0x3E, 0x3F, 0x3C, 0x3D, 0x3A, 0x3B, 0x38, 0x39, 0x36, 0x37, 0x34, 0x35, 0x32, 0x33, 0x30, 0x31,
                     0x2E, 0x2F, 0x2C, 0x2D, 0x2A, 0x2B, 0x28, 0x29, 0x26, 0x27, 0x24, 0x25, 0x22, 0x23, 0x20, 0x21,
                     0x5E, 0x5F, 0x5C, 0x5D, 0x5A, 0x5B, 0x58, 0x59, 0x56, 0x57, 0x54, 0x55, 0x52, 0x53, 0x50, 0x51,
                     0x4E, 0x4F, 0x4C, 0x4D, 0x4A, 0x4B, 0x48, 0x49, 0x46, 0x47, 0x44, 0x45, 0x42, 0x43, 0x40, 0x41,
                     0x7E, 0x7F, 0x7C, 0x7D, 0x7A, 0x7B, 0x78, 0x79, 0x76, 0x77, 0x74, 0x75, 0x72, 0x73, 0x70, 0x71,
                     0x6E, 0x6F, 0x6C, 0x6D, 0x6A, 0x6B, 0x68, 0x69, 0x66, 0x67, 0x64, 0x65, 0x62, 0x63, 0x60, 0x61} ;

char enc_bytes3[] = {0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8, 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0,
                     0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8, 0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0,
                     0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8, 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0,
                     0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0,
                     0x8F, 0x8E, 0x8D, 0x8C, 0x8B, 0x8A, 0x89, 0x88, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80,
                     0x9F, 0x9E, 0x9D, 0x9C, 0x9B, 0x9A, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90,
                     0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8, 0xA7, 0xA6, 0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0,
                     0xBF, 0xBE, 0xBD, 0xBC, 0xBB, 0xBA, 0xB9, 0xB8, 0xB7, 0xB6, 0xB5, 0xB4, 0xB3, 0xB2, 0xB1, 0xB0,
                     0x4F, 0x4E, 0x4D, 0x4C, 0x4B, 0x4A, 0x49, 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40,
                     0x5F, 0x5E, 0x5D, 0x5C, 0x5B, 0x5A, 0x59, 0x58, 0x57, 0x56, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50,
                     0x6F, 0x6E, 0x6D, 0x6C, 0x6B, 0x6A, 0x69, 0x68, 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60,
                     0x7F, 0x7E, 0x7D, 0x7C, 0x7B, 0x7A, 0x79, 0x78, 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70,
                     0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
                     0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
                     0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20,
                     0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30} ;

char enc_bytes4[] = {0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60, 0x6F, 0x6E, 0x6D, 0x6C, 0x6B, 0x6A, 0x69, 0x68,
                     0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70, 0x7F, 0x7E, 0x7D, 0x7C, 0x7B, 0x7A, 0x79, 0x78,
                     0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40, 0x4F, 0x4E, 0x4D, 0x4C, 0x4B, 0x4A, 0x49, 0x48,
                     0x57, 0x56, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50, 0x5F, 0x5E, 0x5D, 0x5C, 0x5B, 0x5A, 0x59, 0x58,
                     0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x28,
                     0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
                     0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18,
                     0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0, 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8,
                     0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8,
                     0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0, 0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8,
                     0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0, 0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8,
                     0xA7, 0xA6, 0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0, 0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8,
                     0xB7, 0xB6, 0xB5, 0xB4, 0xB3, 0xB2, 0xB1, 0xB0, 0xBF, 0xBE, 0xBD, 0xBC, 0xBB, 0xBA, 0xB9, 0xB8,
                     0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x8F, 0x8E, 0x8D, 0x8C, 0x8B, 0x8A, 0x89, 0x88,
                     0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x9F, 0x9E, 0x9D, 0x9C, 0x9B, 0x9A, 0x99, 0x98} ;

char enc_bytes5[] = {0xB3, 0xB2, 0xB1, 0xB0, 0xB7, 0xB6, 0xB5, 0xB4, 0xBB, 0xBA, 0xB9, 0xB8, 0xBF, 0xBE, 0xBD, 0xBC,
                     0xA3, 0xA2, 0xA1, 0xA0, 0xA7, 0xA6, 0xA5, 0xA4, 0xAB, 0xAA, 0xA9, 0xA8, 0xAF, 0xAE, 0xAD, 0xAC,
                     0x93, 0x92, 0x91, 0x90, 0x97, 0x96, 0x95, 0x94, 0x9B, 0x9A, 0x99, 0x98, 0x9F, 0x9E, 0x9D, 0x9C,
                     0x83, 0x82, 0x81, 0x80, 0x87, 0x86, 0x85, 0x84, 0x8B, 0x8A, 0x89, 0x88, 0x8F, 0x8E, 0x8D, 0x8C,
                     0xF3, 0xF2, 0xF1, 0xF0, 0xF7, 0xF6, 0xF5, 0xF4, 0xFB, 0xFA, 0xF9, 0xF8, 0xFF, 0xFE, 0xFD, 0xFC,
                     0xE3, 0xE2, 0xE1, 0xE0, 0xE7, 0xE6, 0xE5, 0xE4, 0xEB, 0xEA, 0xE9, 0xE8, 0xEF, 0xEE, 0xED, 0xEC,
                     0xD3, 0xD2, 0xD1, 0xD0, 0xD7, 0xD6, 0xD5, 0xD4, 0xDB, 0xDA, 0xD9, 0xD8, 0xDF, 0xDE, 0xDD, 0xDC,
                     0xC3, 0xC2, 0xC1, 0xC0, 0xC7, 0xC6, 0xC5, 0xC4, 0xCB, 0xCA, 0xC9, 0xC8, 0xCF, 0xCE, 0xCD, 0xCC,
                     0x33, 0x32, 0x31, 0x30, 0x37, 0x36, 0x35, 0x34, 0x3B, 0x3A, 0x39, 0x38, 0x3F, 0x3E, 0x3D, 0x3C,
                     0x23, 0x22, 0x21, 0x20, 0x27, 0x26, 0x25, 0x24, 0x2B, 0x2A, 0x29, 0x28, 0x2F, 0x2E, 0x2D, 0x2C,
                     0x13, 0x12, 0x11, 0x10, 0x17, 0x16, 0x15, 0x14, 0x1B, 0x1A, 0x19, 0x18, 0x1F, 0x1E, 0x1D, 0x1C,
                     0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0B, 0x0A, 0x09, 0x08, 0x0F, 0x0E, 0x0D, 0x0C,
                     0x73, 0x72, 0x71, 0x70, 0x77, 0x76, 0x75, 0x74, 0x7B, 0x7A, 0x79, 0x78, 0x7F, 0x7E, 0x7D, 0x7C,
                     0x63, 0x62, 0x61, 0x60, 0x67, 0x66, 0x65, 0x64, 0x6B, 0x6A, 0x69, 0x68, 0x6F, 0x6E, 0x6D, 0x6C,
                     0x53, 0x52, 0x51, 0x50, 0x57, 0x56, 0x55, 0x54, 0x5B, 0x5A, 0x59, 0x58, 0x5F, 0x5E, 0x5D, 0x5C,
                     0x43, 0x42, 0x41, 0x40, 0x47, 0x46, 0x45, 0x44, 0x4B, 0x4A, 0x49, 0x48, 0x4F, 0x4E, 0x4D, 0x4C} ;

char enc_bytes6[] = {0x59, 0x58, 0x5B, 0x5A, 0x5D, 0x5C, 0x5F, 0x5E, 0x51, 0x50, 0x53, 0x52, 0x55, 0x54, 0x57, 0x56,
                     0x49, 0x48, 0x4B, 0x4A, 0x4D, 0x4C, 0x4F, 0x4E, 0x41, 0x40, 0x43, 0x42, 0x45, 0x44, 0x47, 0x46,
                     0x79, 0x78, 0x7B, 0x7A, 0x7D, 0x7C, 0x7F, 0x7E, 0x71, 0x70, 0x73, 0x72, 0x75, 0x74, 0x77, 0x76,
                     0x69, 0x68, 0x6B, 0x6A, 0x6D, 0x6C, 0x6F, 0x6E, 0x61, 0x60, 0x63, 0x62, 0x65, 0x64, 0x67, 0x66,
 

dj__silver

*****************************************************************************************************************************
*****************************************************************************************************************************

Decoder Code:

*****************************************************************************************************************************

#include <iostream>
#include <conio.h>
#include <fstream>
#include <sys/stat.h>

char enc_bytes0[] = {0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
                     0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
                     0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
                     0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
                     0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
                     0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
                     0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
                     0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
                     0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
                     0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
                     0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
                     0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
                     0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
                     0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
                     0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
                     0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87} ;

char enc_bytes1[] = {0x3C, 0x3D, 0x3E, 0x3F, 0x38, 0x39, 0x3A, 0x3B, 0x34, 0x35, 0x36, 0x37, 0x30, 0x31, 0x32, 0x33,
                     0x2C, 0x2D, 0x2E, 0x2F, 0x28, 0x29, 0x2A, 0x2B, 0x24, 0x25, 0x26, 0x27, 0x20, 0x21, 0x22, 0x23,
                     0x1C, 0x1D, 0x1E, 0x1F, 0x18, 0x19, 0x1A, 0x1B, 0x14, 0x15, 0x16, 0x17, 0x10, 0x11, 0x12, 0x13,
                     0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
                     0x7C, 0x7D, 0x7E, 0x7F, 0x78, 0x79, 0x7A, 0x7B, 0x74, 0x75, 0x76, 0x77, 0x70, 0x71, 0x72, 0x73,
                     0x6C, 0x6D, 0x6E, 0x6F, 0x68, 0x69, 0x6A, 0x6B, 0x64, 0x65, 0x66, 0x67, 0x60, 0x61, 0x62, 0x63,
                     0x5C, 0x5D, 0x5E, 0x5F, 0x58, 0x59, 0x5A, 0x5B, 0x54, 0x55, 0x56, 0x57, 0x50, 0x51, 0x52, 0x53,
                     0x4C, 0x4D, 0x4E, 0x4F, 0x48, 0x49, 0x4A, 0x4B, 0x44, 0x45, 0x46, 0x47, 0x40, 0x41, 0x42, 0x43,
                     0xBC, 0xBD, 0xBE, 0xBF, 0xB8, 0xB9, 0xBA, 0xBB, 0xB4, 0xB5, 0xB6, 0xB7, 0xB0, 0xB1, 0xB2, 0xB3,
                     0xAC, 0xAD, 0xAE, 0xAF, 0xA8, 0xA9, 0xAA, 0xAB, 0xA4, 0xA5, 0xA6, 0xA7, 0xA0, 0xA1, 0xA2, 0xA3,
                     0x9C, 0x9D, 0x9E, 0x9F, 0x98, 0x99, 0x9A, 0x9B, 0x94, 0x95, 0x96, 0x97, 0x90, 0x91, 0x92, 0x93,
                     0x8C, 0x8D, 0x8E, 0x8F, 0x88, 0x89, 0x8A, 0x8B, 0x84, 0x85, 0x86, 0x87, 0x80, 0x81, 0x82, 0x83,
                     0xFC, 0xFD, 0xFE, 0xFF, 0xF8, 0xF9, 0xFA, 0xFB, 0xF4, 0xF5, 0xF6, 0xF7, 0xF0, 0xF1, 0xF2, 0xF3,
                     0xEC, 0xED, 0xEE, 0xEF, 0xE8, 0xE9, 0xEA, 0xEB, 0xE4, 0xE5, 0xE6, 0xE7, 0xE0, 0xE1, 0xE2, 0xE3,
                     0xDC, 0xDD, 0xDE, 0xDF, 0xD8, 0xD9, 0xDA, 0xDB, 0xD4, 0xD5, 0xD6, 0xD7, 0xD0, 0xD1, 0xD2, 0xD3,
                     0xCC, 0xCD, 0xCE, 0xCF, 0xC8, 0xC9, 0xCA, 0xCB, 0xC4, 0xC5, 0xC6, 0xC7, 0xC0, 0xC1, 0xC2, 0xC3} ;

char enc_bytes2[] = {0x9E, 0x9F, 0x9C, 0x9D, 0x9A, 0x9B, 0x98, 0x99, 0x96, 0x97, 0x94, 0x95, 0x92, 0x93, 0x90, 0x91,
                     0x8E, 0x8F, 0x8C, 0x8D, 0x8A, 0x8B, 0x88, 0x89, 0x86, 0x87, 0x84, 0x85, 0x82, 0x83, 0x80, 0x81,
                     0xBE, 0xBF, 0xBC, 0xBD, 0xBA, 0xBB, 0xB8, 0xB9, 0xB6, 0xB7, 0xB4, 0xB5, 0xB2, 0xB3, 0xB0, 0xB1,
                     0xAE, 0xAF, 0xAC, 0xAD, 0xAA, 0xAB, 0xA8, 0xA9, 0xA6, 0xA7, 0xA4, 0xA5, 0xA2, 0xA3, 0xA0, 0xA1,
                     0xDE, 0xDF, 0xDC, 0xDD, 0xDA, 0xDB, 0xD8, 0xD9, 0xD6, 0xD7, 0xD4, 0xD5, 0xD2, 0xD3, 0xD0, 0xD1,
                     0xCE, 0xCF, 0xCC, 0xCD, 0xCA, 0xCB, 0xC8, 0xC9, 0xC6, 0xC7, 0xC4, 0xC5, 0xC2, 0xC3, 0xC0, 0xC1,
                     0xFE, 0xFF, 0xFC, 0xFD, 0xFA, 0xFB, 0xF8, 0xF9, 0xF6, 0xF7, 0xF4, 0xF5, 0xF2, 0xF3, 0xF0, 0xF1,
                     0xEE, 0xEF, 0xEC, 0xED, 0xEA, 0xEB, 0xE8, 0xE9, 0xE6, 0xE7, 0xE4, 0xE5, 0xE2, 0xE3, 0xE0, 0xE1,
                     0x1E, 0x1F, 0x1C, 0x1D, 0x1A, 0x1B, 0x18, 0x19, 0x16, 0x17, 0x14, 0x15, 0x12, 0x13, 0x10, 0x11,
                     0x0E, 0x0F, 0x0C, 0x0D, 0x0A, 0x0B, 0x08, 0x09, 0x06, 0x07, 0x04, 0x05, 0x02, 0x03, 0x00, 0x01,
                     0x3E, 0x3F, 0x3C, 0x3D, 0x3A, 0x3B, 0x38, 0x39, 0x36, 0x37, 0x34, 0x35, 0x32, 0x33, 0x30, 0x31,
                     0x2E, 0x2F, 0x2C, 0x2D, 0x2A, 0x2B, 0x28, 0x29, 0x26, 0x27, 0x24, 0x25, 0x22, 0x23, 0x20, 0x21,
                     0x5E, 0x5F, 0x5C, 0x5D, 0x5A, 0x5B, 0x58, 0x59, 0x56, 0x57, 0x54, 0x55, 0x52, 0x53, 0x50, 0x51,
                     0x4E, 0x4F, 0x4C, 0x4D, 0x4A, 0x4B, 0x48, 0x49, 0x46, 0x47, 0x44, 0x45, 0x42, 0x43, 0x40, 0x41,
                     0x7E, 0x7F, 0x7C, 0x7D, 0x7A, 0x7B, 0x78, 0x79, 0x76, 0x77, 0x74, 0x75, 0x72, 0x73, 0x70, 0x71,
                     0x6E, 0x6F, 0x6C, 0x6D, 0x6A, 0x6B, 0x68, 0x69, 0x66, 0x67, 0x64, 0x65, 0x62, 0x63, 0x60, 0x61} ;

char enc_bytes3[] = {0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8, 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0,
                     0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8, 0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0,
                     0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8, 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0,
                     0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0,
                     0x8F, 0x8E, 0x8D, 0x8C, 0x8B, 0x8A, 0x89, 0x88, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80,
                     0x9F, 0x9E, 0x9D, 0x9C, 0x9B, 0x9A, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90,
                     0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8, 0xA7, 0xA6, 0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0,
                     0xBF, 0xBE, 0xBD, 0xBC, 0xBB, 0xBA, 0xB9, 0xB8, 0xB7, 0xB6, 0xB5, 0xB4, 0xB3, 0xB2, 0xB1, 0xB0,
                     0x4F, 0x4E, 0x4D, 0x4C, 0x4B, 0x4A, 0x49, 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40,
                     0x5F, 0x5E, 0x5D, 0x5C, 0x5B, 0x5A, 0x59, 0x58, 0x57, 0x56, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50,
                     0x6F, 0x6E, 0x6D, 0x6C, 0x6B, 0x6A, 0x69, 0x68, 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60,
                     0x7F, 0x7E, 0x7D, 0x7C, 0x7B, 0x7A, 0x79, 0x78, 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70,
                     0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
                     0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
                     0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20,
                     0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30} ;

char enc_bytes4[] = {0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60, 0x6F, 0x6E, 0x6D, 0x6C, 0x6B, 0x6A, 0x69, 0x68,
                     0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70, 0x7F, 0x7E, 0x7D, 0x7C, 0x7B, 0x7A, 0x79, 0x78,
                     0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40, 0x4F, 0x4E, 0x4D, 0x4C, 0x4B, 0x4A, 0x49, 0x48,
                     0x57, 0x56, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50, 0x5F, 0x5E, 0x5D, 0x5C, 0x5B, 0x5A, 0x59, 0x58,
                     0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x28,
                     0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
                     0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18,
                     0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0, 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8,
                     0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8,
                     0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0, 0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8,
                     0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0, 0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8,
                     0xA7, 0xA6, 0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0, 0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8,
                     0xB7, 0xB6, 0xB5, 0xB4, 0xB3, 0xB2, 0xB1, 0xB0, 0xBF, 0xBE, 0xBD, 0xBC, 0xBB, 0xBA, 0xB9, 0xB8,
                     0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x8F, 0x8E, 0x8D, 0x8C, 0x8B, 0x8A, 0x89, 0x88,
                     0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x9F, 0x9E, 0x9D, 0x9C, 0x9B, 0x9A, 0x99, 0x98} ;

char enc_bytes5[] = {0xB3, 0xB2, 0xB1, 0xB0, 0xB7, 0xB6, 0xB5, 0xB4, 0xBB, 0xBA, 0xB9, 0xB8, 0xBF, 0xBE, 0xBD, 0xBC,
                     0xA3, 0xA2, 0xA1, 0xA0, 0xA7, 0xA6, 0xA5, 0xA4, 0xAB, 0xAA, 0xA9, 0xA8, 0xAF, 0xAE, 0xAD, 0xAC,
                     0x93, 0x92, 0x91, 0x90, 0x97, 0x96, 0x95, 0x94, 0x9B, 0x9A, 0x99, 0x98, 0x9F, 0x9E, 0x9D, 0x9C,
                     0x83, 0x82, 0x81, 0x80, 0x87, 0x86, 0x85, 0x84, 0x8B, 0x8A, 0x89, 0x88, 0x8F, 0x8E, 0x8D, 0x8C,
                     0xF3, 0xF2, 0xF1, 0xF0, 0xF7, 0xF6, 0xF5, 0xF4, 0xFB, 0xFA, 0xF9, 0xF8, 0xFF, 0xFE, 0xFD, 0xFC,
                     0xE3, 0xE2, 0xE1, 0xE0, 0xE7, 0xE6, 0xE5, 0xE4, 0xEB, 0xEA, 0xE9, 0xE8, 0xEF, 0xEE, 0xED, 0xEC,
                     0xD3, 0xD2, 0xD1, 0xD0, 0xD7, 0xD6, 0xD5, 0xD4, 0xDB, 0xDA, 0xD9, 0xD8, 0xDF, 0xDE, 0xDD, 0xDC,
                     0xC3, 0xC2, 0xC1, 0xC0, 0xC7, 0xC6, 0xC5, 0xC4, 0xCB, 0xCA, 0xC9, 0xC8, 0xCF, 0xCE, 0xCD, 0xCC,
                     0x33, 0x32, 0x31, 0x30, 0x37, 0x36, 0x35, 0x34, 0x3B, 0x3A, 0x39, 0x38, 0x3F, 0x3E, 0x3D, 0x3C,
                     0x23, 0x22, 0x21, 0x20, 0x27, 0x26, 0x25, 0x24, 0x2B, 0x2A, 0x29, 0x28, 0x2F, 0x2E, 0x2D, 0x2C,
                     0x13, 0x12, 0x11, 0x10, 0x17, 0x16, 0x15, 0x14, 0x1B, 0x1A, 0x19, 0x18, 0x1F, 0x1E, 0x1D, 0x1C,
                     0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0B, 0x0A, 0x09, 0x08, 0x0F, 0x0E, 0x0D, 0x0C,
                     0x73, 0x72, 0x71, 0x70, 0x77, 0x76, 0x75, 0x74, 0x7B, 0x7A, 0x79, 0x78, 0x7F, 0x7E, 0x7D, 0x7C,
                     0x63, 0x62, 0x61, 0x60, 0x67, 0x66, 0x65, 0x64, 0x6B, 0x6A, 0x69, 0x68, 0x6F, 0x6E, 0x6D, 0x6C,
                     0x53, 0x52, 0x51, 0x50, 0x57, 0x56, 0x55, 0x54, 0x5B, 0x5A, 0x59, 0x58, 0x5F, 0x5E, 0x5D, 0x5C,
                     0x43, 0x42, 0x41, 0x40, 0x47, 0x46, 0x45, 0x44, 0x4B, 0x4A, 0x49, 0x48, 0x4F, 0x4E, 0x4D, 0x4C} ;

char enc_bytes6[] = {0x59, 0x58, 0x5B, 0x5A, 0x5D, 0x5C, 0x5F, 0x5E, 0x51, 0x50, 0x53, 0x52, 0x55, 0x54, 0x57, 0x56,
                     0x49, 0x48, 0x4B, 0x4A, 0x4D, 0x4C, 0x4F, 0x4E, 0x41, 0x40, 0x43, 0x42, 0x45, 0x44, 0x47, 0x46,
                     0x79, 0x78, 0x7B, 0x7A, 0x7D, 0x7C, 0x7F, 0x7E, 0x71, 0x70, 0x73, 0x72, 0x75, 0x74, 0x77, 0x76,
                     0x69, 0x68, 0x6B, 0x6A, 0x6D, 0x6C, 0x6F, 0x6E, 0x61, 0x60, 0x63, 0x62, 0x65, 0x64, 0x67, 0x66,
                     0x19, 0x18, 0x1B, 0x1A, 0x1D, 0x1C, 0x1F, 0x1E, 0x11, 0x10, 0x13, 0x12, 0x15, 0x14, 0x17, 0x16,
                     0x09, 0x08, 0x0B, 0x0A, 0x0D, 0x0C, 0x0F, 0x0E, 0x01, 0x00, 0x03, 0x02, 0x05, 0x04, 0x07, 0x06,
                     0x39, 0x38, 0x3B, 0x3A, 0x3D, 0x3C, 0x3F, 0x3E, 0x31, 0x30, 0x33, 0x32, 0x35, 0x34, 0x37, 0x36,
                     0x29, 0x28, 0x2B, 0x2A, 0x2D, 0x2C, 0x2F, 0x2E, 0x21, 0x20, 0x23, 0x22, 0x25, 0x24, 0x27, 0x26,
                     0xD9, 0xD8, 0xDB, 0xDA, 0xDD, 0xDC, 0xDF, 0xDE, 0xD1, 0xD0, 0xD3, 0xD2, 0xD5, 0xD4, 0xD7, 0xD6,
                     0xC9, 0xC8, 0xCB, 0xCA, 0xCD, 0xCC, 0xCF, 0xCE, 0xC1, 0xC0, 0xC3, 0xC2, 0xC5, 0xC4, 0xC7, 0xC6,
                     0xF9, 0xF8, 0xFB, 0xFA, 0xFD, 0xFC, 0xFF, 0xFE, 0xF1, 0xF0, 0xF3, 0xF2, 0xF5, 0xF4, 0xF7, 0xF6,
                     0xE9, 0xE8, 0xEB, 0xEA, 0xED, 0xEC, 0xEF, 0xEE, 0xE1, 0xE0, 0xE3, 0xE2, 0xE5, 0xE4, 0xE7, 0xE6,
                     0x99, 0x98, 0x9B, 0x9A, 0x9D, 0x9C, 0x9F, 0x9E, 0x91, 0x90, 0x93, 0x92, 0x95, 0x94, 0x97, 0x96,
                     0x89, 0x88, 0x8B, 0x8A, 0x8D, 0x8C, 0x8F, 0x8E, 0x81, 0x80, 0x83, 0x82, 0x85, 0x84, 0x87, 0x86,
                     0xB9, 0xB8, 0xBB, 0xBA, 0xBD, 0xBC, 0xBF, 0xBE, 0xB1, 0xB0, 0xB3, 0xB2, 0xB5, 0xB4, 0xB7, 0xB6,
                     0xA9, 0xA8, 0xAB, 0xAA, 0xAD, 0xAC, 0xAF, 0xAE, 0xA1, 0xA0, 0xA3, 0xA2, 0xA5, 0xA4, 0xA7, 0xA6} ;

char enc_bytes7[] = {0xAC, 0xAD, 0xAE, 0xAF, 0xA8, 0xA9, 0xAA, 0xAB, 0xA4, 0xA5, 0xA6, 0xA7, 0xA0, 0xA1, 0xA2, 0xA3,
                     0xBC, 0xBD, 0xBE, 0xBF, 0xB8, 0xB9, 0xBA, 0xBB, 0xB4, 0xB5, 0xB6, 0xB7, 0xB0, 0xB1, 0xB2, 0xB3,
                     0x8C, 0x8D, 0x8E, 0x8F, 0x88, 0x89, 0x8A, 0x8B, 0x84, 0x85, 0x86, 0x87, 0x80, 0x81, 0x82, 0x83,
                     0x9C, 0x9D, 0x9E, 0x9F, 0x98, 0x99, 0x9A, 0x9B, 0x94, 0x95, 0x96, 0x97, 0x90, 0x91, 0x92, 0x93,
                     0xEC, 0xED, 0xEE, 0xEF, 0xE8, 0xE9, 0xEA, 0xEB, 0xE4, 0xE5, 0xE6, 0xE7, 0xE0, 0xE1, 0xE2, 0xE3,
                     0xFC, 0xFD, 0xFE, 0xFF, 0xF8, 0xF9, 0xFA, 0xFB, 0xF4, 0xF5, 0xF6, 0xF7, 0xF0, 0xF1, 0xF2, 0xF3,
                     0xCC, 0xCD, 0xCE, 0xCF, 0xC8, 0xC9, 0xCA, 0xCB, 0xC4, 0xC5, 0xC6, 0xC7, 0xC0, 0xC1, 0xC2, 0xC3,
                     0xDC, 0xDD, 0xDE, 0xDF, 0xD8, 0xD9, 0xDA, 0xDB, 0xD4, 0xD5, 0xD6, 0xD7, 0xD0, 0xD1, 0xD2, 0xD3,
                     0x2C, 0x2D, 0x2E, 0x2F, 0x28, 0x29, 0x2A, 0x2B, 0x24, 0x25, 0x26, 0x27, 0x20, 0x21, 0x22, 0x23,
                     0x3C, 0x3D, 0x3E, 0x3F, 0x38, 0x39, 0x3A, 0x3B, 0x34, 0x35, 0x36, 0x37, 0x30, 0x31, 0x32, 0x33,
                     0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
                     0x1C, 0x1D, 0x1E, 0x1F, 0x18, 0x19, 0x1A, 0x1B, 0x14, 0x15, 0x16, 0x17, 0x10, 0x11, 0x12, 0x13,
                     0x6C, 0x6D, 0x6E, 0x6F, 0x68, 0x69, 0x6A, 0x6B, 0x64, 0x65, 0x66, 0x67, 0x60, 0x61, 0x62, 0x63,
                     0x7C, 0x7D, 0x7E, 0x7F, 0x78, 0x79, 0x7A, 0x7B, 0x74, 0x75, 0x76, 0x77, 0x70, 0x71, 0x72, 0x73,
                     0x4C, 0x4D, 0x4E, 0x4F, 0x48, 0x49, 0x4A, 0x4B, 0x44, 0x45, 0x46, 0x47, 0x40, 0x41, 0x42, 0x43,
                     0x5C, 0x5D, 0x5E, 0x5F, 0x58, 0x59, 0x5A, 0x5B, 0x54, 0x55, 0x56, 0x57, 0x50, 0x51, 0x52, 0x53} ;

using namespace std ;

bool checkPaths(string &in, string &out) ;
void loadFile() ;
void convert() ;
void decode(int total_off, char rel_off) ;
char decodeByte(char encoded, char *dec_table) ;
inline void write() ;

char *buffer ;
int length ;
ifstream fin ;
ofstream fout ;

int main(int argc, char **argv)
{
    string in_path, out_path ;
    do
    {
        cout << "Enter input file path:\t" ;
        getline(cin, in_path) ;
        cout << "Enter oputput file path:\t" ;
        getline(cin, out_path) ;
    }
    while(!checkPaths(in_path, out_path)) ;
    fin.open(in_path.c_str(), ios::binary) ;
    fout.open(out_path.c_str(), ios::binary) ;
    loadFile() ;
    cout << "Decoding data..." << endl ;
    convert() ;
    cout << "Data decoded succesfully !" << endl ;
    write() ;
    getch() ;
    return 0 ;
}

void convert()
{
    int cycles = length / 8 ;
    for(int aa = 0; aa < cycles; aa++)
    for(char bb = 0; bb < 8; bb++)
    decode(aa * 8 + bb, bb) ;
    if(length % 8 != 0)
    for(int aa = cycles * 8, bb = 0; aa < length; aa++, bb++)
    decode(aa, bb) ;
}

inline void write()
{
    fout.write(buffer, length) ;
    fout.close() ;
}

void decode(int total_off, char rel_off)
{
    switch(rel_off)
    {
        case 0:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes0) ;
        return ;
        case 1:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes1) ;
        return ;
        case 2:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes2) ;
        return ;
        case 3:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes3) ;
        return ;
        case 4:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes4) ;
        return ;
        case 5:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes5) ;
        return ;
        case 6:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes6) ;
        return ;
        case 7:
        buffer[total_off] = decodeByte(buffer[total_off], enc_bytes7) ;
        return ;
    }
}

char decodeByte(char encoded, char *dec_table)
{
    for(int aa = 0; aa < 256; aa++)
    if(dec_table[aa] == encoded)
    return aa ;
}

void loadFile()
{
    fin.seekg(0, ios::end) ;
    length = fin.tellg() ;
    fin.seekg(0, ios::beg) ;
    buffer = new char[length] ;
    fin.read(buffer, length) ;
    fin.close() ;
}

bool checkPaths(string &in, string &out)
{
    return true ; ////
}

*****************************************************************************************************************************
*****************************************************************************************************************************

How to extract cpio archive to specified folder ?

BenYeeHua

I think you should putting all of them into a txt and upload as attachments or using the
code
to making this threads more shorter and readable. ;)

Jeremy Collake

#7
Please report all FMK issues to the Google Code site. That is what the bug tracker / issue tracker is for. Firmware Mod Kit

If you have contributions to make, please make them there. We can even give you commit access if you end up being a big (and cautious) contributor.
Software Engineer. Bitsum LLC.

dj__silver

I have a question about FMK tools.
Does it is normal that after file extraction and packing it back without any changes to extracted content the original file and repacked file differ a little in size ?
Please look at this log:
http://rapidshare.com/files/306575985/log1.txt
Original file size is 2651422 bytes but after repacking it takes 2663678 bytes. What causes the difference ?. Is it normal ?

Jeremy Collake

Yes, it is normal. The particular compression parameters used can cause small (or large) differences in the compression ratio. The FMK likely uses slightly different compression parameters than the OEM does.
Software Engineer. Bitsum LLC.

dj__silver

    You were not exactly right about Your answer, that is I think that's true about particular compression parameters used but in some other case, not here. I know because I've tested it. The first firmware file is "squashfs-3.2-r2-hg612-lzma" file(after decoding it of course), however it can be also unsquashed(unpacked) with "squashfs-3.2-r2-lzma". When I packed back unpacked content with "squashfs-3.2-r2-lzma" then router refused to accept file(after encoding it back of course), but when I packed it back with "squashfs-3.2-r2-hg612-lzma" then it produced exactly same binary file except header, where is the timestamp. I was able to make my first modification to firmware - change language from uk to my native - well not completely but partially to test if it works ;D. It was simple thing - just changing strings in uk.txt file.
    And one other thing - FMK doesn't provide tools for unpacking and repacking U-Boot uImage files, so in fact I can't even completely unpack firmware