在企业环境中我试图抓取Web应用程序。我必须通过在CNTLM上运行的代理来访问它。
我尝试了这些库 - request-ntlm和httpntlm。在解决了库的一些小问题后,我终于得到了一个结果,说凭证无效。
这是我的整个(不工作)解决方案:
var ntlm = require('request-ntlm');
var opts = {
username: 'myaccount-clean text',
password: 'mypassword-clean text',
_domain: 'mydomain-clean text',
workstation: '',
url: 'https://web i am trying to access that requires ntlm',
proxy: "http://127.0.0.1:3128"
};
var json = {
// whatever object you want to submit
};
ntlm.get(opts, json, function(err, response) {
if ( err ) {
console.log( err );
}
else {
console.log( response );
}
});
PS:如果您在编译request-ntlm时遇到问题,只需使用_domain替换ntlm.js和index.js文件中的options.domain。