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
54ad5c58
Commit
54ad5c58
authored
Jan 10, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidated warning messages
parent
30216cc8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
7 deletions
+22
-7
common.py
src/binwalk/core/common.py
+12
-0
parser.py
src/binwalk/core/parser.py
+2
-1
plugin.py
src/binwalk/core/plugin.py
+4
-3
extractor.py
src/binwalk/modules/extractor.py
+3
-2
hashmatch.py
src/binwalk/modules/hashmatch.py
+1
-1
No files found.
src/binwalk/core/common.py
View file @
54ad5c58
...
...
@@ -25,6 +25,18 @@ def debug(msg):
sys
.
stderr
.
write
(
"DEBUG: "
+
msg
+
"
\n
"
)
sys
.
stderr
.
flush
()
def
warning
(
msg
):
'''
Prints warning messages to stderr
'''
sys
.
stderr
.
write
(
"
\n
WARNING: "
+
msg
+
"
\n\n
"
)
def
error
(
msg
):
'''
Prints error messages to stderr
'''
sys
.
stderr
.
write
(
"
\n
ERROR: "
+
msg
+
"
\n\n
"
)
def
file_md5
(
file_name
):
'''
Generate an MD5 hash of the specified file.
...
...
src/binwalk/core/parser.py
View file @
54ad5c58
...
...
@@ -2,6 +2,7 @@ import io
import
re
import
os.path
import
tempfile
import
binwalk.core.common
from
binwalk.core.compat
import
*
from
binwalk.core.filter
import
FilterType
...
...
@@ -150,7 +151,7 @@ class MagicParser(object):
if
os
.
path
.
exists
(
fname
):
self
.
parse_file
(
fname
)
else
:
sys
.
stdout
.
write
(
"WARNING: Magic file '
%
s' does not exist!
\n
"
%
fname
)
binwalk
.
core
.
common
.
warning
(
"Magic file '
%
s' does not exist!
"
%
fname
)
self
.
fd
.
seek
(
0
)
return
self
.
fd
.
name
...
...
src/binwalk/core/plugin.py
View file @
54ad5c58
...
...
@@ -2,6 +2,7 @@ import os
import
sys
import
imp
import
inspect
import
binwalk.core.common
import
binwalk.core.settings
from
binwalk.core.compat
import
*
...
...
@@ -124,7 +125,7 @@ class Plugins(object):
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
as
e
:
sys
.
stderr
.
write
(
"WARNING:
%
s.
%
s failed:
%
s
\n
"
%
(
callback
.
__module__
,
callback
.
__name__
,
e
))
binwalk
.
common
.
core
.
warning
(
"
%
s.
%
s failed:
%
s
"
%
(
callback
.
__module__
,
callback
.
__name__
,
e
))
def
_find_plugin_class
(
self
,
plugin
):
for
(
name
,
klass
)
in
inspect
.
getmembers
(
plugin
,
inspect
.
isclass
):
...
...
@@ -186,7 +187,7 @@ class Plugins(object):
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
as
e
:
sys
.
stderr
.
write
(
"WARNING: Error loading plugin '
%
s':
%
s
\n
"
%
(
file_name
,
str
(
e
)))
binwalk
.
common
.
core
.
warning
(
"Error loading plugin '
%
s':
%
s
"
%
(
file_name
,
str
(
e
)))
plugins
[
key
][
'enabled'
][
module
]
=
False
try
:
...
...
@@ -243,7 +244,7 @@ class Plugins(object):
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
as
e
:
sys
.
stderr
.
write
(
"WARNING: Failed to load plugin module '
%
s':
%
s
\n
"
%
(
module
,
str
(
e
)))
binwalk
.
common
.
core
.
warning
(
"Failed to load plugin module '
%
s':
%
s
"
%
(
module
,
str
(
e
)))
def
pre_scan_callbacks
(
self
,
obj
):
return
self
.
_call_plugins
(
self
.
pre_scan
,
None
)
...
...
src/binwalk/modules/extractor.py
View file @
54ad5c58
...
...
@@ -4,6 +4,7 @@ import sys
import
shlex
import
tempfile
import
subprocess
import
binwalk.core.common
from
binwalk.core.compat
import
*
from
binwalk.core.module
import
Module
,
Option
,
Kwarg
from
binwalk.core.common
import
file_size
,
unique_file_name
,
BlockFile
...
...
@@ -539,7 +540,7 @@ class Extractor(Module):
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
as
e
:
sys
.
stderr
.
write
(
"WARNING: Extractor.execute failed to run internal extractor '
%
s':
%
s
\n
"
%
(
str
(
cmd
),
str
(
e
)))
binwalk
.
core
.
common
.
warning
(
"Extractor.execute failed to run internal extractor '
%
s':
%
s
"
%
(
str
(
cmd
),
str
(
e
)))
else
:
# If not in verbose mode, create a temporary file to redirect stdout and stderr to
if
not
self
.
config
.
verbose
:
...
...
@@ -560,7 +561,7 @@ class Extractor(Module):
# making the switch to the new firmware mod kit directory structure. We handle this elsewhere, but it's
# annoying to see this spammed out to the console every time.
if
self
.
config
.
verbose
or
(
not
hasattr
(
e
,
'errno'
)
or
e
.
errno
!=
2
):
sys
.
stderr
.
write
(
"WARNING: Extractor.execute failed to run external extrator '
%
s':
%
s
\n
"
%
(
str
(
cmd
),
str
(
e
)))
binwalk
.
core
.
common
.
warning
(
"Extractor.execute failed to run external extrator '
%
s':
%
s
"
%
(
str
(
cmd
),
str
(
e
)))
retval
=
None
if
tmp
is
not
None
:
...
...
src/binwalk/modules/hashmatch.py
View file @
54ad5c58
...
...
@@ -190,7 +190,7 @@ class HashMatch(Module):
else
:
return
self
.
lib
.
fuzzy_compare
(
hash1
,
hash2
)
except
Exception
as
e
:
print
(
"WARNING: Exception while doing fuzzy hash:
%
s"
%
e
)
binwalk
.
core
.
common
.
warning
(
"Exception while doing fuzzy hash:
%
s"
%
str
(
e
)
)
return
None
...
...
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