Skip to content

Commit 4873414

Browse files
committed
make interactive() exit when recv side disconnects
1 parent 6457c33 commit 4873414

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pwnlib/term/keymap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, bindings, on_match = None, on_nomatch = None,
2121
def handle_input(self):
2222
self._doread = True
2323
while self._doread:
24-
self.send(key.get())
24+
self.send(key.get(1))
2525

2626
def stop(self):
2727
self._doread = False

pwnlib/tubes/tube.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,8 @@ def recv_thread():
854854
stdout.write(cur)
855855
stdout.flush()
856856
except EOFError:
857+
go.set()
857858
self.info('Got EOF while reading in interactive')
858-
break
859859

860860
t = context.Thread(target = recv_thread)
861861
t.daemon = True
@@ -869,7 +869,7 @@ def recv_thread():
869869
stdin = getattr(sys.stdin, 'buffer', sys.stdin)
870870
data = stdin.read(1)
871871

872-
if data:
872+
if data != 0:
873873
try:
874874
self.send(data)
875875
except EOFError:

0 commit comments

Comments
 (0)