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
a7e4b1ca
Commit
a7e4b1ca
authored
May 08, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed cpio extraction bug; added extra extraction debugging statements
parent
f024a2e5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
entropy.py
src/binwalk/modules/entropy.py
+1
-1
extractor.py
src/binwalk/modules/extractor.py
+8
-0
cpio.py
src/binwalk/plugins/cpio.py
+9
-1
No files found.
src/binwalk/modules/entropy.py
View file @
a7e4b1ca
...
...
@@ -38,7 +38,7 @@ class Entropy(Module):
kwargs
=
{
'do_plot'
:
False
},
description
=
'Do not generate an entropy plot graph'
),
Option
(
short
=
'Q'
,
long
=
'legend'
,
long
=
'
n
legend'
,
kwargs
=
{
'show_legend'
:
False
},
description
=
'Omit the legend from the entropy plot graph'
),
]
...
...
src/binwalk/modules/extractor.py
View file @
a7e4b1ca
...
...
@@ -114,9 +114,15 @@ class Extractor(Module):
else
:
size
=
r
.
size
if
r
.
valid
:
binwalk
.
core
.
common
.
debug
(
"Extractor callback for
%
s:
%
d [
%
s &
%
s &
%
s]"
%
(
r
.
file
.
name
,
r
.
offset
,
str
(
r
.
valid
),
str
(
r
.
display
),
str
(
r
.
extract
)))
# Only extract valid results displayed to the user and marked for extraction
# TODO: Results excluded via -x/-y options should be marked as invalid; filtering on r.display means that
# with -q specified, nothing gets extracted!
if
r
.
valid
and
r
.
display
and
r
.
extract
:
# Do the extraction
binwalk
.
core
.
common
.
debug
(
"Attempting extraction..."
)
(
extraction_directory
,
dd_file
)
=
self
.
extract
(
r
.
offset
,
r
.
description
,
r
.
file
.
name
,
size
,
r
.
name
)
# If the extraction was successful, self.extract will have returned the output directory and name of the dd'd file
...
...
@@ -541,6 +547,8 @@ class Extractor(Module):
tmp
=
None
retval
=
True
binwalk
.
core
.
common
.
debug
(
"Running extractor '
%
s'"
%
str
(
cmd
))
try
:
if
callable
(
cmd
):
try
:
...
...
src/binwalk/plugins/cpio.py
View file @
a7e4b1ca
...
...
@@ -10,6 +10,7 @@ class CPIOPlugin(binwalk.core.plugin.Plugin):
def
pre_scan
(
self
):
# Be sure to re-set this at the beginning of every scan
self
.
found_archive
=
False
self
.
found_archive_in_file
=
None
def
scan
(
self
,
result
):
if
result
.
valid
:
...
...
@@ -17,8 +18,9 @@ class CPIOPlugin(binwalk.core.plugin.Plugin):
# Displaying each entry is useful, as it shows what files are contained in the archive,
# but we only want to extract the archive when the first entry is found.
if
result
.
description
.
startswith
(
'ASCII cpio archive'
):
if
not
self
.
found_archive
:
if
not
self
.
found_archive
or
self
.
found_archive_in_file
!=
result
.
file
.
name
:
# This is the first entry. Set found_archive and allow the scan to continue normally.
self
.
found_archive_in_file
=
result
.
file
.
name
self
.
found_archive
=
True
result
.
extract
=
True
elif
'TRAILER!!!'
in
result
.
description
:
...
...
@@ -29,3 +31,9 @@ class CPIOPlugin(binwalk.core.plugin.Plugin):
# The first entry has already been found and this is not the last entry, or the last entry
# has not yet been found. Don't extract.
result
.
extract
=
False
else
:
# If this was a valid non-CPIO archive result, reset these values; else, a previous
# false positive CPIO result could leave these set, causing a subsequent valid CPIO
# result to not be extracted.
self
.
found_archive
=
False
self
.
found_archive_in_file
=
None
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