Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
binwalk
Commits
ecb7b7d6
Commit
ecb7b7d6
authored
Oct 23, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated signature module to not load if lzma is not available
parent
347ac4b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
__init__.py
src/binwalk/modules/__init__.py
+6
-1
signature.py
src/binwalk/modules/signature.py
+3
-0
lzmavalid.py
src/binwalk/plugins/lzmavalid.py
+5
-2
No files found.
src/binwalk/modules/__init__.py
View file @
ecb7b7d6
...
...
@@ -10,7 +10,12 @@ try:
except
ImportError
:
pass
from
binwalk.modules.signature
import
Signature
# Don't load the signature module if the lzma module can't be found
try
:
from
binwalk.modules.signature
import
Signature
except
ImportError
:
pass
from
binwalk.modules.hexdiff
import
HexDiff
from
binwalk.modules.general
import
General
from
binwalk.modules.extractor
import
Extractor
...
...
src/binwalk/modules/signature.py
View file @
ecb7b7d6
# Basic signature scan module. This is the default (and primary) feature of binwalk.
# This module does not directly use the lzma module, but some plugins for this module do.
# If the lzma import fails, this module won't be loaded at all.
import
lzma
import
binwalk.core.magic
import
binwalk.core.smart
import
binwalk.core.parser
...
...
src/binwalk/plugins/lzmavalid.py
View file @
ecb7b7d6
import
lzma
import
binwalk.core.plugin
import
binwalk.core.compat
from
binwalk.core.common
import
BlockFile
...
...
@@ -16,12 +15,16 @@ class LZMAPlugin(binwalk.core.plugin.Plugin):
# Check up to the first 64KB
MAX_DATA_SIZE
=
64
*
1024
def
init
(
self
):
import
lzma
self
.
decompressor
=
lzma
.
decompress
def
is_valid_lzma
(
self
,
data
):
valid
=
True
# The only acceptable exceptions are those indicating that the input data was truncated.
try
:
lzma
.
decompress
(
binwalk
.
core
.
compat
.
str2bytes
(
data
))
self
.
decompressor
(
binwalk
.
core
.
compat
.
str2bytes
(
data
))
except
IOError
as
e
:
# The Python2 module gives this error on truncated input data.
if
str
(
e
)
!=
"unknown BUF error"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment