SSH Execute command - WeOnlyDo Discussion board

SSH Execute command (wodSSH / wodSSH.NET)

by Robert, Thursday, October 14, 2004, 01:26 (7106 days ago)

I've written a program in C#, su - to root and after the conection and then the following works: then last does not? Is it because the return from cat /etc/group is more than one line?

string s, cmd;
Ssh1.Blocking=true;
cmd = grep + User + /etc/shadow
;
s = Ssh1.Execute(cmd);//Ssh1.Send( grep + User + /etc/passwd
);
DisplayUserShadowFileDetails(s.Substring(cmd.Length).TrimEnd(
.ToCharArray()));
Ssh1.Blocking=false;

Broken:
string s, cmd;
Ssh1.Blocking=true;
cmd = cat /etc/group
;
s = Ssh1.Execute(cmd);
s = s.Substring(cmd.Length).TrimEnd(
.ToCharArray());
Ssh1.Blocking=false;
String[] Groups = s.Split(
.ToCharArray());


Complete thread: