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-depend
binwalk
Commits
e74bec93
Commit
e74bec93
authored
Jul 27, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dup method to binwalk.core.common.BlockFile, fixed documentation typos
parent
57789cda
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
common.py
src/binwalk/core/common.py
+16
-3
No files found.
src/binwalk/core/common.py
View file @
e74bec93
...
...
@@ -226,17 +226,17 @@ class BlockFile(BLOCK_FILE_PARENT_CLASS):
namely things that are wrappers around self.read (e.g., readline, readlines, etc).
This class also provides a read_block method, which is used by binwalk to read in a
block of data, plus some additional data (
MAX_TRAILING
_SIZE), but on the next block read
block of data, plus some additional data (
DEFAULT_BLOCK_PEEK
_SIZE), but on the next block read
pick up at the end of the previous data block (not the end of the additional data). This
is necessary for scans where a signature may span a block boundary.
The descision to force read to return a str object instead of a bytes object is questionable
for Python 3, it seemed the best way to abstract differences in Python 2/3 from the rest
for Python 3,
but
it seemed the best way to abstract differences in Python 2/3 from the rest
of the code (especially for people writing plugins) and to add Python 3 support with
minimal code change.
'''
# The
MAX_TRAILING
_SIZE limits the amount of data available to a signature.
# The
DEFAULT_BLOCK_PEEK
_SIZE limits the amount of data available to a signature.
# While most headers/signatures are far less than this value, some may reference
# pointers in the header structure which may point well beyond the header itself.
# Passing the entire remaining buffer to libmagic is resource intensive and will
...
...
@@ -427,3 +427,16 @@ class BlockFile(BLOCK_FILE_PARENT_CLASS):
return
(
data
,
dlen
)
def
dup
(
self
):
'''
Creates a new BlockFile instance with all the same initialization settings as this one.
Returns new BlockFile object.
'''
return
BlockFile
(
self
.
name
,
length
=
self
.
length
,
offset
=
self
.
offset
,
block
=
self
.
base_block_read_size
,
peek
=
self
.
base_peek_size
,
swap
=
self
.
swap
)
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