Commit 9eefb489 by sviehb

use internal lzmaextract for xz and 7z as an alternative (tar can only tar.xz files)

parent a450bdf6
......@@ -20,13 +20,14 @@
#
# o gzip
# o lzma
# o xz
#
#######################################################################################################################################
# Assumes these utilities are installed in $PATH.
^gzip compressed data:gz:gzip -d -f '%e':0,2
^lzma compressed data:7z:7z e -y '%e':0,1
^xz compressed data:tar:tar xJf '%e'
^xz compressed data:xz:7z e -y '%e':0,1
^bzip2 compressed data:bz2:bzip2 -d '%e'
^compress'd data:Z:gzip -d '%e'
^zip archive data:zip:7z x -y '%e' -p '':0,1
......
......@@ -9,7 +9,9 @@ class LZMAExtractPlugin(binwalk.core.plugin.Plugin):
def init(self):
try:
import lzma
# lzma package in Python 2.0 decompress() does not handle multiple
# compressed streams, only first stream is extracted.
# backports.lzma package could be used to keep consistent behaviour.
self.decompressor = lzma.decompress
# If the extractor is enabled for the module we're currently loaded
......@@ -19,6 +21,10 @@ class LZMAExtractPlugin(binwalk.core.plugin.Plugin):
regex="^lzma compressed data",
extension="7z",
cmd=self.extractor)
self.module.extractor.add_rule(txtrule=None,
regex="^xz compressed data",
extension="xz",
cmd=self.extractor)
except ImportError as e:
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment