This is a conceptual question. I just need to know where to get started.
My application is to connect via SSH to an embedded device and then send a series of commands, parsing the results and sending other commands based on the parsed results.
I can do this already using SshClient and the ShellStream classes.
The problem now is that I would ALSO like to be able to capture ALL the traffic on my ShellStream. In other words, I would like to somehow log everything I am sending/receiving through the ShellStream.
The "hard" way to do this is to explicitly log everything I send and receive by inserting logging calls into all the places where I invoke Send() and Expect(), for example. Unfortunately, this means I need to worry about situations where I use Expect() to capture a particular string in the response to the command I send, but I want to log all the text I get back, not only what is captured by the regex which I give to Expect.
Is there an easy way for me to leave all my command-response interactions untouched but also log everything that comes through the ShellStream?
My application is to connect via SSH to an embedded device and then send a series of commands, parsing the results and sending other commands based on the parsed results.
I can do this already using SshClient and the ShellStream classes.
The problem now is that I would ALSO like to be able to capture ALL the traffic on my ShellStream. In other words, I would like to somehow log everything I am sending/receiving through the ShellStream.
The "hard" way to do this is to explicitly log everything I send and receive by inserting logging calls into all the places where I invoke Send() and Expect(), for example. Unfortunately, this means I need to worry about situations where I use Expect() to capture a particular string in the response to the command I send, but I want to log all the text I get back, not only what is captured by the regex which I give to Expect.
Is there an easy way for me to leave all my command-response interactions untouched but also log everything that comes through the ShellStream?