How to run nasl script?

I am following the above webpage. But I got the following error. Does anybody know how to get it work? Thanks.

$ cat demo1.nasl

display(“Hello World .\n”);
display(“Hello World openvas-nasl. \n”);

if( ! ports ) ports = make_list( 9999 );
display(ports);

include(‘/var/lib/openvas/plugins/http_func.inc’);
include(‘/var/lib/openvas/plugins/global_settings.inc’);
display(default:80,“\n”);
port = get_http_port( default:80 );
host = http_host_name( port:port );
display(“##########\n”);
display(host,“\n”);

max = 5;
for( i = 0; i < max; i ++ ) {
display(i,“##########\n”);
recv = http_get( port:port, item:“/”);
display(recv,“\n”);
}
$ sudo openvas-nasl -Xt www.baidu.com demo1.nasl

(openvas-nasl:4671): lib kb-CRITICAL **: 01:06:28.016: get_redis_ctx: redis connection error to /var/run/redis-openvas/redis-server.sock: No such file or directory

If I remember correctly, it needs to know where your openvassd.config file lives. Perhaps something like adding the following arguments would help?

--config-file=/path/to/openvassd.config

1 Like

I use kali linux, but I don’t find this file. Would you please let me know where it is?

The problem was possibly caused by the location of redis-server.sock. You need to get the path information of this file, then create a soft link to there at /var/run/redis-openvas. I’ve fixed same issue in this way. Hope it is helpful for you.