[Openvas-commits] r12190 - in trunk/openvas-plugins: . scripts

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 24 22:44:54 CET 2011


Author: jan
Date: 2011-11-24 22:44:41 +0100 (Thu, 24 Nov 2011)
New Revision: 12190

Modified:
   trunk/openvas-plugins/ChangeLog
   trunk/openvas-plugins/scripts/secpod_avahi_detection_lin.nasl
   trunk/openvas-plugins/scripts/secpod_libpng_detect_lin.nasl
Log:
* scripts/secpod_avahi_detection_lin.nasl,
scripts/secpod_libpng_detect_lin.nasl: Revised according
to CR#57. Also fixed bug of too early exit.



Modified: trunk/openvas-plugins/ChangeLog
===================================================================
--- trunk/openvas-plugins/ChangeLog	2011-11-24 15:23:52 UTC (rev 12189)
+++ trunk/openvas-plugins/ChangeLog	2011-11-24 21:44:41 UTC (rev 12190)
@@ -1,3 +1,9 @@
+2011-11-24  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	* scripts/secpod_avahi_detection_lin.nasl,
+	scripts/secpod_libpng_detect_lin.nasl: Revised according
+	to CR#57. Also fixed bug of too early exit.
+
 2011-11-24  Henri Doreau <henri.doreau at greenbone.net>
 
 	* scripts/packeteer_web_detect.nasl: Inlined CVSS vector with the base

Modified: trunk/openvas-plugins/scripts/secpod_avahi_detection_lin.nasl
===================================================================
--- trunk/openvas-plugins/scripts/secpod_avahi_detection_lin.nasl	2011-11-24 15:23:52 UTC (rev 12189)
+++ trunk/openvas-plugins/scripts/secpod_avahi_detection_lin.nasl	2011-11-24 21:44:41 UTC (rev 12190)
@@ -7,6 +7,9 @@
 # Authors:
 # Sujit Ghosal <sghosal at secpod.com>
 #
+# Updated by: <jan-oliver.wagner at greenbone.net> on 2011-11-24
+# Revised to comply with Change Request #57.
+#
 # Copyright (c) 2008 SecPod, http://www.secpod.com
 #
 # This program is free software; you can redistribute it and/or modify
@@ -23,24 +26,26 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 ###############################################################################
 
