t.setDaemon(True) t.start() printar_comandos() while True: stringInput = input('') if stringInput is not '': comando = stringInput.split()[0] if comando == 'QUIT': custom_print("Obrigado por utilizar o Terminal Chat!\nVolte Sempre ;)") converter_e_enviar(clienteSoc, "SAIR") clienteSoc.close() exit(1) break elif comando == 'LIST': converter_e_enviar(clienteSoc, stringInput) elif comando == 'SEND': conteudoMensagem = re.match(r"SEND(.*)TO", stringInput).group(1).strip() conteudoCriptografado = encripter.criptografar_conteudo(conteudoMensagem) usuarioAlvo = stringInput.split("TO")[1].strip() converter_e_enviar(clienteSoc, "SEND %s TO %s" % (conteudoCriptografado, usuarioAlvo)) elif comando == 'HELP': printar_comandos() else: custom_print('Comando inválido.\nDigite HELP para ver a lista de comandos novamente\n ') except timeout: custom_print("Tempo exedido!", False) except error: custom_print("Erro no Cliente: %s" % (host), False)