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
fba87c16
Commit
fba87c16
authored
Nov 16, 2013
by
heffnercj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All scans now accept negative offsets for the --offset parameter
parent
9c3234cd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
3 deletions
+15
-3
__init__.py
src/binwalk/__init__.py
+3
-1
common.py
src/binwalk/common.py
+6
-1
compression.py
src/binwalk/compression.py
+1
-1
entropy.py
src/binwalk/entropy.py
+1
-0
hexdiff.py
src/binwalk/hexdiff.py
+3
-0
smartstrings.py
src/binwalk/smartstrings.py
+1
-0
No files found.
src/binwalk/__init__.py
View file @
fba87c16
...
@@ -454,7 +454,9 @@ class Binwalk(object):
...
@@ -454,7 +454,9 @@ class Binwalk(object):
if
fd
is
None
:
if
fd
is
None
:
fd
=
BlockFile
(
target_file
,
length
=
self
.
scan_length
,
offset
=
offset
)
fd
=
BlockFile
(
target_file
,
length
=
self
.
scan_length
,
offset
=
offset
)
i_opened_fd
=
True
i_opened_fd
=
True
# If offset is negative (bytes from EOF), BlockFile class will autmoatically calculate the right offset
offset
=
fd
.
offset
# Seek to the starting offset.
# Seek to the starting offset.
#fd.seek(offset)
#fd.seek(offset)
...
...
src/binwalk/common.py
View file @
fba87c16
...
@@ -114,17 +114,22 @@ class BlockFile(file):
...
@@ -114,17 +114,22 @@ class BlockFile(file):
@fname - Path to the file to be opened.
@fname - Path to the file to be opened.
@mode - Mode to open the file in.
@mode - Mode to open the file in.
@length - Maximum number of bytes to read from the file via self.block_read().
@length - Maximum number of bytes to read from the file via self.block_read().
@offset - Offset at which to start reading from the file.
Returns None.
Returns None.
'''
'''
self
.
total_read
=
0
self
.
total_read
=
0
self
.
offset
=
offset
try
:
try
:
self
.
size
=
file_size
(
fname
)
self
.
size
=
file_size
(
fname
)
except
:
except
:
self
.
size
=
0
self
.
size
=
0
if
offset
<
0
:
self
.
offset
=
self
.
size
+
offset
else
:
self
.
offset
=
offset
if
length
:
if
length
:
self
.
length
=
length
self
.
length
=
length
else
:
else
:
...
...
src/binwalk/compression.py
View file @
fba87c16
...
@@ -153,7 +153,7 @@ class CompressionEntropyAnalyzer(object):
...
@@ -153,7 +153,7 @@ class CompressionEntropyAnalyzer(object):
if
self
.
fp
.
READ_BLOCK_SIZE
<
self
.
BLOCK_SIZE
:
if
self
.
fp
.
READ_BLOCK_SIZE
<
self
.
BLOCK_SIZE
:
self
.
fp
.
READ_BLOCK_SIZE
=
self
.
BLOCK_SIZE
self
.
fp
.
READ_BLOCK_SIZE
=
self
.
BLOCK_SIZE
self
.
start
=
s
tar
t
self
.
start
=
s
elf
.
fp
.
offse
t
self
.
length
=
length
self
.
length
=
length
self
.
binwalk
=
binwalk
self
.
binwalk
=
binwalk
...
...
src/binwalk/entropy.py
View file @
fba87c16
...
@@ -135,6 +135,7 @@ class FileEntropy(object):
...
@@ -135,6 +135,7 @@ class FileEntropy(object):
self
.
block
=
self
.
DEFAULT_BLOCK_SIZE
self
.
block
=
self
.
DEFAULT_BLOCK_SIZE
self
.
fd
=
common
.
BlockFile
(
file_name
,
'rb'
,
offset
=
self
.
start
,
length
=
self
.
length
)
self
.
fd
=
common
.
BlockFile
(
file_name
,
'rb'
,
offset
=
self
.
start
,
length
=
self
.
length
)
self
.
start
=
self
.
fd
.
offset
self
.
fd
.
MAX_TRAILING_SIZE
=
0
self
.
fd
.
MAX_TRAILING_SIZE
=
0
if
self
.
fd
.
READ_BLOCK_SIZE
<
self
.
block
:
if
self
.
fd
.
READ_BLOCK_SIZE
<
self
.
block
:
self
.
fd
.
READ_BLOCK_SIZE
=
self
.
block
self
.
fd
.
READ_BLOCK_SIZE
=
self
.
block
...
...
src/binwalk/hexdiff.py
View file @
fba87c16
...
@@ -117,6 +117,9 @@ class HexDiff(object):
...
@@ -117,6 +117,9 @@ class HexDiff(object):
fp
.
MAX_TRAILING_SIZE
=
0
fp
.
MAX_TRAILING_SIZE
=
0
fps
.
append
(
fp
)
fps
.
append
(
fp
)
# BlockFile handles calculation of negative offsets, if one was specified
offset
=
fps
[
0
]
.
offset
while
total
<
size
:
while
total
<
size
:
i
=
0
i
=
0
for
fp
in
fps
:
for
fp
in
fps
:
...
...
src/binwalk/smartstrings.py
View file @
fba87c16
...
@@ -79,6 +79,7 @@ class FileStrings(object):
...
@@ -79,6 +79,7 @@ class FileStrings(object):
# TODO: This is not optimal. We should read in larger chunks and process it into self.block chunks.
# TODO: This is not optimal. We should read in larger chunks and process it into self.block chunks.
self
.
fd
.
READ_BLOCK_SIZE
=
self
.
block
self
.
fd
.
READ_BLOCK_SIZE
=
self
.
block
self
.
fd
.
MAX_TRAILING_SIZE
=
0
self
.
fd
.
MAX_TRAILING_SIZE
=
0
self
.
start
=
self
.
fd
.
offset
# Set the total_scanned and scan_length values for plugins and status display messages
# Set the total_scanned and scan_length values for plugins and status display messages
self
.
binwalk
.
total_scanned
=
0
self
.
binwalk
.
total_scanned
=
0
...
...
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