![]() | ![]() | ![]() | Lokale Sicherheitstests |
Sie können openvas-nasl wie folgt nutzen, um Ihre NVTs zu testen:
Stellen Sie zuerst sicher, dass Ihr NASL-Skript syntaktisch korrekt ist. Sie
können dies in openvas-nasl mit der Option -p testen:
# openvas-nasl -p broken-example.nasl syntax error, unexpected IDENT, expecting ')' Parse error at or near line 17
Diese Meldung zeigt, dass in dem getesteten ein Syntaxfehler vorhanden ist. Um die Funktionalität Ihrer Skripts testen zu können, muss das Skript syntaktisch korrekt sein.
Nachdem Sie die Syntaxfehler beseitigt haben, können Sie Ihr Skript ausführen und die Ausgabe in eine Protokolldatei aufzeichnen:
openvas-nasl -T /tmp/debug-lvt.txt -X example-lvt.nasl
Die Ausgaben des Skripts werden in die Datei debug-lvt.txt geschrieben,
die wie folgt aussehen könnte:
[...]
NASL:0196> make_list(...)
[9831]() NASL> [080c9968] <- "qpkg"
[9831]() NASL> [080c9a00] <- "-nc"
[9831]() NASL> [080c9f38] <- "-I"
[9831]() NASL> [080c9f98] <- "-v"
[9831](example-lvt.nasl) NASL> Call make_list(1: "qpkg", 2: "-nc", 3: "-I", 4:
"-v")
[9831](example-lvt.nasl) NASL> Return make_list: ???? (DYN_ARRAY (64))
[9831]() NASL> [080c9e88] <- (VAR2_ARRAY)
[9831](example-lvt.nasl) NASL> Call pread(cmd: "qpkg", argv: ???? (DYN_ARRAY
(64)))
[9831](example-lvt.nasl) NASL> Return pread: "qpkg: invalid option -- n
Usage: qpkg <opt..."
[9831]() NASL> [080c95c0] <- "qpkg: invalid option -- n
Usage: qpkg <opts> <misc args> : manipulate Gentoo binpkgs
Options: -[cpP:vqChV]
-c, --clean * clean pkgdir of unused binary files
-p, --pretend * pretend only
-P, --pkgdir <arg> * alternate package directory
-v, --verbose * Make a lot of noise
-q, --quiet * Tighter output; suppress warnings
-C, --nocolor * Don't output color
-h, --help * Print this help and exit
-V, --version * Print version and exit
"
NASL:0199> if (! (qpkg_list)) { ... }
[9831](example-lvt.nasl) NASL> [080c95c0] -> "qpkg: invalid option -- n
Usage: qpkg <opts> <misc args> : manipulate Gentoo binpkgs
Options: -[cpP:vqChV]
-c, --clean * clean pkgdir of unused binary files
-p, --pretend * pretend only
-P, --pkgdir <arg> * alternate package directory
-v, --verbose * Make a lot of noise
-q, --quiet * Tighter output; suppress warnings
-C, --nocolor * Don't output color
-h, --help * Print this help and exit
-V, --version * Print version and exit
"
NASL:0201> if (((arch) && (my_arch)) && (my_arch >!< arch)) { ... }
[9831](example-lvt.nasl) NASL> [080c9948] -> undef
NASL:0201> l=egrep(...);
NASL:0201> egrep(...)
[9831](example-lvt.nasl) NASL> [080c95c0] -> "qpkg: invalid option -- n
Usage: qpkg <opts> <misc args> : manipulate Gentoo binpkgs
Options: -[cpP:vqChV]
-c, --clean * clean pkgdir of unused binary files
-p, --pretend * pretend only
-P, --pkgdir <arg> * alternate package directory
-v, --verbose * Make a lot of noise
-q, --quiet * Tighter output; suppress warnings
-C, --nocolor * Don't output color
-h, --help * Print this help and exit
-V, --version * Print version and exit
"
[9831]() NASL> [080c9890] <- "qpkg: invalid option ? n
[...]
Die letzte Zeile zeigt an, dass eine inkorrekter Syntax für den
Aufruf des Programms qpkg verwendet wurde.
![]() | ![]() | ![]() | Lokale Sicherheitstests |