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
542b4701
Commit
542b4701
authored
11 years ago
by
heffnercj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
csv logging working in python3.
parent
d657f452
master
…
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.0
v2.1.1
v2.0.1
v2.0.0
v1.3.0
python27
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
prettyprint.py
src/binwalk/prettyprint.py
+13
-5
No files found.
src/binwalk/prettyprint.py
View file @
542b4701
...
...
@@ -63,7 +63,7 @@ class PrettyPrint:
self
.
enable_formatting
(
True
)
if
self
.
log
is
not
None
:
self
.
fp
=
io
.
FileIO
(
log
,
"w"
)
self
.
fp
=
open
(
log
,
"w"
)
if
self
.
log_csv
:
self
.
enable_csv
()
...
...
@@ -82,12 +82,20 @@ class PrettyPrint:
Clean up any open file descriptors.
'''
try
:
print
(
"Closing fp."
)
self
.
fp
.
close
()
except
:
pass
self
.
fp
=
None
def
_csv_writerow
(
self
,
rows
):
'''
Write data to csv file and flush.
'''
self
.
csv
.
writerow
(
rows
)
self
.
fp
.
flush
()
def
_log
(
self
,
data
,
raw
=
False
):
'''
Log data to the log file.
...
...
@@ -106,9 +114,9 @@ class PrettyPrint:
for
i
in
range
(
0
,
len
(
data_parts
)):
data_parts
[
i
]
=
data_parts
[
i
]
.
strip
()
self
.
csv
.
writerow
(
data_parts
)
self
.
_csv_
writerow
(
data_parts
)
else
:
self
.
fp
.
write
(
str2bytes
(
data
)
)
self
.
fp
.
write
(
data
)
def
_pprint
(
self
,
data
,
nolog
=
False
,
noprint
=
False
):
'''
...
...
@@ -223,8 +231,8 @@ class PrettyPrint:
if
self
.
csv
:
nolog
=
True
self
.
csv
.
writerow
([
b
"FILE"
,
b
"MD5SUM"
,
b
"TIMESTAMP"
])
self
.
csv
.
writerow
([
file_name
,
md5sum
,
timestamp
])
self
.
_csv_writerow
([
"FILE"
,
"MD5SUM"
,
"TIMESTAMP"
])
self
.
_csv_
writerow
([
file_name
,
md5sum
,
timestamp
])
self
.
_pprint
(
"
\n
"
)
self
.
_pprint
(
"Scan Time:
%
s
\n
"
%
timestamp
,
nolog
=
nolog
)
...
...
This diff is collapsed.
Click to expand it.
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