[Openvas-commits] r12140 - in trunk/openvas-plugins: . scripts
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Nov 21 10:06:27 CET 2011
Author: jan
Date: 2011-11-21 10:06:21 +0100 (Mon, 21 Nov 2011)
New Revision: 12140
Modified:
trunk/openvas-plugins/ChangeLog
trunk/openvas-plugins/scripts/secpod_sun_virtualbox_detect_lin.nasl
Log:
* scripts/gb_java_prdts_detect_lin.nasl: Reworked according to CR#57.
- Replaced script_id() by script_oid() call and moved SCRIPT_OID to top.
- Added cvss_base tag of 0.0.
- Added detection tag.
- Revised description with straighter text, no mentioning to KB (users
don't know about it and it is irrelevant for the report) and added
explanation how detection works.
- Remove mentioning of KB from summary.
- Changed family from Service detection to Product detection.
- Removed "SCRIPT_DESC" use at is not necessary anymore.
- Removed comments that provide no extra information
- In case of socket error, don't just exit with 0. Instead issue
error_message (if available) and exit with -1.
- Instead of security_note issue a log_message. Changed text of
message to explain the results.
- changed "binaryFile" to "executableFile" which is more precise
(register_cpe): Added param binFile and replaced call of
register_host_detail by call of register_product.
Modified: trunk/openvas-plugins/ChangeLog
===================================================================
--- trunk/openvas-plugins/ChangeLog 2011-11-21 08:49:42 UTC (rev 12139)
+++ trunk/openvas-plugins/ChangeLog 2011-11-21 09:06:21 UTC (rev 12140)
@@ -1,3 +1,24 @@
+2011-11-21 Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+ * scripts/gb_java_prdts_detect_lin.nasl: Reworked according to CR#57.
+ - Replaced script_id() by script_oid() call and moved SCRIPT_OID to top.
+ - Added cvss_base tag of 0.0.
+ - Added detection tag.
+ - Revised description with straighter text, no mentioning to KB (users
+ don't know about it and it is irrelevant for the report) and added
+ explanation how detection works.
+ - Remove mentioning of KB from summary.
+ - Changed family from Service detection to Product detection.
+ - Removed "SCRIPT_DESC" use at is not necessary anymore.
+ - Removed comments that provide no extra information
+ - In case of socket error, don't just exit with 0. Instead issue
+ error_message (if available) and exit with -1.
+ - Instead of security_note issue a log_message. Changed text of
+ message to explain the results.
+ - changed "binaryFile" to "executableFile" which is more precise
+ (register_cpe): Added param binFile and replaced call of
+ register_host_detail by call of register_product.
+
2011-11-21 Henri Doreau <henri.doreau at greenbone.net>
* scripts/host_details.inc (register_host_details): Made the description
Modified: trunk/openvas-plugins/scripts/secpod_sun_virtualbox_detect_lin.nasl
===================================================================
--- trunk/openvas-plugins/scripts/secpod_sun_virtualbox_detect_lin.nasl 2011-11-21 08:49:42 UTC (rev 12139)
+++ trunk/openvas-plugins/scripts/secpod_sun_virtualbox_detect_lin.nasl 2011-11-21 09:06:21 UTC (rev 12140)
@@ -10,6 +10,9 @@
# Updated by: <santu at secpod.com> on 2011-01-28
# Updated to detect the recent versions also
#
+# Updated by: <jan-oliver.wagner at greenbone.net> on 2011-11-21
+# Revsied to comply with Change Request #57.
+#
# Copyright:
# Copyright (c) 2009 SecPod, http://www.secpod.com
#
@@ -27,71 +30,70 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
###############################################################################
+SCRIPT_OID = "1.3.6.1.4.1.25623.1.0.901051";
+
if(description)
{
- script_id(901051);
+ script_oid(SCRIPT_OID);
script_version("$Revision$");
script_tag(name:"last_modification", value:"$Date$");
script_tag(name:"creation_date", value:"2009-11-20 06:52:52 +0100 (Fri, 20 Nov 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("Sun VirtualBox Version Detection (Linux)");
- desc = "
- Overview: This script detects installed version of Sun VirtualBox and
- sets the result in KB.";
+ script_description("Detection of installed versions of Sun VirtualBox,
+a hypervisor tool, on Linux systems.
- script_description(desc);
- script_summary("Set KB for the version of Sun VirtualBox");
+The script logs in via ssh, searches for binaries of VirtualBox and
+queries the found binaries via command line option '--version'.");
+ script_summary("Detects Sun VirtualBox on Linux");
script_category(ACT_GATHER_INFO);
script_copyright("Copyright (C) 2009 SecPod");
- script_family("Service detection");
+ 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.901051";
-SCRIPT_DESC = "Sun VirtualBox Version Detection (Linux)";
-
-
-## functions for script
-function register_cpe(tmpVers, tmpExpr, tmpBase){
-
+function register_cpe(tmpVers, tmpExpr, tmpBase, binFile){
local_var cpe;
- ## build cpe and store it as host_detail
cpe = build_cpe(value:tmpVers, exp:tmpExpr, base:tmpBase);
if(!isnull(cpe))
- register_host_detail(name:"App", value:cpe, nvt:SCRIPT_OID, desc:SCRIPT_DESC);
+ register_product(cpe:cpe, location:binFile, nvt:SCRIPT_OID);
}
-## start script
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);
}
getPath = find_bin(prog_name:"VBoxManage", sock:sock);
-foreach binaryFile (getPath)
+foreach executableFile (getPath)
{
- vbVer = get_bin_version(full_prog_name:chomp(binaryFile), sock:sock,
+ vbVer = get_bin_version(full_prog_name:chomp(executableFile), sock:sock,
version_argv:"--version",
ver_pattern:"([0-9.]+([a-z0-9]+)?)");
if(vbVer[1] != NULL)
{
- vbVer = ereg_replace(pattern:"([a-z])", string:vbVer[1], replace:".");
- if(vbVer){
- set_kb_item(name:"Sun/VirtualBox/Lin/Ver", value:vbVer);
- security_note(data:"sun (Oracle) VirtualBox version " + vbVer + " running at " +
- "location " + binaryFile + " was detected on the host");
+ Ver = ereg_replace(pattern:"([a-z])", string:vbVer[1], replace:".");
+ if(Ver){
+ set_kb_item(name:"Sun/VirtualBox/Lin/Ver", value:Ver);
+ log_message(data:'Detected Sun (Oracle) VirtualBox version: ' + Ver +
+ '\nLocation: ' + executableFile +
+ '\n\nConcluded from version identification result:\n' + vbVer[max_index(vbVer)-1]);
- ## build cpe and store it as host_detail
- register_cpe(tmpVers:vbVer, tmpExpr:"^(3\..*)", tmpBase:"cpe:/a:sun:virtualbox:");
- register_cpe(tmpVers:vbVer, tmpExpr:"^([0-2]\..*)", tmpBase:"cpe:/a:sun:xvm_virtualbox:");
+ register_cpe(tmpVers:Ver, tmpExpr:"^(3\..*)",
+ tmpBase:"cpe:/a:sun:virtualbox:", binFile:executableFile);
+ register_cpe(tmpVers:Ver, tmpExpr:"^([0-2]\..*)",
+ tmpBase:"cpe:/a:sun:xvm_virtualbox:", binFile:executableFile);
}
}
}
+
ssh_close_connection();
More information about the Openvas-commits
mailing list