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
87071623
Commit
87071623
authored
11 years ago
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs in entropy legend
parent
35fb045b
master
…
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.0
v2.1.1
v2.0.1
v2.0.0
v1.3.0
python27
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
10 deletions
+50
-10
__init__.py
src/binwalk/__init__.py
+1
-0
entropy.py
src/binwalk/entropy.py
+25
-7
plotter.py
src/binwalk/plotter.py
+24
-3
No files found.
src/binwalk/__init__.py
View file @
87071623
...
...
@@ -304,6 +304,7 @@ class Binwalk(object):
target_files
=
[
target_files
]
Plotter3D
(
target_files
,
offset
=
offset
,
length
=
length
,
weight
=
weight
,
verbose
=
verbose
)
.
plot
()
#PlotFiles(target_files, offset=offset, length=length, weight=weight, verbose=verbose)
def
scan
(
self
,
target_files
,
offset
=
0
,
length
=
0
,
show_invalid_results
=
False
,
callback
=
None
,
start_callback
=
None
,
end_callback
=
None
,
base_dir
=
None
,
matryoshka
=
1
,
plugins_whitelist
=
[],
plugins_blacklist
=
[]):
'''
...
...
This diff is collapsed.
Click to expand it.
src/binwalk/entropy.py
View file @
87071623
...
...
@@ -42,6 +42,7 @@ class PlotEntropy(object):
i
=
0
descriptions
=
{}
plotted_colors
=
{}
max_description_length
=
None
for
(
offset
,
results
)
in
file_results
:
...
...
@@ -70,13 +71,30 @@ class PlotEntropy(object):
#if average:
# plt.addLine(y=average, pen='r')
if
file_results
:
for
(
offset
,
descs
)
in
iterator
(
descriptions
):
for
description
in
descs
:
plt
.
plot
(
x
=
[
offset
,
offset
],
y
=
[
0
,
1.1
],
name
=
description
,
pen
=
pg
.
mkPen
(
self
.
COLORS
[
i
],
width
=
2.5
))
i
+=
1
if
i
>=
len
(
self
.
COLORS
):
i
=
0
if
descriptions
:
ordered_offsets
=
get_keys
(
descriptions
)
ordered_offsets
.
sort
()
for
offset
in
ordered_offsets
:
for
description
in
descriptions
[
offset
]:
# If this description has already been plotted at a different offset, we need to
# use the same color for the marker, but set the description to None to prevent
# duplicate entries in the graph legend.
#
# Else, get the next color and use it to mark descriptions of this type.
if
has_key
(
plotted_colors
,
description
):
color
=
plotted_colors
[
description
]
description
=
None
else
:
color
=
self
.
COLORS
[
i
]
plotted_colors
[
description
]
=
color
i
+=
1
if
i
>=
len
(
self
.
COLORS
):
i
=
0
plt
.
plot
(
x
=
[
offset
,
offset
],
y
=
[
0
,
1.1
],
name
=
description
,
pen
=
pg
.
mkPen
(
color
,
width
=
2.5
))
if
save
:
exporter
=
pg
.
exporters
.
ImageExporter
.
ImageExporter
(
plt
.
plotItem
)
...
...
This diff is collapsed.
Click to expand it.
src/binwalk/plotter.py
View file @
87071623
...
...
@@ -131,9 +131,7 @@ class Plotter(object):
return
scatter_plot
def
plot
(
self
):
from
pyqtgraph.Qt
import
QtCore
,
QtGui
def
plot
(
self
,
wait
=
True
):
self
.
window
.
show
()
for
file_name
in
self
.
files
:
...
...
@@ -147,6 +145,12 @@ class Plotter(object):
self
.
window
.
addItem
(
self
.
_generate_plot
(
plot_points
,
data_weights
))
if
wait
:
self
.
wait
()
def
wait
(
self
):
from
pyqtgraph.Qt
import
QtCore
,
QtGui
t
=
QtCore
.
QTimer
()
t
.
start
(
50
)
QtGui
.
QApplication
.
instance
()
.
exec_
()
...
...
@@ -179,6 +183,23 @@ class Plotter2D(Plotter):
elif
self
.
plane_count
==
2
:
return
(
ord
(
data
[
0
]),
ord
(
data
[
1
]),
0
)
class
PlotFiles
(
object
):
def
__init__
(
self
,
files
,
offset
=
0
,
length
=
0
,
weight
=
None
,
verbose
=
False
,
overlay
=
False
):
if
overlay
:
Plotter3D
(
files
,
offset
=
offset
,
length
=
length
,
weight
=
weight
,
verbose
=
verbose
)
.
plot
(
wait
=
True
)
else
:
objs
=
[]
for
f
in
files
:
p
=
Plotter3D
(
files
,
offset
=
offset
,
length
=
length
,
weight
=
weight
,
verbose
=
verbose
)
p
.
plot
(
wait
=
False
)
objs
.
append
(
p
)
for
obj
in
objs
:
obj
.
wait
()
if
__name__
==
'__main__'
:
...
...
This diff is collapsed.
Click to expand it.
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