Skip to content

Commit

Permalink
Merge pull request #83 from DavidTheWin/patch-1
Browse files Browse the repository at this point in the history
Checking type 1 message for unicode flag
  • Loading branch information
einfallstoll authored Jun 30, 2021
2 parents 42d9501 + b3ea3a2 commit aa7338c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/NTLM_No_Proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NTLM_No_Proxy.prototype.close = function() {

};

const NEGOTIATE_UNICODE = 1;
const NEGOTIATE_OEM = 1 << 1;
const REQUEST_TARGET = 1 << 2;
const NEGOTIATE_NTLM_KEY = 1 << 9;
Expand All @@ -15,11 +16,12 @@ const NEGOTIATE_TARGET_INFO = 1 << 23;

NTLM_No_Proxy.prototype.negotiate = function(ntlm_negotiate, negotiate_callback) {
const target_name = 'ALPHA';
let challenge_flags = NEGOTIATE_OEM | REQUEST_TARGET | TARGET_TYPE_DOMAIN;
let challenge_flags = NEGOTIATE_OEM | REQUEST_TARGET | TARGET_TYPE_DOMAIN;

// Follow requested NTLM protocol version
const request_flags = ntlm_negotiate.readUInt32LE(12);
const ntlm_version = request_flags & NEGOTIATE_NTLM2_KEY ? 2 : 1;
const is_unicode = request_flags & NEGOTIATE_UNICODE;
let header_len;
let data_len;

Expand All @@ -32,6 +34,10 @@ NTLM_No_Proxy.prototype.negotiate = function(ntlm_negotiate, negotiate_callback)
header_len = 40;
data_len = target_name.length;
}

if (is_unicode) {
challenge_flags |= NEGOTIATE_UNICODE;
}

let challenge = new Buffer(header_len + data_len);
let offset = 0;
Expand Down

0 comments on commit aa7338c

Please sign in to comment.