Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arrase committed Apr 11, 2017
1 parent 4fd3514 commit fa49d48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions ducky/RaspiDucky/RFCommClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ def run(self, payload, address=None):

with open(payload) as f:
for line in f:
sock.send(struct.pack('!I', len(line)))
sock.send(line)
data = line.replace('\n', '').replace('\r', '')
data_size = len(data)
if data_size > 0:
sock.send(struct.pack('!I', data_size))
sock.send(data)

sock.close()
3 changes: 1 addition & 2 deletions ducky/RaspiDucky/RFCommServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def run(self):
lengthbuf = self._client_sock.recv(4)
length, = struct.unpack('!I', lengthbuf)
data = self._client_sock.recv(length)
if len(data) == 0: break
self._ducky.run(data.replace('\n', '').replace('\r', '').split(' ', 1))
self._ducky.run(data.split(' ', 1))
except IOError:
pass

Expand Down

0 comments on commit fa49d48

Please sign in to comment.