Commit d62159ce by devttys0

Cleaned up lzmaextract.py plugin code

parent 1d4dbcb1
import os
import lzma
import binwalk.core.plugin
class LZMAExtractPlugin(binwalk.core.plugin.Plugin):
......@@ -9,6 +8,9 @@ class LZMAExtractPlugin(binwalk.core.plugin.Plugin):
MODULES = ['Signature']
def init(self):
import lzma
self.decompressor = lzma.decompress
# If the extractor is enabled for the module we're currently loaded
# into, then register self.extractor as a zlib extraction rule.
if self.module.extractor.enabled:
......@@ -26,8 +28,7 @@ class LZMAExtractPlugin(binwalk.core.plugin.Plugin):
compressed = fpin.read()
fpin.close()
decompressed = lzma.decompress(compressed)
print ("Decompressed %d bytes" % len(decompressed))
decompressed = self.decompressor(compressed)
fpout = open(outfile, "wb")
fpout.write(decompressed)
......
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