bending openssh output
d.marner at mikro-software.de
Fri Mar 2 20:17:28 EST 2007
I am not sure if this is the right place to address my question, but I
need someone how knows about the channel system of openssh. At the
moment, I try to modify the openssh source to fit to my needs. Therefore
I modified the openssh source so it can be called from my source like a
function (simply changed "void main()" to "void ssh()"). This works
perfect for the moment, but now comes the problem:
When I use openssh to build up a connection to a ssh server like this:
ssh -myparameter pass user at host "ls -al * | grep .txt"
I usually get a single line returned like
-rw-r--r-- 1 user group 1223 2007-01-01 08:00 mydata.txt
Now my question:
Where in the openssh source can I redirect the output of this line from
stdout to a string variable I use? (so I could modify/parse it before
writing it to stdout)
I tracked it down to the clients side of the source. Somewhere in
clientloop.c I think. I am not sure which way would be the best
approach... as far as I understand the source, there exists a set of
filedescriptors for writing and reading which are polled by select. But
modifying these could create problems with other functionalities of ssh.
I just want to redirecting the console output to my array.
Any hints? (please don't ask why I am trying such difficult things
instead of redirecting stdout in the shell. it would take to long to
explain. Actually, it's a kind of Systemmonitoring Tool for
monitoring/controlling many clusternodes simultaneously. the only
requirement for all nodes which are to be monitored is a running openssh
I would be very happy if someone could help me a little...
More information about the openssh-unix-dev