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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Dec 23 12:15:30 CET 2009


Author: felix
Date: 2009-12-23 12:15:24 +0100 (Wed, 23 Dec 2009)
New Revision: 6247

Modified:
   trunk/openvas-plugins/ChangeLog
   trunk/openvas-plugins/scripts/smb_nt.inc
Log:
Added "registry-kb-proxy" (see
http://lists.wald.intevation.org/pipermail/openvas-plugins/2009-December/000461.html
).

* scripts/smb_nt.inc (registry_get_sz): Added a kb-"proxy" (no better
name yet). Before actually querying the remote hosts registry, look in
the knowledge base, documentation.


Modified: trunk/openvas-plugins/ChangeLog
===================================================================
--- trunk/openvas-plugins/ChangeLog	2009-12-23 10:32:50 UTC (rev 6246)
+++ trunk/openvas-plugins/ChangeLog	2009-12-23 11:15:24 UTC (rev 6247)
@@ -1,3 +1,13 @@
+2009-12-23 Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
+	Added "registry-kb-proxy" (see
+	http://lists.wald.intevation.org/pipermail/openvas-plugins/2009-December/000461.html
+	).
+
+	* scripts/smb_nt.inc (registry_get_sz): Added a kb-"proxy" (no better
+	name yet). Before actually querying the remote hosts registry, look in
+	the knowledge base, documentation.
+
 2009-12-23 Michael Meyer <michael.meyer at intevation.de>
 
 	* scripts/secpod_ruby_detect_win.nasl:

Modified: trunk/openvas-plugins/scripts/smb_nt.inc
===================================================================
--- trunk/openvas-plugins/scripts/smb_nt.inc	2009-12-23 10:32:50 UTC (rev 6246)
+++ trunk/openvas-plugins/scripts/smb_nt.inc	2009-12-23 11:15:24 UTC (rev 6247)
@@ -2304,9 +2304,23 @@
 
  #---------------------------------------------------------------------#
  # registry_get_sz()						       #
+ # Queries the knowledge base, if item not found, tries to establish a #
+ # smb connection to the remote host.                                  #
+ # Returns NULL  if important connection parameters are missing,       #
+ #         FALSE if key could not be found or connection couldnt be    #
+ #               established                                           #
+ #         and the value of the queried key otherwise                  #
  #---------------------------------------------------------------------#
  function registry_get_sz(key, item)
  {
+	# Query KB ("proxy") first.
+	local_var kb_proxy, kb_proxy_key;
+	kb_proxy_key = string ("SMB/registry_get_sz/Registry/HKLM/", key, "/", item);
+	kb_proxy = get_kb_item (kb_proxy_key);
+	if (!isnull (kb_proxy) || kb_proxy)
+		return kb_proxy;
+
+	# Value has not been previousle written to KB, fetch it.
 	local_var name, _smb_port, login, pass, domain, soc, uid, tid, r, prot, pipe;
 	if(get_kb_item("SMB/samba")){
 		return NULL;
@@ -2429,9 +2443,12 @@
 			value = registry_decode_sz(data:r3);
 		}
 		close(soc);
+		# Place value into the KB
+		set_kb_item (name: kb_proxy_key, value:value);
 		return(value);
 	}
 	close(soc);
+
 	return(FALSE);
  }
 



More information about the Openvas-commits mailing list