Looking into param.lfs file

The param.lfs file looks like a simple container for some jpg files. I couldn’t mount it, so i wrote a simple script to extract those jpg files, just so i can look at them. Here are the jpg files i found on the param.lfs:

and here is the script i’ve used to extract them:

#!/bin/bash
# filename: extract-jpg.sh

starts=(`grep -Pabo $'\xFF\xD8' $1 | cut -f 1 -d :`)
ends=(`grep -Pabo $'\xFF\xD9' $1 | cut -f 1 -d :`)

for (( i = 0 ; i < ${#starts[@]} ; i++ )); do
        end=$((ends[$i] + 2))
        count=$((end - starts[$i]))
        echo "-I- Extracting ${starts[$i]}.jpg"
        dd if=$1 bs=1 skip=${starts[$i]} count=$count > ${starts[$i]}.jpg
done

usage: ./extract-jpg.sh param.lfs

Advertisements

6 Comments

    1. i guess searching for a hash is simple, yet i doubt there is.
      you can try replacing the files, only make sure you keep same or less, and continue from there.

      good luck.

  1. Hello, thanks for posting, this tool is very cool. I just have one problem and cannot seem to figure it out (im also a noob, so bear with me). I used your method to extract jpg’s from a Samsung Galaxy Note 2’s param.lfs file, but in the output, two of the files seem corrupted. Is there any insight you can give to me?
    Gnome Image viewer reports an error like so:
    Could not load image ‘442368.jpg’.
    Error interpreting JPEG image file (Improper call to JPEG library in state 201)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s