def init_connection(self, host): screen_size = self.tui.loop.screen.get_cols_rows() logging.debug("Core: pausing TUI") self.tui.pause() # TODO: check for shorter yet unique uuid session_uuid = uuid.uuid4() session_start_time = time.strftime("%Y%m%d-%H%M%S") session = SSHSession(self, host, session_uuid) # TODO: add err handling sniffer = SSHSniffer( self.posix_user, config.src_port, host, session_uuid, screen_size) session.attach_sniffer(sniffer) logging.info( "Core: Starting session UUID {0} for user {1} to host {2}".format( session_uuid, self.posix_user, host)) session.connect(screen_size) try: session.start_session() finally: session.stop_sniffer() self.tui.restore() self.tui.hostlist.search.clear() # Clear selected hosts
def init_connection(self, host): screen_size = self.tui.loop.screen.get_cols_rows() logging.debug("Core: pausing TUI") self.tui.pause() session_uuid = uuid.uuid4() session_start_time = time.strftime("%Y%m%d-%H%M%S") session = SSHSession(self, host, session_uuid) #TODO: add err handling session.connect(screen_size) #TODO enhance sniffer code session_log_filename = "{0}-{1}-{2}_{3}_{4}.log".format( self.posix_user, host, session_start_time, self.config.src_port, session_uuid) logging.info( "Core: Started session UUID {0} for user {1} to host {2}".format( session_uuid, self.posix_user, host)) self.sniffer.set_log_filename(session_log_filename) self.sniffer.capture() try: session.start_session() finally: self.sniffer.restore() self.tui.restore() #TODO: better handling through session_ended_handler self.tui.search_edit.set_edit_text("") # Clear selected hosts