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
f330cbb4
Commit
f330cbb4
authored
Nov 19, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Entropy analysis now provides a summary by default; --verbose enables full output
parent
1e5c176a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
entropy.py
src/binwalk/modules/entropy.py
+24
-2
No files found.
src/binwalk/modules/entropy.py
View file @
f330cbb4
...
@@ -68,6 +68,9 @@ class Entropy(Module):
...
@@ -68,6 +68,9 @@ class Entropy(Module):
self
.
max_description_length
=
0
self
.
max_description_length
=
0
self
.
file_markers
=
{}
self
.
file_markers
=
{}
self
.
trigger_high
=
.
95
self
.
trigger_low
=
.
85
if
self
.
use_zlib
:
if
self
.
use_zlib
:
self
.
algorithm
=
self
.
gzip
self
.
algorithm
=
self
.
gzip
else
:
else
:
...
@@ -118,6 +121,8 @@ class Entropy(Module):
...
@@ -118,6 +121,8 @@ class Entropy(Module):
pg
.
exit
()
pg
.
exit
()
def
calculate_file_entropy
(
self
,
fp
):
def
calculate_file_entropy
(
self
,
fp
):
last_edge
=
None
# Clear results from any previously analyzed files
# Clear results from any previously analyzed files
self
.
clear
(
results
=
True
)
self
.
clear
(
results
=
True
)
...
@@ -141,11 +146,28 @@ class Entropy(Module):
...
@@ -141,11 +146,28 @@ class Entropy(Module):
i
=
0
i
=
0
while
i
<
dlen
:
while
i
<
dlen
:
entropy
=
self
.
algorithm
(
data
[
i
:
i
+
block_size
])
entropy
=
self
.
algorithm
(
data
[
i
:
i
+
block_size
])
display
=
self
.
display_results
description
=
"
%
f"
%
entropy
if
not
self
.
config
.
verbose
:
if
last_edge
in
[
None
,
0
]
and
entropy
>
self
.
trigger_high
:
description
=
"Rising entropy edge (
%
f)"
%
entropy
display
=
self
.
display_results
last_edge
=
1
elif
last_edge
in
[
None
,
1
]
and
entropy
<
self
.
trigger_low
:
description
=
"Falling entropy edge (
%
f)"
%
entropy
display
=
self
.
display_results
last_edge
=
0
else
:
display
=
False
description
=
"
%
f"
%
entropy
r
=
self
.
result
(
offset
=
(
file_offset
+
i
),
r
=
self
.
result
(
offset
=
(
file_offset
+
i
),
file
=
fp
,
file
=
fp
,
entropy
=
entropy
,
entropy
=
entropy
,
description
=
(
"
%
f"
%
entropy
),
description
=
description
,
display
=
self
.
display_results
)
display
=
display
)
i
+=
block_size
i
+=
block_size
if
self
.
do_plot
:
if
self
.
do_plot
:
...
...
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