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
b195008f
Commit
b195008f
authored
Nov 25, 2015
by
Craig Heffner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Python3 compatibility issues in statuserver.py
parent
0106db5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
statuserver.py
src/binwalk/core/statuserver.py
+12
-5
No files found.
src/binwalk/core/statuserver.py
View file @
b195008f
# Provides scan status information via a TCP socket service.
# Currently only works for signature scans.
import
sys
import
time
import
threading
import
SocketServer
import
binwalk.core.compat
# Python 2/3 compatibility
try
:
import
SocketServer
except
ImportError
:
import
socketserver
as
SocketServer
class
StatusRequestHandler
(
SocketServer
.
BaseRequestHandler
):
...
...
@@ -16,9 +23,9 @@ class StatusRequestHandler(SocketServer.BaseRequestHandler):
time
.
sleep
(
0.1
)
try
:
self
.
request
.
send
(
'
\b
'
*
last_status_message_len
)
self
.
request
.
send
(
' '
*
last_status_message_len
)
self
.
request
.
send
(
'
\b
'
*
last_status_message_len
)
self
.
request
.
send
(
binwalk
.
core
.
compat
.
str2bytes
(
'
\b
'
*
last_status_message_len
)
)
self
.
request
.
send
(
binwalk
.
core
.
compat
.
str2bytes
(
' '
*
last_status_message_len
)
)
self
.
request
.
send
(
binwalk
.
core
.
compat
.
str2bytes
(
'
\b
'
*
last_status_message_len
)
)
percentage
=
((
float
(
self
.
server
.
binwalk
.
status
.
completed
)
/
float
(
self
.
server
.
binwalk
.
status
.
total
))
*
100
)
status_message
=
message_format
%
(
self
.
server
.
binwalk
.
status
.
fp
.
path
,
...
...
@@ -27,7 +34,7 @@ class StatusRequestHandler(SocketServer.BaseRequestHandler):
self
.
server
.
binwalk
.
status
.
total
)
last_status_message_len
=
len
(
status_message
)
self
.
request
.
send
(
status_message
)
self
.
request
.
send
(
binwalk
.
core
.
compat
.
str2bytes
(
status_message
)
)
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
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