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
19e064bd
Commit
19e064bd
authored
Nov 08, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for the ~ and ^ operators
parent
458df42e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
magic.py
src/binwalk/core/magic.py
+8
-2
No files found.
src/binwalk/core/magic.py
View file @
19e064bd
...
...
@@ -106,7 +106,7 @@ class SignatureLine(object):
# AND the data with 0xFF before the comparison is performed).
#
# We support the following operators:
for
operator
in
[
'&'
,
'|'
,
'*'
,
'+'
,
'-'
,
'/'
]:
for
operator
in
[
'&'
,
'|'
,
'*'
,
'+'
,
'-'
,
'/'
,
'~'
,
'^'
]:
# Look for each operator in self.type
if
operator
in
self
.
type
:
# If found, split self.type into the type and operator value
...
...
@@ -146,7 +146,7 @@ class SignatureLine(object):
# Check the comparison value for the type of comparison to be performed (e.g.,
# '=0x1234', '>0x1234', etc). If no operator is specified, '=' is implied.
if
parts
[
2
][
0
]
in
[
'='
,
'!'
,
'>'
,
'<'
,
'&'
,
'|'
]:
if
parts
[
2
][
0
]
in
[
'='
,
'!'
,
'>'
,
'<'
,
'&'
,
'|'
,
'^'
,
'~'
]:
self
.
condition
=
parts
[
2
][
0
]
self
.
value
=
parts
[
2
][
1
:]
else
:
...
...
@@ -517,6 +517,10 @@ class Magic(object):
dvalue
-=
opval
elif
line
.
operator
==
'/'
:
dvalue
/=
opval
elif
line
.
operator
==
'~'
:
dvalue
=
~
opval
elif
line
.
operator
==
'^'
:
dvalue
^=
opval
# Does the data (dvalue) match the specified comparison?
if
((
line
.
value
is
None
)
or
...
...
@@ -524,6 +528,8 @@ class Magic(object):
(
line
.
condition
==
'>'
and
dvalue
>
line
.
value
)
or
(
line
.
condition
==
'<'
and
dvalue
<
line
.
value
)
or
(
line
.
condition
==
'!'
and
dvalue
!=
line
.
value
)
or
(
line
.
condition
==
'~'
and
(
dvalue
==
~
line
.
value
))
or
(
line
.
condition
==
'^'
and
(
dvalue
^
line
.
value
))
or
(
line
.
condition
==
'&'
and
(
dvalue
&
line
.
value
))
or
(
line
.
condition
==
'|'
and
(
dvalue
|
line
.
value
))):
...
...
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