Re: [Plugins-writers] accessing a local file

From: Renaud Deraison (deraison@private)
Date: Tue Jul 13 2004 - 18:05:46 PDT

On Tue, Jul 13, 2004 at 05:52:22PM -0600, Alex Brugh wrote:
> Is there a way to read the contents of a file local to the nessus
> server, line by line?  I'll be putting information into each hosts kb
> file if the host's IP is in the local file I'm trying to read.

I'm assuming you'd like to upload the report of a tool like Nmap to
Nessus, and split it in the KB for every tested host, right ?

You'd need to use Nessus 2.1 (which supports file upload to the plugins)
and run split()


in the plugin description section, add :

 script_add_preference(name:"File to use : ", type:"file", value:"");

In the plugin code add :

file_contents = script_get_preference("File to use : ");
if ( ! file_contents ) exit(0);

Then parse the file :

lines = split(file, sep:'\n', keep:0);
foreach line (lines)
 # Do stuff

				-- Renaud
Plugins-writers mailing list

This archive was generated by hypermail 2.1.3 : Tue Jul 13 2004 - 18:06:31 PDT