Skip to content

Commit

Permalink
make interactive() exit when recv side disconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
gsingh93 committed Sep 11, 2022
1 parent 6457c33 commit 4873414
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pwnlib/term/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, bindings, on_match = None, on_nomatch = None,
def handle_input(self):
self._doread = True
while self._doread:
self.send(key.get())
self.send(key.get(1))

def stop(self):
self._doread = False
Expand Down
4 changes: 2 additions & 2 deletions pwnlib/tubes/tube.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ def recv_thread():
stdout.write(cur)
stdout.flush()
except EOFError:
go.set()
self.info('Got EOF while reading in interactive')
break

t = context.Thread(target = recv_thread)
t.daemon = True
Expand All @@ -869,7 +869,7 @@ def recv_thread():
stdin = getattr(sys.stdin, 'buffer', sys.stdin)
data = stdin.read(1)

if data:
if data != 0:
try:
self.send(data)
except EOFError:
Expand Down

0 comments on commit 4873414

Please sign in to comment.