Re: Last call before feature freeze in Nessus 1.3.x

Richard Moore <[email protected]>
Newsgroups gmane.comp.security.nessus.devel
Message-ID <[email protected]>
Here's a small patch that adds a new switch to the command line nasl 
tool that lets you use the command line nasl tool to run scripts with
safe_checks enabled (useful when vetting results).

Cheers

Rich.
safe_mode.patch (text/plain, 2.2 KB)
Index: nasl.c
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/nasl.c,v
retrieving revision 1.26.6.2
diff -u -r1.26.6.2 nasl.c
--- nasl.c	14 Dec 2002 14:13:45 -0000	1.26.6.2
+++ nasl.c	13 Feb 2003 16:23:13 -0000
@@ -38,6 +38,7 @@
 harglst * Globals;
 extern int execute_instruction(struct arglist *, char *);
 void exit_nasl(struct arglist *, int);
+extern int safe_checks_only;
 
 static struct arglist * 
 init_hostinfos(globals, hostname, ip)
@@ -91,6 +92,7 @@
  printf("Usage : nasl [-vh] [ -t target ] script_file ...\n");
  printf("\t-h : shows this help screen\n");
  printf("\t-t [target] : Execute the scripts against the target(s) host\n");
+ printf("\t-s : specifies that the script should be run with 'safe checks'\n");
  printf("\t-v : shows the version number\n");
 }
 
@@ -110,7 +112,7 @@
  	Command-line options
   ---------------------------------------------*/
   
- while((i = getopt(argc, argv, "hvt:k:"))!=EOF)
+ while((i = getopt(argc, argv, "hvst:k:"))!=EOF)
   switch(i)
   {
    case 't' :
@@ -137,7 +139,9 @@
 	printf("See the license for details\n\n\n");
 	exit(0);
 	break;
-
+ case 's' :
+        safe_checks_only = 1;
+	break;
  }
  
  
@@ -166,6 +170,7 @@
  while((target = hg_next_host(hg_globals, &ip)))
  {
  globals = init(target, ip);
+
  n = start;
  while(argv[n])
   {
Index: nessus_extensions.c
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/Attic/nessus_extensions.c,v
retrieving revision 1.162.2.6
diff -u -r1.162.2.6 nessus_extensions.c
--- nessus_extensions.c	27 Dec 2002 21:43:14 -0000	1.162.2.6
+++ nessus_extensions.c	13 Feb 2003 16:23:15 -0000
@@ -53,7 +53,7 @@
 struct arglist  script_see_also(harglst *, struct arglist *);
 
 struct arglist  safe_checks(harglst *, struct arglist *);
-
+int safe_checks_only=0;
 
 struct arglist  get_hostname(harglst*, struct arglist *);
 struct arglist  get_host_ip(harglst*, struct arglist *);
@@ -538,7 +538,8 @@
  
  bzero(&rt, sizeof(rt));
  value = arg_get_value(prefs, "safe_checks");
- if((value && !strcmp(value, "yes")))
+
+ if((value && !strcmp(value, "yes")) || safe_checks_only)
  {
   rt.value = nasl_strdup(globals, "1");
   rt.length = 1;
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.