From 5d68a8167b041359ebd85f91153abbabcea44754 Mon Sep 17 00:00:00 2001 From: David Maloney Date: Tue, 2 Jun 2015 12:46:21 -0500 Subject: [PATCH] handle unicode changes changed everything to utf-8 , so several sizes on the ruby side needed to be changed to account for this MSP-12358 --- lib/metasploit/framework/ntds/account.rb | 6 +++--- lib/metasploit/framework/ntds/parser.rb | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/metasploit/framework/ntds/account.rb b/lib/metasploit/framework/ntds/account.rb index bd485790c8..f5f5a6e2d9 100644 --- a/lib/metasploit/framework/ntds/account.rb +++ b/lib/metasploit/framework/ntds/account.rb @@ -6,17 +6,17 @@ module Metasploit class Account # Size of an NTDS Account Struct on the Wire - ACCOUNT_SIZE = 3948 + ACCOUNT_SIZE = 2908 # Size of a Date or Time Format String on the Wire DATE_TIME_STRING_SIZE = 30 # Size of the AccountDescription Field - DESCRIPTION_SIZE =2048 + DESCRIPTION_SIZE =1024 # Size of a Hash History Record HASH_HISTORY_SIZE = 792 # Size of a Hash String HASH_SIZE = 33 # Size of the samAccountName field - NAME_SIZE = 40 + NAME_SIZE = 20 #@return [String] The AD Account Description attr_accessor :description diff --git a/lib/metasploit/framework/ntds/parser.rb b/lib/metasploit/framework/ntds/parser.rb index 80fa1792cd..ac7a8c0274 100644 --- a/lib/metasploit/framework/ntds/parser.rb +++ b/lib/metasploit/framework/ntds/parser.rb @@ -6,10 +6,8 @@ module Metasploit # to provide a simple interface for enumerating AD user accounts. class Parser - # The size, in bytes, of an NTDS account object - ACCOUNT_SIZE = 3948 # The size, in Bytes, of a batch of NTDS accounts - BATCH_SIZE = 78960 + BATCH_SIZE = (Metasploit::Framework::NTDS::Account::ACCOUNT_SIZE * 20) #@return [Rex::Post::Meterpreter::Channels::Pool] The Meterpreter NTDS Parser Channel attr_accessor :channel @@ -36,7 +34,7 @@ module Metasploit until raw_batch_data.nil? batch = raw_batch_data.dup while batch.present? - raw_data = batch.slice!(0,ACCOUNT_SIZE) + raw_data = batch.slice!(0,Metasploit::Framework::NTDS::Account::ACCOUNT_SIZE) # Make sure our data isn't all Null-bytes if raw_data.match(/[^\x00]/) account = Metasploit::Framework::NTDS::Account.new(raw_data)