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
718d0aa9
Commit
718d0aa9
authored
Jan 12, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated --cast usage, filtered out 'no magic' results
parent
a5217d62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
filter.py
src/binwalk/core/filter.py
+2
-2
signature.py
src/binwalk/modules/signature.py
+3
-7
No files found.
src/binwalk/core/filter.py
View file @
718d0aa9
...
...
@@ -40,7 +40,7 @@ class Filter(object):
# If the result returned by libmagic is "data" or contains the text
# 'invalid' or a backslash are known to be invalid/false positives.
DATA_RESULT
=
"data"
UNKNOWN_RESULTS
=
[
"data"
,
"very short file (no magic)"
]
INVALID_RESULTS
=
[
"invalid"
,
"
\\
"
]
INVALID_RESULT
=
"invalid"
NON_PRINTABLE_RESULT
=
"
\\
"
...
...
@@ -136,7 +136,7 @@ class Filter(object):
Returns True if data is valid, False if invalid.
'''
# A result of 'data' is never ever valid (for libmagic results)
if
data
==
self
.
DATA_RESULT
:
if
data
in
self
.
UNKNOWN_RESULTS
:
return
False
# Make sure this result wasn't filtered
...
...
src/binwalk/modules/signature.py
View file @
718d0aa9
...
...
@@ -25,7 +25,7 @@ class Signature(Module):
Option
(
short
=
'C'
,
long
=
'cast'
,
kwargs
=
{
'enabled'
:
True
,
'cast_data_types'
:
True
},
description
=
'Cast offsets as
various data types
'
),
description
=
'Cast offsets as
a given data type (use -y to specify the data type / endianess)
'
),
Option
(
short
=
'm'
,
long
=
'magic'
,
kwargs
=
{
'magic_files'
:
[]},
...
...
@@ -50,8 +50,6 @@ class Signature(Module):
VERBOSE_FORMAT
=
"
%
s
%
d"
def
init
(
self
):
flags
=
0
# Create Signature and MagicParser class instances. These are mostly for internal use.
self
.
smart
=
binwalk
.
core
.
smart
.
Signature
(
self
.
config
.
filter
,
ignore_smart_signatures
=
self
.
dumb_scan
)
self
.
parser
=
binwalk
.
core
.
parser
.
MagicParser
(
self
.
config
.
filter
,
self
.
smart
)
...
...
@@ -64,8 +62,6 @@ class Signature(Module):
# Append the user's magic file first so that those signatures take precedence
if
not
self
.
magic_files
:
if
self
.
search_for_opcodes
:
flags
|=
binwalk
.
core
.
magic
.
Magic
.
MAGIC_CONTINUE
self
.
magic_files
=
[
self
.
config
.
settings
.
paths
[
'user'
][
self
.
config
.
settings
.
BINARCH_MAGIC_FILE
],
self
.
config
.
settings
.
paths
[
'system'
][
self
.
config
.
settings
.
BINARCH_MAGIC_FILE
],
...
...
@@ -83,7 +79,7 @@ class Signature(Module):
# Parse the magic file(s) and initialize libmagic
self
.
mfile
=
self
.
parser
.
parse
(
self
.
magic_files
)
self
.
magic
=
binwalk
.
core
.
magic
.
Magic
(
self
.
mfile
,
flags
)
self
.
magic
=
binwalk
.
core
.
magic
.
Magic
(
self
.
mfile
)
# Once the temporary magic files are loaded into libmagic, we don't need them anymore; delete the temp files
self
.
parser
.
rm_magic_files
()
...
...
@@ -142,7 +138,7 @@ class Signature(Module):
# Register the result for futher processing/display
self
.
result
(
r
=
r
)
# Is this a valid result and did it specify a jump-to-offset keyword?
if
r
.
valid
and
r
.
jump
>
0
:
absolute_jump_offset
=
r
.
offset
+
r
.
jump
...
...
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