Mailing List Archive

Problems with Pread()
Hi.

Can anyone tell me why the following code breaks on *broken_buf* below?
Note that the script is currently unsigned, though the Nessus server is
configured to ignore sigs at the moment.

Cheers.

James.

---

function do_cmd(sock, cmd, timeout) {
buf = "";
if ( islocalhost() ) {
argv = split(cmd, sep:' ');
===> broken_buf = pread(cmd:argv[0], argv:argv);
buf = pread(cmd:"uname", argv:argv);
} else
buf = ssh_cmd(socket:sock, cmd:cmd,
timeout:timeout);
security_note(data:buf);
} # end do_cmd()


sock = ssh_login_or_reuse_connection();
do_cmd(sock:sock, cmd:"uname -o", timeout:60);
ssh_close_connection();


--
James A Webb Bus. +27 (12) 4600880
Mob. +27 (82) 6808202
SensePost Information Security Developer Fax. +27 (12) 4600885
http://www.sensepost.com/pgp/james.txt PO Box 176, Groenkloof 0027
Re: Problems with Pread() [ In reply to ]
Hi James,

On Sep 11, 2006, at 11:09 AM, James A Webb wrote:

> Hi.
>
> Can anyone tell me why the following code breaks on *broken_buf*
> below?
> Note that the script is currently unsigned, though the Nessus
> server is
> configured to ignore sigs at the moment.
>
> argv = split(cmd, sep:' ');


Try :

argv = split(cmd, sep:' ', keep:FALSE);


Otherwise you'll get trailing spaces in each item of the array.



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