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
a14acb7a
Commit
a14acb7a
authored
Nov 27, 2015
by
devttys0
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #167 from bkabrda/master
Make sure binwalk always opens files with utf-8 encoding
parents
12590c75
c5ffe186
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
display.py
src/binwalk/core/display.py
+2
-1
magic.py
src/binwalk/core/magic.py
+2
-1
extractor.py
src/binwalk/modules/extractor.py
+2
-1
No files found.
src/binwalk/core/display.py
View file @
a14acb7a
# Code to handle displaying and logging of results.
# Code to handle displaying and logging of results.
# Anything in binwalk that prints results to screen should use this class.
# Anything in binwalk that prints results to screen should use this class.
import
codecs
import
sys
import
sys
import
codecs
import
codecs
import
csv
as
pycsv
import
csv
as
pycsv
...
@@ -30,7 +31,7 @@ class Display(object):
...
@@ -30,7 +31,7 @@ class Display(object):
self
.
_configure_formatting
()
self
.
_configure_formatting
()
if
log
:
if
log
:
self
.
fp
=
open
(
log
,
"a"
)
self
.
fp
=
codecs
.
open
(
log
,
"a"
,
encoding
=
'utf-8'
)
if
csv
:
if
csv
:
self
.
csv
=
pycsv
.
writer
(
self
.
fp
)
self
.
csv
=
pycsv
.
writer
(
self
.
fp
)
...
...
src/binwalk/core/magic.py
View file @
a14acb7a
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
__all__
=
[
'Magic'
]
__all__
=
[
'Magic'
]
import
codecs
import
re
import
re
import
struct
import
struct
import
datetime
import
datetime
...
@@ -789,7 +790,7 @@ class Magic(object):
...
@@ -789,7 +790,7 @@ class Magic(object):
Returns None.
Returns None.
'''
'''
fp
=
open
(
fname
,
"r"
)
fp
=
codecs
.
open
(
fname
,
"r"
,
encoding
=
'utf-8'
)
lines
=
fp
.
readlines
()
lines
=
fp
.
readlines
()
self
.
parse
(
lines
)
self
.
parse
(
lines
)
fp
.
close
()
fp
.
close
()
...
...
src/binwalk/modules/extractor.py
View file @
a14acb7a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# This is automatically invoked by core.module code if extraction has been
# This is automatically invoked by core.module code if extraction has been
# enabled by the user; other modules need not reference this module directly.
# enabled by the user; other modules need not reference this module directly.
import
codecs
import
os
import
os
import
re
import
re
import
sys
import
sys
...
@@ -317,7 +318,7 @@ class Extractor(Module):
...
@@ -317,7 +318,7 @@ class Extractor(Module):
'''
'''
try
:
try
:
# Process each line from the extract file, ignoring comments
# Process each line from the extract file, ignoring comments
with
open
(
fname
,
'r
'
)
as
f
:
with
codecs
.
open
(
fname
,
'r'
,
encoding
=
'utf-8
'
)
as
f
:
for
rule
in
f
.
readlines
():
for
rule
in
f
.
readlines
():
self
.
add_rule
(
rule
.
split
(
self
.
COMMENT_DELIM
,
1
)[
0
])
self
.
add_rule
(
rule
.
split
(
self
.
COMMENT_DELIM
,
1
)[
0
])
except
KeyboardInterrupt
as
e
:
except
KeyboardInterrupt
as
e
:
...
...
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