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
9c3234cd
Commit
9c3234cd
authored
Nov 16, 2013
by
heffnercj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs in csv log output
parent
56f5f34b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
binwalk
src/bin/binwalk
+2
-2
prettyprint.py
src/binwalk/prettyprint.py
+13
-7
No files found.
src/bin/binwalk
View file @
9c3234cd
...
...
@@ -489,8 +489,8 @@ def main():
if
format_to_terminal
:
bwalk
.
display
.
enable_formatting
(
True
)
# Enable log file CSV formatting, if specified
if
do_csv
:
# Enable log file CSV formatting, if specified
and supported for all the requested scan types
if
do_csv
and
binwalk
.
Binwalk
.
BINCAST
not
in
requested_scans
and
binwalk
.
Binwalk
.
HEXDIFF
not
in
requested_scans
:
bwalk
.
display
.
enable_csv
()
# If no scan was explicitly rquested, do a binwalk scan
...
...
src/binwalk/prettyprint.py
View file @
9c3234cd
...
...
@@ -86,13 +86,13 @@ class PrettyPrint:
self
.
fp
=
None
def
_log
(
self
,
data
):
def
_log
(
self
,
data
,
raw
=
False
):
'''
Log data to the log file.
'''
if
self
.
fp
is
not
None
:
if
self
.
log_csv
and
self
.
csv
:
if
self
.
log_csv
and
self
.
csv
and
not
raw
:
data
=
data
.
replace
(
'
\n
'
,
' '
)
while
' '
in
data
:
...
...
@@ -219,9 +219,10 @@ class PrettyPrint:
md5sum
=
self
.
_file_md5
(
file_name
)
timestamp
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
if
self
.
log_
csv
:
if
self
.
csv
:
nolog
=
True
self
.
_pprint
(
"
%
s
%
s
%
s"
%
(
file_name
,
md5sum
,
timestamp
),
noprint
=
True
)
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
)
...
...
@@ -239,17 +240,22 @@ class PrettyPrint:
Returns None.
'''
nolog
=
False
if
self
.
verbose
and
file_name
is
not
None
:
self
.
file_info
(
file_name
)
if
self
.
log_csv
:
nolog
=
True
self
.
_pprint
(
"
\n
"
)
if
not
header
:
self
.
_pprint
(
"DECIMAL
\t
HEX
\t
%
s
\n
"
%
description
)
self
.
_pprint
(
"DECIMAL
\t
HEX
\t
%
s
\n
"
%
description
,
nolog
=
nolog
)
else
:
self
.
_pprint
(
header
+
"
\n
"
)
self
.
_pprint
(
header
+
"
\n
"
,
nolog
=
nolog
)
self
.
_pprint
(
"-"
*
self
.
HEADER_WIDTH
+
"
\n
"
)
self
.
_pprint
(
"-"
*
self
.
HEADER_WIDTH
+
"
\n
"
,
nolog
=
nolog
)
def
footer
(
self
,
bwalk
=
None
,
file_name
=
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