Brought interactive enabling into exception handler

This commit is contained in:
Caleb Stewart 2021-06-17 16:31:52 -04:00
parent af84d1a5a8
commit 65c3dd4864
1 changed files with 12 additions and 11 deletions

View File

@ -574,9 +574,8 @@ class Manager:
self.log("no active session, returning to local prompt")
continue
self.target.platform.interactive = True
interactive_complete = threading.Event()
output_thread = None
def output_thread_main(target: Session):
@ -597,12 +596,14 @@ class Manager:
except ChannelError:
interactive_complete.set()
try:
self.target.platform.interactive = True
output_thread = threading.Thread(
target=output_thread_main, args=[self.target]
)
output_thread.start()
try:
try:
self.target.platform.interactive_loop(interactive_complete)
except RawModeExit:
@ -615,9 +616,9 @@ class Manager:
self.target.died()
except Exception:
pwncat.util.console.print_exception()
# Trigger thread to exit
finally:
interactive_complete.set()
if output_thread is not None:
output_thread.join()
def create_session(self, platform: str, channel: Channel = None, **kwargs):