NTLM authentication and Samba LM/NT hash library
This library converts passwords into the LAN Manager (LM) and NT Hashes used by SMB/CIFS servers. It was written to populate the sambaLMPassword and sambaNTPassword values in an LDAP directory for use with Samba.
In addition, the library also provides helper methods for encoding and decoding the headers used during NTLM HTTP authentication. This functionality should presently be considered experimental.
npm install ntlm
NTLM HTTP Authentication headers are Base64-encoded packed structures of
three basic varieties. Type 1 & 3 are sent from the client to the server,
and Type 2 is from server to client. With the
// npm install ntlm request agentkeepalivevar url = ""domain =username =password =var ntlm = require'ntlm'ntlmrequest = require'request'defaultsagentClass: require'agentkeepalive'HttpsAgent;ntlmrequesturlheaders:'Authorization': ntlmchallengeHeaderhostname domain// Generate Type 3 to send as authentication to server:ntlmrequesturlheaders:'Authorization': ntlmresponseHeaderres url domain username passwordconsole.logbody;;;
var lmhash = require'smbhash'lmhash;var nthash = require'smbhash'nthash;var pass = 'pass123';console.log'LM Hash: ' + lmhashpass;console.log'NT Hash: ' + nthashpass;
This produces output:
LM Hash: 4FB7D301186E0EB3AAD3B435B51404EENT Hash: 5FBC3D5FEC8206A30F4B6C473D68AE76
The NTLM Authentication Protocol and Security Support Provider Copyright (C) 2003, 2006 Eric Glass http://davenport.sourceforge.net/ntlm.html NTLM Authentication Scheme for HTTP Ronald Tschalaer / 17. June 2003 http://www.innovation.ch/personal/ronald/ntlm.html