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
50eb5273
Commit
50eb5273
authored
Nov 29, 2013
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 3D plotting.
parent
436e5117
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
9 deletions
+37
-9
binwalk
src/bin/binwalk
+13
-2
__init__.py
src/binwalk/__init__.py
+7
-6
cmdopts.py
src/binwalk/cmdopts.py
+8
-1
compat.py
src/binwalk/compat.py
+9
-0
No files found.
src/bin/binwalk
View file @
50eb5273
...
...
@@ -2,7 +2,9 @@
import
sys
import
os.path
import
binwalk
import
binwalk.plotter
import
binwalk.cmdopts
import
binwalk.plotter
from
binwalk.compat
import
*
from
threading
import
Thread
from
getopt
import
GetoptError
,
gnu_getopt
as
GetOpt
...
...
@@ -72,6 +74,7 @@ def main():
matryoshka
=
1
block_size
=
0
failed_open_count
=
0
weight
=
None
max_extract_size
=
None
quiet
=
False
do_comp
=
False
...
...
@@ -144,6 +147,8 @@ def main():
save_plot
=
True
elif
opt
in
(
"-N"
,
"--no-plot"
):
show_plot
=
False
elif
opt
in
(
"-3"
,
"--3D"
):
requested_scans
.
append
(
binwalk
.
Binwalk
.
BINVIS
)
elif
opt
in
(
"-E"
,
"--entropy"
):
requested_scans
.
append
(
binwalk
.
Binwalk
.
ENTROPY
)
elif
opt
in
(
"-W"
,
"--diff"
):
...
...
@@ -164,6 +169,8 @@ def main():
requested_scans
.
append
(
binwalk
.
Binwalk
.
STRINGS
)
elif
opt
in
(
"-O"
,
"--skip-unopened"
):
ignore_failed_open
=
True
elif
opt
in
(
"-Z"
,
"--weight"
):
weight
=
binwalk
.
common
.
str2int
(
arg
)
elif
opt
in
(
"-o"
,
"--offset"
):
offset
=
binwalk
.
common
.
str2int
(
arg
)
elif
opt
in
(
"-l"
,
"--length"
):
...
...
@@ -425,6 +432,10 @@ def main():
r
=
bwalk
.
analyze_compression
(
target_files
,
offset
=
offset
,
length
=
length
)
bwalk
.
concatenate_results
(
results
,
r
)
elif
scan_type
==
binwalk
.
Binwalk
.
BINVIS
:
binwalk
.
plotter
.
Plotter3D
(
target_files
,
offset
=
offset
,
length
=
length
,
weight
=
weight
,
verbose
=
verbose
)
.
plot
()
elif
scan_type
==
binwalk
.
Binwalk
.
ENTROPY
:
if
not
results
:
...
...
@@ -458,8 +469,8 @@ def main():
pass
except
IOError
:
pass
#
except Exception as e:
#
print("Unexpected error: %s" % str(e))
except
Exception
as
e
:
print
(
"Unexpected error:
%
s"
%
str
(
e
))
bwalk
.
cleanup
()
...
...
src/binwalk/__init__.py
View file @
50eb5273
...
...
@@ -61,12 +61,13 @@ class Binwalk(object):
# ENTROPY must be the largest value to ensure it is performed last if multiple scans are performed.
BINWALK
=
0x01
BINARCH
=
0x02
BINCAST
=
0x04
STRINGS
=
0x08
COMPRESSION
=
0x10
HEXDIFF
=
0x20
CUSTOM
=
0x40
ENTROPY
=
0x80
BINCAST
=
0x03
STRINGS
=
0x04
COMPRESSION
=
0x05
HEXDIFF
=
0x06
CUSTOM
=
0x07
BINVIS
=
0x08
ENTROPY
=
0x09
def
__init__
(
self
,
magic_files
=
[],
flags
=
magic
.
MAGIC_NONE
,
log
=
None
,
quiet
=
False
,
verbose
=
0
,
ignore_smart_keywords
=
False
,
ignore_time_skews
=
False
,
load_extractor
=
False
,
load_plugins
=
True
,
exec_commands
=
True
,
max_extract_size
=
None
):
'''
...
...
src/binwalk/cmdopts.py
View file @
50eb5273
...
...
@@ -5,8 +5,9 @@ import os
import
sys
import
binwalk.config
short_options
=
"
AaBbCcdEeGHhIiJkLMNnOPpQqrSTtUuvWwz?D:F:f:g:j:K:o:l:m:R:s:X:x:Y:y
:"
short_options
=
"
3AaBbCcdEeGHhIiJkLMNnOPpQqrSTtUuvWwz?D:F:f:g:j:K:o:l:m:R:s:X:x:Y:y:Z
:"
long_options
=
[
"3D"
,
"rm"
,
"help"
,
"green"
,
...
...
@@ -41,6 +42,7 @@ long_options = [
"no-legend"
,
"strings"
,
"carve"
,
"weight="
,
"matryoshka="
,
"list-plugins"
,
"disable-plugins"
,
...
...
@@ -103,6 +105,11 @@ def usage(fd):
fd
.
write
(
"
\t
-J, --save-plot Save plot as an SVG (implied if multiple files are specified)
\n
"
)
fd
.
write
(
"
\n
"
)
fd
.
write
(
"Binary Visualization:
\n
"
)
fd
.
write
(
"
\t
-3, --3D Generate a 3D visualization
\n
"
)
fd
.
write
(
"
\t
-Z, --weight Manually set the cutoff weight (lower weight, more data points)
\n
"
)
fd
.
write
(
"
\n
"
)
fd
.
write
(
"Binary Diffing:
\n
"
)
fd
.
write
(
"
\t
-W, --diff Hexdump / diff the specified files
\n
"
)
fd
.
write
(
"
\t
-K, --block=<int> Number of bytes to display per line (default:
%
d)
\n
"
%
binwalk
.
hexdiff
.
HexDiff
.
DEFAULT_BLOCK_SIZE
)
...
...
src/binwalk/compat.py
View file @
50eb5273
...
...
@@ -30,6 +30,15 @@ def has_key(dictionary, key):
else
:
return
dictionary
.
has_key
(
key
)
def
get_keys
(
dictionary
):
'''
For cross compatibility between Python 2 and Python 3 dictionaries.
'''
if
PY_MAJOR_VERSION
>
2
:
return
list
(
dictionary
.
keys
())
else
:
return
dictionary
.
keys
()
def
str2bytes
(
string
):
'''
For cross compatibility between Python 2 and Python 3 strings.
...
...
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