On Fri, May 30, 2003 at 04:12:24PM +0200, Michel Arboi wrote: > No. But the change would be trivial.
Attached are patches to libnasl/nasl/exec.c and libnasl/nasl/nasl.c to add an option to just parse a script. I'd be thrilled if these made it into the official distribution, especially after someone more familiar with nasl reviewed them. George -- [EMAIL PROTECTED]
--- exec.c.orig Wed May 21 10:40:10 2003
+++ exec.c Fri May 30 12:53:30 2003
@@ -45,6 +45,8 @@
#define NASL_DEBUG 0
#endif
+extern int parse_only;
+
int
cell2bool(lex_ctxt* lexic, tree_cell* c)
{
@@ -1680,6 +1682,13 @@
#endif
lexic = init_empty_lex_ctxt();
lexic->script_infos = script_infos;
+ if (parse_only != 0)
+ {
+ nasl_perror(lexic, "\nParsing completed\n");
+ nasl_clean_ctx(&ctx);
+ chdir(old_dir);
+ return 0;
+ }
str = arg_get_value(prefs, "checks_read_timeout");
if( str != NULL )
--- nasl.c.orig Mon Apr 7 06:16:25 2003
+++ nasl.c Fri May 30 12:54:08 2003
@@ -55,6 +55,7 @@
void exit_nasl(struct arglist *, int);
+int parse_only = 0;
int safe_checks_only = 0;
static struct arglist *
@@ -109,8 +110,9 @@
{
printf("\nnasl -- Copyright (C) 1999 - 2003 Renaud Deraison <[EMAIL PROTECTED]>\n");
printf("nasl -- Copyright (C) 2002 - 2003 Michel Arboi <[EMAIL PROTECTED]>\n\n");
- printf("Usage : nasl [-vh] [ -t target ] [-T trace_file] script_file ...\n");
+ printf("Usage : nasl [-vh] [-p] [ -t target ] [-T trace_file] script_file ...\n");
printf("\t-h : shows this help screen\n");
+ printf("\t-p : just parse the script\n");
printf("\t-t target : Execute the scripts against the target(s) host\n");
printf("\t-T file : Trace actions into the file (or '-' for stderr)\n");
printf("\t-s : specifies that the script should be run with 'safe checks'
enabled\n");
@@ -136,7 +138,7 @@
Command-line options
---------------------------------------------*/
- while((i = getopt(argc, argv, "hvt:k:T:s"))!=EOF)
+ while((i = getopt(argc, argv, "hpvt:k:T:s"))!=EOF)
switch(i)
{
case 't' :
@@ -172,6 +174,9 @@
usage();
exit(0);
}
+ break;
+ case 'p' :
+ parse_only ++;
break;
case 'v' :
printf("nasl %s\n\n", nasl_version());
pgp00000.pgp
Description: PGP signature
