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
c336b225
Commit
c336b225
authored
Sep 08, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed -V option
parent
5859e214
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
12 deletions
+22
-12
binvis.py
src/binwalk/modules/binvis.py
+4
-4
codeid.py
src/binwalk/modules/codeid.py
+18
-8
No files found.
src/binwalk/modules/binvis.py
View file @
c336b225
...
@@ -30,10 +30,10 @@ class Plotter(Module):
...
@@ -30,10 +30,10 @@ class Plotter(Module):
type
=
int
,
type
=
int
,
kwargs
=
{
'max_points'
:
0
},
kwargs
=
{
'max_points'
:
0
},
description
=
'Set the maximum number of plotted data points'
),
description
=
'Set the maximum number of plotted data points'
),
Option
(
short
=
'V'
,
#
Option(short='V',
long
=
'grids'
,
#
long='grids',
kwargs
=
{
'show_grids'
:
True
},
#
kwargs={'show_grids' : True},
description
=
'Display the x-y-z grids in the resulting plot'
),
#
description='Display the x-y-z grids in the resulting plot'),
]
]
KWARGS
=
[
KWARGS
=
[
...
...
src/binwalk/modules/codeid.py
View file @
c336b225
...
@@ -17,18 +17,23 @@ class CodeID(Module):
...
@@ -17,18 +17,23 @@ class CodeID(Module):
CLI
=
[
CLI
=
[
Option
(
short
=
'Y'
,
Option
(
short
=
'Y'
,
long
=
'
disasm
'
,
long
=
'
code
'
,
kwargs
=
{
'enabled'
:
True
},
kwargs
=
{
'enabled'
:
True
},
description
=
'
Identify the architecture of excutable cod
e using the capstone disassembler'
),
description
=
'
Attempts to identify the CPU architecture of a fil
e using the capstone disassembler'
),
Option
(
short
=
'T'
,
Option
(
short
=
'T'
,
long
=
'minsn'
,
long
=
'minsn'
,
type
=
int
,
type
=
int
,
kwargs
=
{
'min_insn_count'
:
0
},
kwargs
=
{
'min_insn_count'
:
0
},
description
=
'Minimum number of consecutive instructions to be considered valid (default:
%
d)'
%
DEFAULT_MIN_INSN_COUNT
),
description
=
'Minimum number of consecutive instructions to be considered valid (default:
%
d)'
%
DEFAULT_MIN_INSN_COUNT
),
Option
(
short
=
'V'
,
long
=
'disasm'
,
kwargs
=
{
'show_disasm'
:
True
},
description
=
'Display the disassembled instructions'
),
]
]
KWARGS
=
[
KWARGS
=
[
Kwarg
(
name
=
'enabled'
,
default
=
False
),
Kwarg
(
name
=
'enabled'
,
default
=
False
),
Kwarg
(
name
=
'show_disasm'
,
default
=
False
),
Kwarg
(
name
=
'min_insn_count'
,
default
=
DEFAULT_MIN_INSN_COUNT
),
Kwarg
(
name
=
'min_insn_count'
,
default
=
DEFAULT_MIN_INSN_COUNT
),
]
]
...
@@ -121,14 +126,19 @@ class CodeID(Module):
...
@@ -121,14 +126,19 @@ class CodeID(Module):
# to prevent false positives (e.g., "\x00\x00\x00x\00" is a nop in MIPS).
# to prevent false positives (e.g., "\x00\x00\x00x\00" is a nop in MIPS).
if
len
(
set
(
code_block
))
>=
2
:
if
len
(
set
(
code_block
))
>=
2
:
for
(
md
,
description
)
in
self
.
disassemblers
:
for
(
md
,
description
)
in
self
.
disassemblers
:
ninsn
=
len
([
insn
for
insn
in
md
.
disasm_lite
(
code_block
,
0
)])
insns
=
[
insn
for
insn
in
md
.
disasm_lite
(
code_block
,
(
total_read
+
block_offset
))]
binwalk
.
core
.
common
.
debug
(
"0x
%.8
X
%
s, at least
%
d valid instructions"
%
((
total_read
+
block_offset
),
description
,
ninsn
))
binwalk
.
core
.
common
.
debug
(
"0x
%.8
X
%
s, at least
%
d valid instructions"
%
((
total_read
+
block_offset
),
description
,
len
(
insns
)))
if
ninsn
>=
self
.
min_insn_count
:
if
len
(
insns
)
>=
self
.
min_insn_count
:
r
=
self
.
result
(
offset
=
total_read
+
block_offset
,
file
=
fp
,
description
=
(
description
+
", at least
%
d valid instructions"
%
ninsn
))
r
=
self
.
result
(
offset
=
total_read
+
block_offset
,
file
=
fp
,
description
=
(
description
+
", at least
%
d valid instructions"
%
len
(
insns
)))
if
r
.
valid
and
r
.
display
and
not
self
.
config
.
verbose
:
if
r
.
valid
and
r
.
display
:
if
self
.
show_disasm
:
for
(
position
,
size
,
mnem
,
opnds
)
in
insns
:
self
.
result
(
offset
=
position
,
file
=
fp
,
description
=
"
\t
%
s
%
s"
%
(
mnem
,
opnds
))
if
not
self
.
config
.
verbose
:
return
return
block_offset
+=
1
block_offset
+=
1
total_read
+=
dlen
total_read
+=
dlen
...
...
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