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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 23 08:33:25 CET 2011


Author: jan
Date: 2011-11-23 08:33:19 +0100 (Wed, 23 Nov 2011)
New Revision: 12162

Modified:
   trunk/openvas-plugins/ChangeLog
   trunk/openvas-plugins/scripts/secpod_qemu_detect_lin.nasl
Log:
* scripts/secpod_qemu_detect_lin.nasl: Revised according to CR#57.



Modified: trunk/openvas-plugins/ChangeLog
===================================================================
--- trunk/openvas-plugins/ChangeLog	2011-11-23 07:24:35 UTC (rev 12161)
+++ trunk/openvas-plugins/ChangeLog	2011-11-23 07:33:19 UTC (rev 12162)
@@ -1,3 +1,7 @@
+2011-11-23  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	* scripts/secpod_qemu_detect_lin.nasl: Revised according to CR#57.
+
 2011-11-22  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	* scripts/secpod_subversion_detect.nasl,

Modified: trunk/openvas-plugins/scripts/secpod_qemu_detect_lin.nasl
===================================================================
--- trunk/openvas-plugins/scripts/secpod_qemu_detect_lin.nasl	2011-11-23 07:24:35 UTC (rev 12161)
+++ trunk/openvas-plugins/scripts/secpod_qemu_detect_lin.nasl	2011-11-23 07:33:19 UTC (rev 12162)
@@ -7,6 +7,9 @@
 # Authors:
 # Nikita MR <rnikita at secpod.com>
 #
+# Updated by: <jan-oliver.wagner at greenbone.net> on 2011-11-22
+# Revised to comply with Change Request #57.
+#
 # Copyright:
 # Copyright (c) SecPod http://www.secpod.com
 #
@@ -24,23 +27,26 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 ###############################################################################
 
+SCRIPT_OID  = "1.3.6.1.4.1.25623.1.0.900969";
+
 if(description)
 {
-  script_id(900969);
+  script_oid(SCRIPT_OID);
   script_version("$Revision$");
   script_tag(name:"last_modification", value:"$Date$");
   script_tag(name:"creation_date", value:"2009-10-31 09:54:01 +0100 (Sat, 31 Oct 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("QEMU Version Detection (Linux)");
-  desc = "
-  Overview: This script is detects the installed version of QEMU and
-  sets the result in KB.";
+  script_description("Detection of installed version of QEMU.
 
-  script_description(desc);
-  script_summary("Set KB for the version of QEMU");
+The script logs in via ssh, searches for executable 'qemu' and
+queries the found executables via command line option '-help'.");
+  script_summary("Detection of installed versin of QEMU");
   script_category(ACT_GATHER_INFO);
   script_copyright("Copyright (C) 2009 SecPod");
-  script_family("Service detection");
+  script_family("Product detection");
   exit(0);
 }
 
@@ -50,35 +56,31 @@
 include("cpe.inc");
 include("host_details.inc");
 
-## Constant values
-SCRIPT_OID  = "1.3.6.1.4.1.25623.1.0.900969";
-SCRIPT_DESC = "QEMU Version Detection (Linux)";
-
 qemuSock = ssh_login_or_reuse_connection();
 if(!qemuSock){
-  exit(0);
+  if (defined_func("error_message"))
+    error_message(port:port, data:"Failed to open ssh port.");
+  exit(-1);
 }
 
 qemuName = find_file(file_name:"qemu", file_path:"/", useregex:TRUE,
                      regexpar:"$", sock:qemuSock);
 
-foreach binaryName (qemuName)
+foreach executableFile (qemuName)
 {
-  binaryName = chomp(binaryName);
-  qemuVer = get_bin_version(full_prog_name:binaryName, sock:qemuSock,
+  qemuVer = get_bin_version(full_prog_name:chomp(executableFile), sock:qemuSock,
                             version_argv:"-help",
                             ver_pattern:"QEMU PC emulator version ([0-9.]+)");
   if(qemuVer[1] != NULL){
     set_kb_item(name:"QEMU/Lin/Ver", value:qemuVer[1]);
-    security_note(data:"QEMU PC emulator version " + qemuVer[1] + " running " +
-                       "at location " + binaryName +
-                       " was detected on the host");
+    log_message(data:'Detected QEMI PC emulator version: ' + qemuVer[1] +
+        '\nLocation: ' + executableFile +
+        '\n\nConcluded from version identification result:\n' + qemuVer[max_index(qemuVer)-1]);
   
-    ## build cpe and store it as host_detail
     cpe = build_cpe(value:qemuVer[1], exp:"^([0-9.]+)", base:"cpe:/a:qemu:qemu:");
     if(!isnull(cpe))
-       register_host_detail(name:"App", value:cpe, nvt:SCRIPT_OID, desc:SCRIPT_DESC);
-
+      register_product(cpe:cpe, location:executableFile, nvt:SCRIPT_OID);
   }
 }
+
 ssh_close_connection();



More information about the Openvas-commits mailing list