Code Monkey home page Code Monkey logo

epk2extract's Introduction

Build Status

epk2extract

Join the chat at https://gitter.im/openlgtv/epk2extract

Join on Discord: https://discord.gg/xWqRVEm

epk2extract is a tool that can extract, decrypt, convert multiple file formats that can be found in LG TV sets and similar devices.

Supported Formats:

NOTE: To unpack epk v2 and v3 you need proper AES and RSA keys for decryption. To get them you will need to dump them from a running TV.

NOTE: To decrypt PVR recordings you need a dump of the unique AES-128 key from your TV

Format Notes
epk v1 First version of epk format, not encrypted and not signed
epk v2 Introduces signing and encryption, keys needed
epk v3 Introduced with WebOS. Keys needed
Mediatek pkg UPG/PKG files used by Hisense/Sharp/Philips (missing Philips AES key) and possibly others
Philips "fusion" Upgrade files used by some Philips TVs
squashfs
cramfs
lz4 Slightly modified version with header magic
lzo
gzip
jffs2
lzhs Special compression for MTK bootloaders (boot.pak, tzfw.pak), uses lzss + huffman
lzhs_fs LZHS compressed filesystem used in MTK Upgrade files for the external writable partition (3rdw)
mtdinfo/partinfo LG Partition table format (mtdi.pak, part.pak)
str/pif PVR recording format that can be found in netcast models
sym LG Debugging symbols. Can extract function names and addresses to an IDA script file (idc)

Although epk2extract is only tested on LG firmware files, you may use it to extract other files like a general unpack tool, as long as they are supported according to the table above.

!!WARNING!!
epk2extract isn't designed to repack files
If you wish to repack modified files, follow the openlgtv wiki/forum, and do it in a Linux environment (no cygwin)
Don't repack files extracted in cygwin environment
In any case, you do so at your own risk

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

Tools: Description
lzhsenc Compresses a given file with lzhs algorithm
lzhs_scanner Scans a given file to find lzhs files, and extracts them
idb_extract Extracts Image Database (IDB) files that can be found in LG firmwares

To compile on Linux:

Install build dependencies:

Ubuntu/Debian:

apt-get install git build-essential cmake liblzo2-dev libssl-dev libc6-dev

Mandriva/Mageia:

urpmi git task-c++-devel cmake liblzo-devel libopenssl-devel glibc-devel --auto

Build it

./build.sh

After building, epk2extract can be found in ./build_<platform>/

To compile on Cygwin:

Install Cygwin and during setup select following packages:

Devel -> gcc-g++, git, cmake, make
Libs  -> liblzo2-devel, zlib-devel
Net   -> openssl-devel
Utils -> ncurses

Build it

./build.sh

The build script automatically copies required shared libraries to the ./build_cygwin/ folder, so you can use epk2extract standalone/portable without a full cygwin installation.

=====================

How to speed up extraction process

You can build the test build, which contains compiler optimizations, with this command

CMAKE_FLAGS=-DCMAKE_BUILD_TYPE=Test ./build.sh

The Test build is orders of magnitude faster than the Debug build

To use:

Put *.pem and AES.key files in the same directory as the epk2extract binary.

Run it via sudo/fakeroot to avoid warnings (while extracting device nodes from rootfs):

fakeroot ./epk2extract file

To get IDC from SYM run:

./epk2extract xxxxxxxx.sym

To decode part.pak or mtdi.pak do:

./epk2extract part.pak

Or use partinfo.py (deprected)

python partinfo.py part.pak

epk2extract's People

Contributors

smx-smx avatar gitter-badger avatar mudkip908 avatar

Watchers

James Cloos avatar Pablo Hinojosa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.