Name | ubi-reader JSON |
Version |
0.8.9
JSON |
| download |
home_page | |
Summary | Extract files from UBI and UBIFS images. |
upload_time | 2023-05-29 18:38:46 |
maintainer | |
docs_url | https://pythonhosted.org/ubi-reader/ |
author | ONEKEY |
requires_python | >=3.8,<4.0 |
license | GNU GPL |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# UBI Reader
UBI Reader is a Python module and collection of scripts capable of extracting
the contents of UBI and UBIFS images, along with analyzing these images to
determine the parameter settings to recreate them using the mtd-utils tools.
### Known Issues
These are some known issues, that prevent an exact data dump from occuring.
* This does not replay the journal, so uncommited data will not be retrieved. Data can be in the journal with both clean and unclean shutdowns.
* Depending on how the NAND was dumped, the data bits may not be error corrected.
* Socket files will be ignored, you can change ubireader/settings.py to have it create dummy files in their place.
## Testing Branch
The testing branch includes a tools/ directory, that has scripts to help when trying to extract data from broken images. These also serve as examples of how to use parts of ubi_reader in custom scripts.
An override system is also included, for manually setting certain parameters that may be reported wrong by the UBI/FS data.
This branch will probably remain seperate, as it is meant to be customized to aid in extracting data from problematic images. You can install it with 'python setup.py develop' to make it easier to modify ubi_reader as needed.
## Installation:
Latest Version
$ git clone https://github.com/jrspruitt/ubi_reader
$ cd ubi_reader
$ poetry install
Or
$ pip install --user ubi_reader
## Usage:
For basic usage, the scripts need no options and if applicable will save output
to ./ubifs-root/. More advanced usage can set start and end offset, specify
an output directory, or for debugging can print out what it is doing to the
terminal.
Run program with -h or --help for explanation of options.
## Extracting File Contents:
ubireader_extract_files [options] path/to/file
The script accepts a file with UBI or UBIFS data in it, so should work with a NAND
dump. It will search for the first occurance of UBI or UBIFS data and attempt to
extract the contents. If file includes special files, you will need to run as
root or sudo for it to create these files. With out it, it'll skip them and show a
warning that these files were not created.
## List/Copy Files:
ubireader_list_files [options] path/to/file
The script accepts a file with UBI or UBIFS data in it, so should work with a NAND
dump. It will search for the first occurance of UBI or UBIFS data and treat it as
a UBIFS. To list files supply the path to list (-P, --path), e.g. "-P /" to list
the filesystems root directory. To copy a file from the filesystem to a local directory
supply the source path (-C, --copy) and the destination path (-D, --copy-dest),
e.g. -C /etc/passwd -D . (extract /etc/passwd from the UBIFS image and copy it to
local directory).
## Extracting Images:
ubireader_extract_images [options] path/to/file
This script will extract the whole UBI or UBIFS image from a NAND dump, or the UBIFS
image from a UBI image. You can specify what type of image to extract by setting the
(-u, --image-type) option to "UBI" or "UBIFS". Default is "UBIFS".
## MTD-Utils Parameters:
ubireader_utils_info [options] path/to/file
The script will analyze a UBI image and create a Linux shell script and UBI config
file that can be used for building new UBI images to the same specifications. For
just a printed list of the options and values, use the (-r, --show-only) option.
## Display Information:
ubireader_display_info [options] path/to/file
Depending on the image type found, this script displays some UBI information along with
the header info from the layout block, including volume table records. If it is a UBIFS
image, the Super Node, and both Master Nodes are displayed. Using the (-u, --ubifs-info)
option, it will get the UBIFS info from inside a UBI file instead.
## Display Block Information:
ubireader_display_blocks [options] "{'block.attr':?, ...}" path/to/file
Search for and display block information. This can be used for debugging failed image
and file extractions. The blocks are searched for using a double quoted Python Dict of
search paramaters, example. "{'peb_num':[0, 1] + range(100, 102), 'ec_hdr.ec': 1, 'is_valid': True}"
This will find PEBs 0, 1, 100, 101, 102, with an erase count of 1 that is a valid block.
Can use any of the parameters in ubireader.ubi.block.description.
## Options:
Some general option flags are
* -l, --log: This prints to screen actions being taken while running.
* -v, --verbose: This basically prints everything about anything happening.
* -p, --peb-size int: Specify PEB size of the UBI image, instead of having it guess.
* -e, --leb-size int: Specify LEB size of UBIFS image, instead of having it guess.
* -s, --start-offset int: Tell script to look for UBI/UBIFS data at given address.
* -n, --end-offset int: Tell script to ignore data after given address in data.
* -g, --guess-offset: Specify offset to start guessing where UBI data is in file. Useful for NAND dumps with false positives before image.
* -w, --warn-only-block-read-errors: Attempts to continue extracting files even with bad block reads. Some data will be missing or corrupted!
* -i, --ignore-block-header-errors: Forces unused and error containing blocks to be included and also displayed with log/verbose.
* -f, --u-boot-fix: Assume blocks with image_seq 0 are because of older U-boot implementations and include them. *This may cause issues with multiple UBI image files.
* -o, --output-dir path: Specify where files should be written to, instead of ubi_reader/output
Raw data
{
"_id": null,
"home_page": "",
"name": "ubi-reader",
"maintainer": "",
"docs_url": "https://pythonhosted.org/ubi-reader/",
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "ONEKEY",
"author_email": "support@onekey.com",
"download_url": "https://files.pythonhosted.org/packages/70/a3/2970c204adf7053ad94045290c501bf27905fb279438c2c20d00c43510ee/ubi_reader-0.8.9.tar.gz",
"platform": null,
"description": "# UBI Reader\nUBI Reader is a Python module and collection of scripts capable of extracting\nthe contents of UBI and UBIFS images, along with analyzing these images to\ndetermine the parameter settings to recreate them using the mtd-utils tools.\n\n\n### Known Issues\nThese are some known issues, that prevent an exact data dump from occuring.\n\n* This does not replay the journal, so uncommited data will not be retrieved. Data can be in the journal with both clean and unclean shutdowns.\n\n* Depending on how the NAND was dumped, the data bits may not be error corrected.\n\n* Socket files will be ignored, you can change ubireader/settings.py to have it create dummy files in their place.\n\n\n## Testing Branch\nThe testing branch includes a tools/ directory, that has scripts to help when trying to extract data from broken images. These also serve as examples of how to use parts of ubi_reader in custom scripts.\n\nAn override system is also included, for manually setting certain parameters that may be reported wrong by the UBI/FS data.\n\nThis branch will probably remain seperate, as it is meant to be customized to aid in extracting data from problematic images. You can install it with 'python setup.py develop' to make it easier to modify ubi_reader as needed.\n\n\n## Installation:\n\nLatest Version\n\n $ git clone https://github.com/jrspruitt/ubi_reader\n $ cd ubi_reader\n $ poetry install\n\nOr\n\n $ pip install --user ubi_reader\n\n\n## Usage:\nFor basic usage, the scripts need no options and if applicable will save output\nto ./ubifs-root/. More advanced usage can set start and end offset, specify\nan output directory, or for debugging can print out what it is doing to the\nterminal.\n\nRun program with -h or --help for explanation of options.\n\n## Extracting File Contents:\n ubireader_extract_files [options] path/to/file\n\nThe script accepts a file with UBI or UBIFS data in it, so should work with a NAND\ndump. It will search for the first occurance of UBI or UBIFS data and attempt to\nextract the contents. If file includes special files, you will need to run as\nroot or sudo for it to create these files. With out it, it'll skip them and show a\nwarning that these files were not created.\n\n## List/Copy Files:\n ubireader_list_files [options] path/to/file\n\nThe script accepts a file with UBI or UBIFS data in it, so should work with a NAND\ndump. It will search for the first occurance of UBI or UBIFS data and treat it as\na UBIFS. To list files supply the path to list (-P, --path), e.g. \"-P /\" to list\nthe filesystems root directory. To copy a file from the filesystem to a local directory\nsupply the source path (-C, --copy) and the destination path (-D, --copy-dest),\ne.g. -C /etc/passwd -D . (extract /etc/passwd from the UBIFS image and copy it to\nlocal directory).\n\n## Extracting Images:\n ubireader_extract_images [options] path/to/file\n\nThis script will extract the whole UBI or UBIFS image from a NAND dump, or the UBIFS\nimage from a UBI image. You can specify what type of image to extract by setting the\n(-u, --image-type) option to \"UBI\" or \"UBIFS\". Default is \"UBIFS\".\n\n## MTD-Utils Parameters:\n ubireader_utils_info [options] path/to/file\n\nThe script will analyze a UBI image and create a Linux shell script and UBI config\nfile that can be used for building new UBI images to the same specifications. For\njust a printed list of the options and values, use the (-r, --show-only) option.\n\n## Display Information:\n ubireader_display_info [options] path/to/file\n\nDepending on the image type found, this script displays some UBI information along with\nthe header info from the layout block, including volume table records. If it is a UBIFS\nimage, the Super Node, and both Master Nodes are displayed. Using the (-u, --ubifs-info)\noption, it will get the UBIFS info from inside a UBI file instead.\n\n## Display Block Information:\n ubireader_display_blocks [options] \"{'block.attr':?, ...}\" path/to/file\n\nSearch for and display block information. This can be used for debugging failed image\nand file extractions. The blocks are searched for using a double quoted Python Dict of\nsearch paramaters, example. \"{'peb_num':[0, 1] + range(100, 102), 'ec_hdr.ec': 1, 'is_valid': True}\"\nThis will find PEBs 0, 1, 100, 101, 102, with an erase count of 1 that is a valid block.\nCan use any of the parameters in ubireader.ubi.block.description.\n\n## Options:\nSome general option flags are\n* -l, --log: This prints to screen actions being taken while running.\n* -v, --verbose: This basically prints everything about anything happening.\n* -p, --peb-size int: Specify PEB size of the UBI image, instead of having it guess.\n* -e, --leb-size int: Specify LEB size of UBIFS image, instead of having it guess.\n* -s, --start-offset int: Tell script to look for UBI/UBIFS data at given address.\n* -n, --end-offset int: Tell script to ignore data after given address in data.\n* -g, --guess-offset: Specify offset to start guessing where UBI data is in file. Useful for NAND dumps with false positives before image.\n* -w, --warn-only-block-read-errors: Attempts to continue extracting files even with bad block reads. Some data will be missing or corrupted!\n* -i, --ignore-block-header-errors: Forces unused and error containing blocks to be included and also displayed with log/verbose.\n* -f, --u-boot-fix: Assume blocks with image_seq 0 are because of older U-boot implementations and include them. *This may cause issues with multiple UBI image files.\n* -o, --output-dir path: Specify where files should be written to, instead of ubi_reader/output\n",
"bugtrack_url": null,
"license": "GNU GPL",
"summary": "Extract files from UBI and UBIFS images.",
"version": "0.8.9",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "90d902d3113a021fc89fdf33846859ca7b54fd9a05b3a3f6878fc8a8895c30f6",
"md5": "e8ba08adec3642af6da8d89197cd2051",
"sha256": "b079af81201e29d8bdf91dc9c3e51acf88d2a47770a1de3e7ff3a45bfb4b2223"
},
"downloads": -1,
"filename": "ubi_reader-0.8.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e8ba08adec3642af6da8d89197cd2051",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 70258,
"upload_time": "2023-05-29T18:38:45",
"upload_time_iso_8601": "2023-05-29T18:38:45.008926Z",
"url": "https://files.pythonhosted.org/packages/90/d9/02d3113a021fc89fdf33846859ca7b54fd9a05b3a3f6878fc8a8895c30f6/ubi_reader-0.8.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "70a32970c204adf7053ad94045290c501bf27905fb279438c2c20d00c43510ee",
"md5": "4d6af26b1fdf00f71a9e964922b6b314",
"sha256": "6fa269f3107a8e27b7e45fe82c479ad5117e17c27ae008a2404dffb9fc2ed661"
},
"downloads": -1,
"filename": "ubi_reader-0.8.9.tar.gz",
"has_sig": false,
"md5_digest": "4d6af26b1fdf00f71a9e964922b6b314",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 45873,
"upload_time": "2023-05-29T18:38:46",
"upload_time_iso_8601": "2023-05-29T18:38:46.890974Z",
"url": "https://files.pythonhosted.org/packages/70/a3/2970c204adf7053ad94045290c501bf27905fb279438c2c20d00c43510ee/ubi_reader-0.8.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-29 18:38:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ubi-reader"
}