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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Oct 19 18:54:45 CEST 2009


Author: mime
Date: 2009-10-19 18:54:42 +0200 (Mon, 19 Oct 2009)
New Revision: 5627

Added:
   trunk/openvas-plugins/scripts/byte_func.inc
Modified:
   trunk/openvas-plugins/ChangeLog
   trunk/openvas-plugins/scripts/datawizard_ftpxq_test_accts.nasl
   trunk/openvas-plugins/scripts/gb_flock_detect_lin.nasl
   trunk/openvas-plugins/scripts/incomplete_http_requests_DoS.nasl
Log:
Added missing include

Modified: trunk/openvas-plugins/ChangeLog
===================================================================
--- trunk/openvas-plugins/ChangeLog	2009-10-19 14:41:42 UTC (rev 5626)
+++ trunk/openvas-plugins/ChangeLog	2009-10-19 16:54:42 UTC (rev 5627)
@@ -1,3 +1,14 @@
+2009-10-19  Michael Meyer <michael.meyer at intevation.de>
+
+	* scripts/byte_func.inc:
+	Added missing include.
+
+	* scripts/incomplete_http_requests_DoS.nasl,
+	scripts/gb_flock_detect_lin.nasl,
+	scripts/datawizard_ftpxq_test_accts.nasl:
+	Testing a socket with 'isnull()' sometimes doesn't work as
+	expected.
+
 2009-10-13  Thomas Reinke <reinke at securityspace.com>
 	* scripts/backport.inc:
 	Bugfix. Actually, more like limiting damage.

Added: trunk/openvas-plugins/scripts/byte_func.inc
===================================================================
--- trunk/openvas-plugins/scripts/byte_func.inc	2009-10-19 14:41:42 UTC (rev 5626)
+++ trunk/openvas-plugins/scripts/byte_func.inc	2009-10-19 16:54:42 UTC (rev 5627)
@@ -0,0 +1,111 @@
+###############################################################################
+# $Id$
+#
+# Authors:
+# Michael Meyer
+#
+# Copyright:
+# Copyright (c) 2009 Greenbone Networks GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2
+# (or any later version), as published by the Free Software
+# Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+# USA.
+###############################################################################
+
+global_var BYTE_ORDER;
+
+# Little-endian byte order 
+BYTE_ORDER_LITTLE_ENDIAN = 1;
+# Big-endian byte order
+BYTE_ORDER_BIG_ENDIAN    = 2;
+# Set default
+BYTE_ORDER = BYTE_ORDER_BIG_ENDIAN;
+
+function mkword() {
+  local_var value,DATA;
+
+  if(isnull(_FCT_ANON_ARGS[0])) {
+     return 0;
+  }
+  value = _FCT_ANON_ARGS[0];
+  if (BYTE_ORDER == BYTE_ORDER_BIG_ENDIAN) {
+    DATA = raw_string((value >> 8) & 255, value & 255);
+  } else {
+    DATA = raw_string(value & 255, (value >> 8) & 255);
+  }  
+ return DATA;
+}
+
+function set_byte_order() {
+  if(!isnull(_FCT_ANON_ARGS[0])) {
+    if(_FCT_ANON_ARGS[0] == BYTE_ORDER_BIG_ENDIAN || _FCT_ANON_ARGS[0] == BYTE_ORDER_LITTLE_ENDIAN) {
+      BYTE_ORDER = _FCT_ANON_ARGS[0];
+    }  
+  }   
+}
+
+function mkdword() {
+ local_var value,DATA;
+
+ if(isnull(_FCT_ANON_ARGS[0])) {
+  return 0;
+ }
+
+ value = _FCT_ANON_ARGS[0];
+
+ if(BYTE_ORDER == BYTE_ORDER_BIG_ENDIAN) {
+    DATA =  raw_string((value >> 24) & 255, (value >> 16) & 255, (value >>  8) & 255, (value) & 255);
+ } else {
+    DATA =  raw_string(value & 255, (value >> 8) & 255, (value >> 16) & 255, (value >> 24) & 255);
+ }
+ return DATA;
+}
+
+function mkpad() {
+ local_var length,DATA;
+ if(isnull(_FCT_ANON_ARGS[0])) {
+  length = 1000;
+ } else {
+  length = _FCT_ANON_ARGS[0];
+ }
+ DATA = crap(data:raw_string(0x00), length:length);
+ return DATA;
+}
+
+function getword(blob,pos) {
+ local_var value,DATA;
+
+ if(!blob = substr(blob,pos))return 0;
+
+ if(BYTE_ORDER == BYTE_ORDER_BIG_ENDIAN) {
+  DATA = ord(blob[0]) << 8 | ord(blob[1]);
+ } else {
+  DATA = ord(blob[0]) | ord(blob[1]) << 8;
+ }
+ return DATA;
+}
+
+function getdword(blob,pos) {
+ local_var value,DATA;
+
+ if(!blob = substr(blob,pos))return 0;
+
+ if (BYTE_ORDER == BYTE_ORDER_BIG_ENDIAN) {
+  DATA = ord(blob[0]) << 24 | ord(blob[1]) << 16 | ord(blob[2]) << 8 | ord(blob[3]);
+ }  else {
+  DATA = ord(blob[0]) | ord(blob[1]) << 8 | ord(blob[2]) << 16 | ord(blob[3]) << 24;
+ }
+return DATA;
+}
+


Property changes on: trunk/openvas-plugins/scripts/byte_func.inc
___________________________________________________________________
Name: svn:keywords
   + Id Revision

Modified: trunk/openvas-plugins/scripts/datawizard_ftpxq_test_accts.nasl
===================================================================
--- trunk/openvas-plugins/scripts/datawizard_ftpxq_test_accts.nasl	2009-10-19 14:41:42 UTC (rev 5626)
+++ trunk/openvas-plugins/scripts/datawizard_ftpxq_test_accts.nasl	2009-10-19 16:54:42 UTC (rev 5627)
@@ -79,7 +79,7 @@
 #
 
 soc = open_sock_tcp(port);
-if(isnull(soc)) exit(0);
+if(!soc) exit(0);
 
 n = 0;
 acct[n] = "anonymous";

Modified: trunk/openvas-plugins/scripts/gb_flock_detect_lin.nasl
===================================================================
--- trunk/openvas-plugins/scripts/gb_flock_detect_lin.nasl	2009-10-19 14:41:42 UTC (rev 5626)
+++ trunk/openvas-plugins/scripts/gb_flock_detect_lin.nasl	2009-10-19 16:54:42 UTC (rev 5627)
@@ -48,7 +48,7 @@
 include("version_func.inc");
 
 f_soc = ssh_login_or_reuse_connection();
-if(isnull(f_soc)){
+if(!f_soc){
   log_message(data:"gb_flock_detect_win.nasl:SSH login failed");
   exit(0);
 }

Modified: trunk/openvas-plugins/scripts/incomplete_http_requests_DoS.nasl
===================================================================
--- trunk/openvas-plugins/scripts/incomplete_http_requests_DoS.nasl	2009-10-19 14:41:42 UTC (rev 5626)
+++ trunk/openvas-plugins/scripts/incomplete_http_requests_DoS.nasl	2009-10-19 16:54:42 UTC (rev 5627)
@@ -98,7 +98,7 @@
 if(http_is_dead(port: port, retry:1)) dead ++;
 
 for (i = 0; i < imax; i++)
-  if (! isnull(soc[i]))
+  if (soc[i])
     http_close_socket(soc[i]);
 
 if(http_is_dead(port: port, retry:1)) dead ++;



More information about the Openvas-commits mailing list