Detect pattern in a response and disconnect

Dec 11, 2012 at 4:19 AM

Im looking to run an traceroute command on a remote cisco router, and detect pattern (consists of 2 rows of !  !  !) 

I'm currently using tamir's SharpSSH to do this with the following code:

            var ssh = new SshStream(hostname, user, pass);
            try
            {
                ssh.Prompt = RegexLibrary.TracerouteTimeoutRegex();
                ssh.Write(input);
                ssh.RemoveTerminalEmulationCharacters = false;
                var sshOutput = ssh.ReadResponse();
                sshOutput = Regex.Replace(sshOutput, RegexLibrary.RouterBannerRegex(), "");
                sshOutput = Regex.Replace(sshOutput, RegexLibrary.PromptRegex(), "");
                sshOutput = Regex.Replace(sshOutput, RegexLibrary.RouterDNSRegex(), "");
                sshOutput = Regex.Replace(sshOutput, RegexLibrary.EscapeSequenceRegex(), "");
                var sshResponse = sshOutput;
                sshResponse = sshResponse.Trim();
                ssh.Close();
                return sshResponse;
            }
            catch (Exception e)
            {
                return e.Message;
            }

Is there an equivalent to the "prompt" property?