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
5c4291ec
Commit
5c4291ec
authored
Jan 06, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed heursitc module bug; fixed fundamental issue with specifying module-level dependencies.
parent
9258050b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
module.py
src/binwalk/core/module.py
+11
-9
general.py
src/binwalk/modules/general.py
+1
-1
heuristics.py
src/binwalk/modules/heuristics.py
+0
-2
No files found.
src/binwalk/core/module.py
View file @
5c4291ec
...
...
@@ -140,16 +140,18 @@ class Module(object):
# A list of binwalk.core.module.Kwargs accepted by __init__
KWARGS
=
[]
# A dictionary of module dependencies; all modules depend on the General and Extractor modules.
# Note that if overriding these default DEPENDS for a module, you MUST include these default
# dependencies, with the same attribute values.
DEPENDS
=
[
# A list of default dependencies for all modules; do not override this unless you
# understand the consequences of doing so.
DEFAULT_DEPENDS
=
[
Dependency
(
name
=
'General'
,
attribute
=
'config'
),
Dependency
(
name
=
'Extractor'
,
attribute
=
'extractor'
),
]
# A list of dependencies that can be filled in as needed by each individual module.
DEPENDS
=
[]
# Format string for printing the header during a scan.
# Must be set prior to calling self.header.
HEADER_FORMAT
=
"
%-12
s
%-12
s
%
s
\n
"
...
...
@@ -195,12 +197,14 @@ class Module(object):
def
__init__
(
self
,
**
kwargs
):
self
.
errors
=
[]
self
.
results
=
[]
self
.
target_file_list
=
[]
self
.
status
=
None
self
.
enabled
=
False
self
.
current_target_file_name
=
None
self
.
name
=
self
.
__class__
.
__name__
self
.
plugins
=
binwalk
.
core
.
plugin
.
Plugins
(
self
)
self
.
dependencies
=
self
.
DEFAULT_DEPENDS
+
self
.
DEPENDS
process_kwargs
(
self
,
kwargs
)
...
...
@@ -357,7 +361,7 @@ class Module(object):
self
.
validate
(
r
)
self
.
_plugins_result
(
r
)
for
dependency
in
self
.
DEPENDS
:
for
dependency
in
self
.
dependencies
:
try
:
getattr
(
self
,
dependency
.
attribute
)
.
callback
(
r
)
except
AttributeError
:
...
...
@@ -424,7 +428,7 @@ class Module(object):
self
.
modules
=
parent
.
loaded_modules
# Reset all dependency modules
for
dependency
in
self
.
DEPENDS
:
for
dependency
in
self
.
dependencies
:
if
hasattr
(
self
,
dependency
.
attribute
):
getattr
(
self
,
dependency
.
attribute
)
.
reset
()
...
...
@@ -628,9 +632,7 @@ class Modules(object):
import
binwalk.modules
attributes
=
{}
if
hasattr
(
module
,
"DEPENDS"
):
for
dependency
in
module
.
DEPENDS
:
for
dependency
in
module
.
DEFAULT_DEPENDS
+
module
.
DEPENDS
:
# The dependency module must be imported by binwalk.modules.__init__.py
if
hasattr
(
binwalk
.
modules
,
dependency
.
name
):
...
...
src/binwalk/modules/general.py
View file @
5c4291ec
...
...
@@ -13,7 +13,7 @@ class General(Module):
TITLE
=
"General"
ORDER
=
0
DEPENDS
=
[]
DE
FAULT_DE
PENDS
=
[]
CLI
=
[
Option
(
long
=
'length'
,
...
...
src/binwalk/modules/heuristics.py
View file @
5c4291ec
...
...
@@ -88,8 +88,6 @@ class HeuristicCompressionAnalyzer(Module):
TITLE
=
"Heuristic Compression"
DEPENDS
=
[
Dependency
(
name
=
'General'
,
attribute
=
'config'
),
Dependency
(
name
=
'Entropy'
,
attribute
=
'entropy'
,
kwargs
=
{
'enabled'
:
True
,
'do_plot'
:
False
,
'display_results'
:
False
,
'block_size'
:
ENTROPY_BLOCK_SIZE
}),
...
...
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