David,
There's this patch I wrote against nessus-core v.2.0.6a that causes
html reports to be generated sorted by IP address. It still applied
cleanly against 2.0.7, so it may work for you.
Hope this helps,
Gabriel
On Mon, Dec 01, 2003 at 01:44:45PM -0500, david maynor wrote:
> After a scan of several subnets is there a way to make the reports group
> the results by subnet?
> --
diff -U4 -r nessus-core/nessus/html_output.c nessus-core-sorthtml/nessus/html_output.c
--- nessus-core/nessus/html_output.c 2003-01-29 08:33:21.000000000 -0700
+++ nessus-core-sorthtml/nessus/html_output.c 2003-06-24 14:03:53.000000000 -0600
@@ -227,8 +227,61 @@
return t ;
}
+static int
+compar_hosts(p1, p2)
+ void *p1, *p2;
+{
+ char *n1 = (*(struct arglist **)p1)->name;
+ char *n2 = (*(struct arglist **)p2)->name;
+ struct in_addr in1, in2;
+
+ if( n1 == n2 ) return 0;
+
+ if( !n1 ) return 1;
+ if( !n2 ) return -1;
+
+ if( inet_aton(n1, &in1) && inet_aton(n2, &in2) )
+ return (long)ntohl(in1.s_addr) - (long)ntohl(in2.s_addr);
+
+ return strcmp( n1, n2 );
+}
+
+static void
+sort_arglist(args)
+ struct arglist * args;
+{
+ int n, i;
+ struct arglist sa;
+ struct arglist * a;
+ struct arglist ** table;
+
+ for(a = args, n = 0; a; a = a->next, n++);
+ table = emalloc(n * sizeof(struct arglist *));
+ for(a = args, i = 0; a; a = a->next, i++)
+ table[i] = a;
+
+ qsort(table, n, sizeof(struct arglist *), compar_hosts);
+
+ /* make sure list head remains the same */
+ for(i = 0; i < n && args != table[i]; i++);
+ if( i != 0 ) {
+ a = table[i];
+ table[i] = table[0];
+ table[0] = a;
+ memcpy(&sa, table[i], sizeof(struct arglist));
+ memcpy(table[i], table[0], sizeof(struct arglist));
+ memcpy(table[0], &sa, sizeof(struct arglist));
+ }
+
+ /* redo list links */
+ for(i = 1; i < n; i++)
+ table[i-1]->next = table[i];
+ table[n-1]->next = NULL;
+
+ efree(&table);
+}
int
arglist_to_html(hosts, filename)
@@ -245,8 +298,10 @@
perror("fopen ");
return(-1);
}
+ sort_arglist(hosts);
+
/* Print the Style Sheet Opts and Report Summary */
summary_to_file(file, hosts);
h = hosts;
_______________________________________________
Nessus mailing list
[EMAIL PROTECTED]
http://mail.nessus.org/mailman/listinfo/nessus