Re: [Plugins-writers] problem in executing SSH commands

From: Nicolas Pouvesle (npouvesle@private)
Date: Sun Feb 27 2005 - 07:01:11 PST


On Feb 24, 2005, at 4:55 AM, sandy wrote:
>> Here is what i wrote:
>> ##########################################################
>> ssh_login
> (socket:soc,login:"nsroot",password:"nsroot",pub:NULL,priv: 
> NULL,passphrase:NULL);
>>
>> cmd1=ssh_cmd(socket:soc, cmd:"shell", timeout:5);
>> display('\ncmd1:',cmd1);
>>
>> buf = ssh_cmd(socket:soc, cmd:"cat myfile",
> timeout:5);
>> display('\nbuf:',buf);
>> ############################################################
>>

If you want to get the output of the file, so just do :


ret = ssh_login (socket:soc, login:"login",  
password:"password",pub:NULL,priv:NULL,passphrase:NULL);
if (ret != 0)
{
  display ("Error: login failed\n");
  exit (0);
}

buf = ssh_cmd (socket:soc, cmd:"cat yourfile", timeout:10);
if (!buf)
{
  display ("Error: cmd failed\n");
  exit (0);
}

#display file if success
display (buf);


Nicolas

_______________________________________________
Plugins-writers mailing list
Plugins-writers@private
http://mail.nessus.org/mailman/listinfo/plugins-writers



This archive was generated by hypermail 2.1.3 : Sun Feb 27 2005 - 07:02:08 PST