Mailing List Archive

How to define custom preferences (default gateway) for a plugin?
Dear friends,
I searched the mailing list for quite a week without finding an answer for my question:

My plugin needs the IP address (and eventually the MAC address) of the default gateway of the machine wich runs Nessus 3. This is because I need to perform an ARP spoofing. I was able to perform that ARP spoofing by manually writing the default gateway IP address in the plugin. But this parameter should be variable.

I searched for a builtin function that retrieves this address but I didn't found it. So I'm looking for a way to add a preference in the Nesuss GUI where I can manually enter the value.
I managed to edit the file config.default.xml and now I can see two custom entries in the preferences dialog. But I'm not able to access those values and actually it seems that I can't access also the default ones.

I use the following code:

if(description)
{
script_id(99997);
name["english"] = "Temp";
script_name(english:name["english"]);
desc["english"] = "Desc";
script_description(english:desc["english"]);
summary["english"] = "TEMP";
script_summary(english:summary["english"]);
script_category(ACT_GATHER_INFO);
script_copyright(english:"This script is Copyright (C) 2008");
family["english"] = "General";
script_family(english:family["english"]);

#Custom made preference
script_add_preference(name:"Default Gateway IP : ",
type:"entry",
value:"192.168.15.1");

#One of the default preferences
script_add_preference(name:"HTTP account :", type:"entry", value:"root");

exit(0);
}

gwip = script_get_preference("Default Gateway IP : ");
http = script_get_preference("HTTP account :");

report = "gateway=" + gwip +" http account="+http;

#Just to see the values...
security_warning(data:report);


Is there something I'm doing wrong? Please help me...
Thanks in advance

Massimo
Re: How to define custom preferences (default gateway) for a plugin? [ In reply to ]
On Feb 19, 2008, at 5:05 AM, Massimo Iorio wrote:

> I'm looking for a way to add a preference in the Nesuss GUI where I
> can manually enter the value.
> I managed to edit the file config.default.xml and now I can see two
> custom entries in the preferences dialog. But I'm not able to access
> those values and actually it seems that I can't access also the
> default ones.
...
> script_add_preference(name:"HTTP account :", type:"entry",
> value:"root");


This actually should work. If you're using one of a newer client (eg,
NessusClient 3), you probably need to create a new policy for the
client to become aware of the new preferences.

George
--
theall@tenablesecurity.com



_______________________________________________
Plugins-writers mailing list
Plugins-writers@list.nessus.org
http://mail.nessus.org/mailman/listinfo/plugins-writers
Re: How to define custom preferences (default gateway) for a plugin? [ In reply to ]
On Feb 19, 2008, at 11:05 AM, Massimo Iorio wrote:
>
> My plugin needs the IP address (and eventually the MAC address) of
> the default gateway of the machine wich runs Nessus 3. This is
> because I need to perform an ARP spoofing. I was able to perform
> that ARP spoofing by manually writing the default gateway IP address
> in the plugin. But this parameter should be variable.

You can get the MAC address of the gateway nessusd will use when
connecting to the target by using the function get_gw_mac_addr(),
which returns NULL if the gateway is not on an ethernet link.

However at this time there is no function to get the IP address of the
gateway.


-- Renaud