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
577a89b3
Commit
577a89b3
authored
Jul 01, 2017
by
Craig Heffner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved CPIO with jump-to directive
parent
969af34b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
cpio.py
src/binwalk/plugins/cpio.py
+11
-2
No files found.
src/binwalk/plugins/cpio.py
View file @
577a89b3
...
...
@@ -73,11 +73,17 @@ class CPIOPlugin(binwalk.core.plugin.Plugin):
def
_get_file_name_length
(
self
,
description
):
length
=
0
if
'file name length: "'
in
description
:
length_string
=
description
.
split
(
'file name length: "'
)[
1
]
.
split
(
'"'
)[
0
]
length_string
=
description
.
split
(
'file name length: "'
)[
1
]
.
split
(
'"'
)[
0
]
length
=
int
(
length_string
,
0
)
return
length
def
_get_file_size
(
self
,
description
):
size
=
0
if
'file size: "'
in
description
:
size_string
=
description
.
split
(
'file size: "'
)[
1
]
.
split
(
'"'
)[
0
]
size
=
int
(
size_string
,
0
)
return
size
def
scan
(
self
,
result
):
if
result
.
valid
:
# ASCII CPIO archives consist of multiple entries, ending with an entry named 'TRAILER!!!'.
...
...
@@ -87,6 +93,7 @@ class CPIOPlugin(binwalk.core.plugin.Plugin):
if
result
.
description
.
startswith
(
'ASCII cpio archive'
):
# Validate the reported name length
file_size
=
self
.
_get_file_size
(
result
.
description
)
file_name
=
self
.
_get_file_name
(
result
.
description
)
file_name_length
=
self
.
_get_file_name_length
(
result
.
description
)
...
...
@@ -94,6 +101,8 @@ class CPIOPlugin(binwalk.core.plugin.Plugin):
if
file_name_length
not
in
[
len
(
file_name
),
len
(
file_name
)
+
1
]:
result
.
valid
=
False
return
else
:
result
.
jump
=
file_size
+
file_name_length
self
.
consecutive_hits
+=
1
...
...
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