Comparing version 1.6.1 to 1.7.0
@@ -0,1 +1,9 @@ | ||
/** | ||
* Copyright (c) 2013 Sam Decrock https://github.com/SamDecrock/ | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
'use strict'; | ||
@@ -2,0 +10,0 @@ |
18
ntlm.js
@@ -0,1 +1,9 @@ | ||
/** | ||
* Copyright (c) 2013 Sam Decrock https://github.com/SamDecrock/ | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var crypto = require('crypto'); | ||
@@ -140,2 +148,4 @@ | ||
var password = options.password; | ||
var lm_password = options.lm_password; | ||
var nt_password = options.nt_password; | ||
var negotiateFlags = msg2.negotiateFlags; | ||
@@ -166,7 +176,7 @@ | ||
var lmChallengeResponse = calc_resp(create_LM_hashed_password_v1(password), nonce); | ||
var ntChallengeResponse = calc_resp(create_NT_hashed_password_v1(password), nonce); | ||
var lmChallengeResponse = calc_resp((lm_password!=null)?lm_password:create_LM_hashed_password_v1(password), nonce); | ||
var ntChallengeResponse = calc_resp((nt_password!=null)?nt_password:create_NT_hashed_password_v1(password), nonce); | ||
if(isNegotiateExtendedSecurity){ | ||
var pwhash = create_NT_hashed_password_v1(password); | ||
var pwhash = (nt_password!=null)?nt_password:create_NT_hashed_password_v1(password); | ||
var clientChallenge = ""; | ||
@@ -389,2 +399,4 @@ for(var i=0; i < 8; i++){ | ||
exports.createType3Message = createType3Message; | ||
exports.create_NT_hashed_password = create_NT_hashed_password_v1; | ||
exports.create_LM_hashed_password = create_LM_hashed_password_v1; | ||
@@ -391,0 +403,0 @@ |
{ | ||
"name": "httpntlm", | ||
"description": "httpntlm is a Node.js library to do HTTP NTLM authentication", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"dependencies": { | ||
@@ -6,0 +6,0 @@ "httpreq": ">=0.4.22", |
@@ -34,2 +34,47 @@ # httpntlm | ||
## pre-encrypt the password | ||
```js | ||
var httpntlm = require('httpntlm'); | ||
var lm = ntlm.create_LM_hashed_password('Azx123456'); | ||
var nt = ntlm.create_NT_hashed_password('Azx123456'); | ||
console.log(lm); | ||
console.log(Array.prototype.slice.call(lm, 0)); | ||
lm = new Buffer([ 183, 180, 19, 95, 163, 5, 118, 130, 30, 146, 159, 252, 1, 57, 81, 39 ]); | ||
console.log(lm); | ||
console.log(nt); | ||
console.log(Array.prototype.slice.call(nt, 0)); | ||
nt = new Buffer([150, 27, 7, 219, 220, 207, 134, 159, 42, 60, 153, 28, 131, 148, 14, 1]); | ||
console.log(nt); | ||
httpntlm.get({ | ||
url: "https://someurl.com", | ||
username: 'm$', | ||
lm_password: lm, | ||
nt_password: nt, | ||
workstation: 'choose.something', | ||
domain: '' | ||
}, function (err, res){ | ||
if(err) return err; | ||
console.log(res.headers); | ||
console.log(res.body); | ||
}); | ||
/* you can save the array into your code and use it when you need it | ||
<Buffer b7 b4 13 5f a3 05 76 82 1e 92 9f fc 01 39 51 27>// before convert to array | ||
[ 183, 180, 19, 95, 163, 5, 118, 130, 30, 146, 159, 252, 1, 57, 81, 39 ]// convert to array | ||
<Buffer b7 b4 13 5f a3 05 76 82 1e 92 9f fc 01 39 51 27>//convert back to buffer | ||
<Buffer 96 1b 07 db dc cf 86 9f 2a 3c 99 1c 83 94 0e 01> | ||
[ 150, 27, 7, 219, 220, 207, 134, 159, 42, 60, 153, 28, 131, 148, 14, 1 ] | ||
<Buffer 96 1b 07 db dc cf 86 9f 2a 3c 99 1c 83 94 0e 01> | ||
*/ | ||
``` | ||
## Options | ||
@@ -43,4 +88,12 @@ | ||
if you already got the encrypted password,you should use this two param to replace the 'password' param. | ||
- `lm_password` _{Buffer}_ encrypted lm password.(Required) | ||
- `nt_password` _{Buffer}_ encrypted nt password. (Required) | ||
You can also pass along all other options of [httpreq](https://github.com/SamDecrock/node-httpreq), including custom headers, cookies, body data, ... and use POST, PUT or DELETE instead of GET. | ||
## Advanced | ||
@@ -47,0 +100,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26277
413
202