From ce9bfec34f63cf0a52da3edd9610ba66d4a9ade6 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Wed, 14 Oct 2009 17:51:44 +0000 Subject: [PATCH] Fix string handling git-svn-id: file:///home/svn/framework3/trunk@7160 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/exploit/mssql.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/msf/core/exploit/mssql.rb b/lib/msf/core/exploit/mssql.rb index 786e354b3e..96df3f9390 100644 --- a/lib/msf/core/exploit/mssql.rb +++ b/lib/msf/core/exploit/mssql.rb @@ -368,6 +368,7 @@ module Exploit::Remote::MSSQL if( str[0,5] == "\x02\x00\x21\x00\x27" or # varchar str[0,5] == "\x02\x00\x08\x00\x27" or + str[0,5] == "\x02\x00\x01\x00\x27" or str[0,5] == "\x12\x00\x08\x00\x27" or str[0,5] == "\x12\x00\x09\x00\x27" or str[0,5] == "\x04\x00\x09\x00\x25" or # varbinary @@ -469,11 +470,11 @@ module Exploit::Remote::MSSQL when :hex len = data.slice!(0,1).unpack('C')[0] - row << (len > 0) ? data.slice!(0,len) : '' + row << ((len > 0) ? data.slice!(0,len) : '') when :string len = data.slice!(0,1).unpack('C')[0] - row << (len > 0) ? data.slice!(0,len) : '' + row << ((len > 0) ? data.slice!(0,len) : '') when :datetime # XXX: convert to unix time @@ -486,11 +487,11 @@ module Exploit::Remote::MSSQL when :image len = data.slice!(0,1).unpack('C')[0] - row << (len > 0) ? data.slice!(0,len).unpack("H*")[0] : '' + row << ((len > 0) ? data.slice!(0,len).unpack("H*")[0] : '') when :binary len = data.slice!(0,1).unpack('C')[0] - row << (len > 0) ? data.slice!(0,len).unpack("H*")[0] : '' + row << ((len > 0) ? data.slice!(0,len).unpack("H*")[0] : '') when :unknown len = data.slice!(0,1).unpack('C')[0]