Description part of the nasl script

  1. I have a custom nasl script and Can I get the information in the description part of a specific oid in Nasl language.
  2. Can I get the information in the description part of a nasl script in some way? using nasl.

IIRC it was defined in the past that the NASL description part is fixed and shouldn’t be accessed (or at worst modified) during the run-time of a NASL script.

Maybe you can explain your use-case so more specific suggestions could be given?

Just some general remarks on your questions:

The only way that one NASL script can get the info from another one is that both are exchanging this information via the (Redis-) Knowledge Base via one of the following functions:

set_kb_item(name:"your/key", value:"yourvalue");
replace_kb_item(name:"your/key", value:"yourvalue");

This means that file1.nasl needs to call something like e.g.:

set_kb_item(name:"your/key", value:"yourvalue");

which can be used / gathered by 2.nasl with something like e.g.:

val = get_kb_item("your/key");

I can explain the use case. I want a custom script in which all the vulns regarding a certain category can be displayed at one place. I don’t want to duplicate the stuff again so I asked if there is any way to fetch all the information of the vuln using an oid or something.

For example:

File1.nasl - Detects a vuln called “x”, then I can set a key in it - set_kb_item(name:“x”,value:“OID value”)
File2.nasl - It can get the key and display information of vuln “x” by fetching information from File1.nasl using OID value from the value of the key. So that I don’t duplicate any information from File1.nasl.
I don’t want to modify any description part of any nasl script.

Can you suggest anything ?

Unfortunately there is currently no way to access such metadata from within NASL scripts without modifying every single .nasl script within the feed to pass such data around.

I have moved this topic to the Source Edition category for now, maybe some readers over there have any suggestions (e.g. direct query of redis, external access to manager etc.) how to achieve what you’re looking for.