+SCRIPT_OID  = "1.3.6.1.4.1.25623.1.0.900416";
+
 if(description)
 {
-  script_id(900416);
+  script_oid(SCRIPT_OID);
   script_version("$Revision$");
   script_tag(name:"last_modification", value:"$Date$");
   script_tag(name:"creation_date", value:"2008-12-31 15:14:17 +0100 (Wed, 31 Dec 2008)");
   script_tag(name:"risk_factor", value:"None");
+  script_tag(name:"cvss_base", value:"0.0");
+  script_tag(name:"detection", value:"executable version check");
   script_name("Avahi Version Detection (Linux)");
-  desc = "
+  script_description("Detection of installed version of Avahi Daemon.
 
-  Overview: The script detects the version of Avahi Daemon on remote host and
-  sets the KB.";
-
-  script_description(desc);
-  script_summary("Check for Avahi Daemon version");
+The script logs in via ssh, searches for executable 'avahi-daemon' and
+queries the found executables via command line option '--version'.");
+  script_summary("Detection of installed version of Avahi Daemon");
   script_category(ACT_GATHER_INFO);
   script_copyright("Copyright (C) 2008 SecPod");
-  script_family("General");
+  script_family("Product detection");
   exit(0);
 }
 
@@ -49,35 +54,31 @@
 include("cpe.inc");
 include("host_details.inc");
 
-## Constant values
-SCRIPT_OID  = "1.3.6.1.4.1.25623.1.0.900416";
-SCRIPT_DESC = "Avahi Version Detection (Linux)";
-
 sock = ssh_login_or_reuse_connection();
 if(!sock){
-  exit(0);
+  if (defined_func("error_message"))
+    error_message(port:port, data:"Failed to open ssh port.");
+  exit(-1);
 }
 
 avahiName = find_file(file_name:"avahi-daemon", file_path:"/", useregex:TRUE,
                       regexpar:"$", sock:sock);
-foreach binaryName (avahiName)
+foreach executableFile (avahiName)
 {
-  binaryName = chomp(binaryName);
-  avahiVer = get_bin_version(full_prog_name:binaryName, version_argv:"--version",
+  executableFile = chomp(executableFile);
+  avahiVer = get_bin_version(full_prog_name:executableFile, version_argv:"--version",
                               ver_pattern:"[0-9]\.[0-9.]+", sock:sock);
   if(avahiVer[0] != NULL)
   {
     set_kb_item(name:"Avahi/Linux/Ver", value:avahiVer[0]);
-    security_note(data:"Avahi Version " + avahiVer[0] + 
-        " running at location " + binaryName + " was detected on the host");
-    ssh_close_connection();
+    log_message(data:'Detected Avahi version: ' + avahiVer[0] +
+        '\nLocation: ' + executableFile +
+        '\n\nConcluded from version identification result:\n' + avahiVer[max_index(avahiVer)-1]);
     
-    ## build cpe and store it as host_detail
     cpe = build_cpe(value:avahiVer[0], exp:"^([0-9.]+)", base:"cpe:/a:avahi:avahi:");
     if(!isnull(cpe))
-       register_host_detail(name:"App", value:cpe, nvt:SCRIPT_OID, desc:SCRIPT_DESC);
-
-    exit(0);
+      register_product(cpe:cpe, location:executableFile, nvt:SCRIPT_OID);
   }
 }
+
 ssh_close_connection();

Modified: trunk/openvas-plugins/scripts/secpod_libpng_detect_lin.nasl
===================================================================
--- trunk/openvas-plugins/scripts/secpod_libpng_detect_lin.nasl	2011-11-24 15:23:52 UTC (rev 12189)
+++ trunk/openvas-plugins/scripts/secpod_libpng_detect_lin.nasl	2011-11-24 21:44:41 UTC (rev 12190)
@@ -7,6 +7,9 @@
 # Authors:
 # Chandan S <schandan at secpod.com>
 #
+# Updated by: <jan-oliver.wagner at greenbone.net> on 2011-11-24
+# Revised to comply with Change Request #57.
+#
 # Copyright:
 # Copyright (c) 2009 SecPod, http://www.secpod.com
 #
@@ -24,62 +27,59 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 ###############################################################################
 
+SCRIPT_OID  = "1.3.6.1.4.1.25623.1.0.900070";
+
 if(description)
 {
-  script_id(900070);
+  script_oid(SCRIPT_OID);
   script_version("$Revision$");
   script_tag(name:"last_modification", value:"$Date$");
   script_tag(name:"creation_date", value:"2009-01-22 12:00:13 +0100 (Thu, 22 Jan 2009)");
   script_tag(name:"risk_factor", value:"None");
+  script_tag(name:"cvss_base", value:"0.0");
+  script_tag(name:"detection", value:"executable version check");
   script_name("libpng Version Detection");
-  desc = "
+  script_description("Detection of installed version of libpng.
 
-  Overview: The script detects the version of libpng and sets the
-  result in KB.";
-
-  script_description(desc);
-  script_summary("Set the KB for the version of libpng");
+The script logs in via ssh, searches for executable 'libpng-config' and
+queries the found executables via command line option '-v'.");
+  script_summary("Detection of installed version of libpng");
   script_category(ACT_GATHER_INFO);
   script_copyright("Copyright (C) 2009 SecPod");
-  script_family("General");
+  script_family("Product detection");
   exit(0);
 }
 
-
 include("ssh_func.inc");
 include("version_func.inc");
 include("cpe.inc");
 include("host_details.inc");
 
-## Constant values
-SCRIPT_OID  = "1.3.6.1.4.1.25623.1.0.900070";
-SCRIPT_DESC = "libpng Version Detection";
-
 sock = ssh_login_or_reuse_connection();
 if(!sock){
-  exit(0);
+  if (defined_func("error_message"))
+    error_message(port:port, data:"Failed to open ssh port.");
+  exit(-1);
 }
 
 pngName = find_file(file_name:"libpng-config", file_path:"/", useregex:TRUE,
                     regexpar:"$", sock:sock);
-foreach binaryName (pngName)
+foreach executableFile (pngName)
 {
-  binaryName = chomp(binaryName);
-  pngVer = get_bin_version(full_prog_name:binaryName, version_argv:"--version",
+  executableFile = chomp(executableFile);
+  pngVer = get_bin_version(full_prog_name:executableFile, version_argv:"--version",
                            ver_pattern:"[0-9.]+", sock:sock);
   if(pngVer[0] != NULL)
   {
     set_kb_item(name:"Libpng/Version", value:pngVer[0]);
-    security_note(data:"libpng Version " + pngVer[0] +
-          " running at location " + binaryName + " was detected on the host");
-    ssh_close_connection();
+    log_message(data:'Detected libpng version: ' + pngVer[0] +
+        '\nLocation: ' + executableFile +
+        '\n\nConcluded from version identification result:\n' + pngVer[max_index(pngVer)-1]);
      
-    ## build cpe and store it as host_detail
     cpe = build_cpe(value:pngVer[0], exp:"^([0-9.]+)", base:"cpe:/a:libpng:libpng:");
     if(!isnull(cpe))
-       register_host_detail(name:"App", value:cpe, nvt:SCRIPT_OID, desc:SCRIPT_DESC);
-
-    exit(0);
+      register_product(cpe:cpe, location:executableFile, nvt:SCRIPT_OID);
   }
 }
+
 ssh_close_connection();



More information about the Openvas-commits mailing list