Re: Compile NASL Scripts

George Theall <[email protected]>
Newsgroups gmane.comp.security.nessus.devel,gmane.comp.security.nessus.general
Message-ID <[email protected]>
On Fri, May 30, 2003 at 04:12:24PM +0200, Michel Arboi wrote:

> No. But the change would be trivial.

Here are revised patches to libnasl/nasl/exec.c and libnasl/nasl/nasl.c
against nessus 2.0.6a.  These fix an error loading the libnasl
shared library when starting the nessus daemon that my earlier patches
introduced.


George
-- 
[email protected]
exec.c.diffs (text/plain, 530 B)
--- exec.c.orig	Wed May 21 10:40:10 2003
+++ exec.c	Sat May 31 08:06:18 2003
@@ -45,6 +45,8 @@
 #define NASL_DEBUG 0
 #endif
 
+int parse_only = 0;
+
 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.diffs (text/plain, 1.3 KB)
--- nasl.c.orig	Mon Apr  7 06:16:25 2003
+++ nasl.c	Sat May 31 08:06:18 2003
@@ -55,6 +55,7 @@
 void exit_nasl(struct arglist *, int);
 
 
+extern int parse_only;
 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());
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+2KhJ7ZziPz0vGWERAoC1AJ4qlFkAa/Pt+nnrvUI/uadET76hfgCfSS4j
zDg9k8QSGjD7oBgABaTsUD0=
=1ooe
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.