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
3b41d46d
Commit
3b41d46d
authored
Dec 22, 2013
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed module dependency bug
parent
1ed3752f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
16 deletions
+19
-16
common.py
src/binwalk/core/common.py
+10
-1
module.py
src/binwalk/core/module.py
+6
-12
configuration.py
src/binwalk/modules/configuration.py
+2
-2
signature.py
src/binwalk/modules/signature.py
+1
-1
No files found.
src/binwalk/core/common.py
View file @
3b41d46d
...
...
@@ -261,9 +261,11 @@ class BlockFile(BLOCK_FILE_PARENT_CLASS):
if
block
>
0
:
self
.
READ_BLOCK_SIZE
=
block
self
.
base_block_size
=
self
.
READ_BLOCK_SIZE
if
trail
>
0
:
self
.
MAX_TRAILING_SIZE
=
trail
self
.
base_trail_size
=
self
.
MAX_TRAILING_SIZE
super
(
self
.
__class__
,
self
)
.
__init__
(
fname
,
mode
)
...
...
@@ -297,8 +299,15 @@ class BlockFile(BLOCK_FILE_PARENT_CLASS):
return
data
def
reset
(
self
):
self
.
set_block_size
(
block
=
self
.
base_trail_size
,
trail
=
self
.
base_trail_size
)
self
.
seek
(
self
.
offset
)
def
set_block_size
(
self
,
block
=
0
,
trail
=
0
):
if
block
is
not
None
:
self
.
READ_BLOCK_SIZE
=
block
if
trail
is
not
None
:
self
.
MAX_TRAILING_SIZE
=
trail
def
write
(
self
,
data
):
'''
Writes data to the opened file.
...
...
src/binwalk/core/module.py
View file @
3b41d46d
...
...
@@ -543,8 +543,6 @@ class Modules(object):
# If the module is not being loaded as a dependency, add it to the loaded modules dictionary
if
not
dependency
:
self
.
loaded_modules
[
module
]
=
obj
if
not
kwargs
and
not
has_key
(
self
.
default_dependency_modules
,
module
):
self
.
default_dependency_modules
[
module
]
=
obj
return
obj
...
...
@@ -572,18 +570,14 @@ class Modules(object):
if
dependency
.
module
==
module
:
continue
# Only
honor
custom kwargs from modules that are enabled, else madness ensues.
# Only
load dependencies with
custom kwargs from modules that are enabled, else madness ensues.
# Example: Heursitic module depends on entropy module, and sets entropy kwargs to contain 'enabled' : True.
# Without this check, an entropy scan would always be run, even if -H or -E weren't specified!
if
module_enabled
:
kwargs
=
dependency
.
kwargs
else
:
kwargs
=
{}
if
not
kwargs
and
has_key
(
self
.
default_dependency_modules
,
dependency
.
module
):
depobj
=
self
.
default_dependency_modules
[
dependency
.
module
]
else
:
depobj
=
self
.
run
(
dependency
.
module
,
dependency
=
True
,
kwargs
=
kwargs
)
#
# Modules that are not enabled (e.g., extraction module) can load any dependency as long as they don't
# set any custom kwargs for those dependencies.
if
module_enabled
or
not
dependency
.
kwargs
:
depobj
=
self
.
run
(
dependency
.
module
,
dependency
=
True
,
kwargs
=
dependency
.
kwargs
)
# If a dependency failed, consider this a non-recoverable error and raise an exception
if
depobj
.
errors
:
...
...
src/binwalk/modules/configuration.py
View file @
3b41d46d
...
...
@@ -152,7 +152,7 @@ class Configuration(Module):
if
len
(
self
.
target_files
)
>
1
and
not
self
.
verbose
:
self
.
verbose
=
True
def
open_file
(
self
,
fname
,
length
=
None
,
offset
=
None
,
swap
=
None
):
def
open_file
(
self
,
fname
,
length
=
None
,
offset
=
None
,
swap
=
None
,
block
=
0
,
trail
=
0
):
'''
Opens the specified file with all pertinent configuration settings.
'''
...
...
@@ -163,7 +163,7 @@ class Configuration(Module):
if
swap
is
None
:
swap
=
self
.
swap_size
return
binwalk
.
core
.
common
.
BlockFile
(
fname
,
length
=
length
,
offset
=
offset
,
swap
=
swap
)
return
binwalk
.
core
.
common
.
BlockFile
(
fname
,
length
=
length
,
offset
=
offset
,
swap
=
swap
,
block
=
block
,
trail
=
trail
)
def
_open_target_files
(
self
):
'''
...
...
src/binwalk/modules/signature.py
View file @
3b41d46d
...
...
@@ -98,7 +98,7 @@ class Signature(Module):
break
current_block_offset
=
0
block_start
=
fp
.
offset
+
fp
.
t
otal_read
-
dlen
block_start
=
fp
.
offset
+
fp
.
t
ell
()
-
dlen
self
.
status
.
completed
=
block_start
-
fp
.
offset
for
candidate_offset
in
self
.
parser
.
find_signature_candidates
(
data
,
dlen
):
...
...
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