diff --git a/lib/rex/proto/ntlm/utils.rb b/lib/rex/proto/ntlm/utils.rb index 3290761c55..e61ab03dc4 100644 --- a/lib/rex/proto/ntlm/utils.rb +++ b/lib/rex/proto/ntlm/utils.rb @@ -397,16 +397,21 @@ class Utils case atype when 1 #netbios name - data[:default_name] = addr.gsub("\x00", '') + temp_name = addr + temp_name.force_encoding("UTF-16LE") + data[:default_name] = temp_name.encode("UTF-8") when 2 #netbios domain - data[:default_domain] = addr.gsub("\x00", '') + data[:default_domain] = addr + data[:default_domain].force_encoding("UTF-16LE") when 3 #dns name - data[:dns_host_name] = addr.gsub("\x00", '') + data[:dns_host_name] = addr + data[:dns_host_name].force_encoding("UTF-16LE") when 4 #dns domain - data[:dns_domain_name] = addr.gsub("\x00", '') + data[:dns_domain_name] = addr + data[:dns_domain_name].force_encoding("UTF-16LE") when 5 #The FQDN of the forest. when 6