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
60b3873b
Commit
60b3873b
authored
Nov 17, 2013
by
heffnercj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed dict iterators in python3; next: string decoding
parent
d6298471
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
10 deletions
+17
-10
binwalk
src/bin/binwalk
+2
-2
__init__.py
src/binwalk/__init__.py
+1
-1
compat.py
src/binwalk/compat.py
+9
-0
entropy.py
src/binwalk/entropy.py
+1
-1
hexdiff.py
src/binwalk/hexdiff.py
+0
-1
parser.py
src/binwalk/parser.py
+1
-1
smartsignature.py
src/binwalk/smartsignature.py
+2
-2
smartstrings.py
src/binwalk/smartstrings.py
+1
-2
No files found.
src/bin/binwalk
View file @
60b3873b
#!/usr/bin/env python
from
__future__
import
print_function
import
sys
import
os.path
import
binwalk
from
binwalk.compat
import
*
from
threading
import
Thread
from
getopt
import
GetoptError
,
gnu_getopt
as
GetOpt
...
...
@@ -352,7 +352,7 @@ def main():
print
(
'NAME TYPE ENABLED DESCRIPTION'
)
print
(
'-'
*
115
)
with
binwalk
.
Binwalk
()
as
bw
:
for
(
key
,
info
)
in
binwalk
.
plugins
.
Plugins
(
bw
)
.
list_plugins
()
.
iteritems
(
):
for
(
key
,
info
)
in
iterator
(
binwalk
.
plugins
.
Plugins
(
bw
)
.
list_plugins
()
):
for
module_name
in
info
[
'modules'
]:
print
(
'
%-16
s
%-10
s
%-10
s
%
s'
%
(
module_name
,
key
,
info
[
'enabled'
][
module_name
],
info
[
'descriptions'
][
module_name
]))
print
(
''
)
...
...
src/binwalk/__init__.py
View file @
60b3873b
...
...
@@ -653,7 +653,7 @@ class Binwalk(object):
Returns None.
'''
for
(
new_file_name
,
new_data
)
in
new
.
iteritems
(
):
for
(
new_file_name
,
new_data
)
in
iterator
(
new
):
if
not
results
.
has_key
(
new_file_name
):
results
[
new_file_name
]
=
new_data
else
:
...
...
src/binwalk/compat.py
View file @
60b3873b
...
...
@@ -9,3 +9,12 @@ if sys.version_info.major > 2:
string
.
letters
=
string
.
ascii_letters
else
:
import
urllib2
def
iterator
(
obj
):
'''
For cross compatibility between Python 2 and Python 3 dictionaries.
'''
if
sys
.
version_info
.
major
>
2
:
return
obj
.
items
()
else
:
return
obj
.
iteritems
()
src/binwalk/entropy.py
View file @
60b3873b
...
...
@@ -470,7 +470,7 @@ class Entropy(object):
if
self
.
binwalk
and
self
.
load_plugins
:
self
.
plugins
=
plugins
.
Plugins
(
self
.
binwalk
,
whitelist
=
self
.
whitelist
,
blacklist
=
self
.
blacklist
)
for
(
file_name
,
overlay
)
in
self
.
files
.
iteritems
(
):
for
(
file_name
,
overlay
)
in
iterator
(
self
.
files
):
if
self
.
plugins
:
self
.
plugins
.
_load_plugins
()
...
...
src/binwalk/hexdiff.py
View file @
60b3873b
...
...
@@ -2,7 +2,6 @@
import
os
import
sys
import
string
import
curses
import
platform
import
binwalk.common
as
common
...
...
src/binwalk/parser.py
View file @
60b3873b
...
...
@@ -256,7 +256,7 @@ class MagicParser:
'''
signature_set
=
[]
for
(
offset
,
sigs
)
in
self
.
signatures
.
iteritems
(
):
for
(
offset
,
sigs
)
in
iterator
(
self
.
signatures
):
for
sig
in
sigs
:
if
sig
==
self
.
WILDCARD
:
sig
=
re
.
compile
(
'.'
)
...
...
src/binwalk/smartsignature.py
View file @
60b3873b
...
...
@@ -132,7 +132,7 @@ class SmartSignature:
if
quoted_data
and
self
.
KEYWORD_DELIM_START
in
quoted_data
:
# If so, check to see if the quoted data contains any of our keywords.
# If any keywords are found inside of quoted data, consider the keywords invalid.
for
(
name
,
keyword
)
in
self
.
KEYWORDS
.
iteritems
(
):
for
(
name
,
keyword
)
in
iterator
(
self
.
KEYWORDS
):
if
keyword
in
quoted_data
:
return
False
return
True
...
...
@@ -251,7 +251,7 @@ class SmartSignature:
Returns a sanitized string.
'''
if
not
self
.
ignore_smart_signatures
:
for
(
name
,
keyword
)
in
self
.
KEYWORDS
.
iteritems
(
):
for
(
name
,
keyword
)
in
iterator
(
self
.
KEYWORDS
):
start
=
data
.
find
(
keyword
)
if
start
!=
-
1
:
end
=
data
[
start
:]
.
find
(
self
.
KEYWORD_DELIM_END
)
...
...
src/binwalk/smartstrings.py
View file @
60b3873b
import
string
import
binwalk.entropy
as
entropy
import
binwalk.plugins
as
plugins
import
binwalk.common
as
common
...
...
@@ -205,7 +204,7 @@ class FileStrings(object):
Returns True if the ratio of special characters in data is too high, otherwise returns False.
'''
# If an open bracket exists, we expect a close bracket as well
for
(
key
,
value
)
in
self
.
BRACKETED
.
iteritems
(
):
for
(
key
,
value
)
in
iterator
(
self
.
BRACKETED
):
if
key
in
data
and
not
value
in
data
:
return
True
...
...
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