Knowledge Base
Quite often, plug-ins need to communicate with each other and with the Nessus engine. The two functions presented here allow for plug-ins to define items in a shared memory space that is referred to as the Knowledge Base .
The set_kb_item( )
function expects two parameters as
input: name
and value
. For
example:
set_kb_item(name:"SSL-Enabled",value:TRUE);
The get_kb_item( )
function expects one parameter as
input: name
. For example:
value = get_kb_item(name:"SSL-Enabled");
If set_kb_item( )
is called repeatedly with the
same name, a list is created in the Knowledge Base memory. Note that
if get_kb_item( )
is called to retrieve such a
list, the plug-in process spawns a new child process for every item
that is retrieved. The get_kb_item( )
function
will return a single value to each spawned plug-in process. In this
way, each plug-in process can deal with each element of the list in
parallel. This behavior is by design and might change in the future.
It is not possible to call get_kb_item( )
to
retrieve an item set by set_kb_item( )
in the same
plug-in process. This is because NASL forks a new process to set the
item in the Knowledge Base. This behavior is by design and might
change in the future. Plug-in authors should not be affected by this
because if a plug-in sets a particular item in the Knowledge Base, it
is assumed that the plug-in is already aware of the particular item.
You can use the get_kb_list( )
function to retrieve multiple entries from the Knowledge Base. ...
Get Network Security Tools now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.