Skip to content

Commit eb2b4aa

Browse files
committed
SSH: fix download/upload with -1 exit status
1 parent 636b3b2 commit eb2b4aa

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pwnlib/tubes/ssh.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,11 @@ def update(has, total):
13631363
update(len(data), total)
13641364

13651365
result = c.wait()
1366-
if result != 0:
1366+
1367+
if result == -1:
1368+
self.warn_once("Could not verify success of file download %r, no error code" % (remote))
1369+
1370+
if result != 0 and result != -1:
13671371
h.failure('Could not download file %r (%r)' % (remote, result))
13681372
return
13691373

@@ -1543,7 +1547,11 @@ def upload_data(self, data, remote):
15431547
s.shutdown('send')
15441548
data = s.recvall()
15451549
result = s.wait()
1546-
if result != 0:
1550+
1551+
if result == -1:
1552+
self.warn_once("Could not verify success of file upload %r, no error code" % (remote))
1553+
1554+
if result != 0 and result != -1:
15471555
self.error("Could not upload file %r (%r)\n%s" % (remote, result, data))
15481556

15491557
def upload_file(self, filename, remote = None):

0 commit comments

Comments
 (0)