首页 新闻 会员 周边 捐助

node 爬虫 登录浏览器窗口认证问题

0
悬赏园豆:100 [待解决问题]

我写了一个爬虫,但是爬的页面需要登录。而且不是普通的那种登录,

而是 如图:

 

请问在node 中如何 输入这种用户名和密码?

问题补充:

那么请问:

如下的 requrest headers

 

  1. Accept:
    text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  2. Accept-Encoding:
    gzip, deflate, sdch
  3. Accept-Language:
    zh-CN,zh;q=0.8
  4. Authorization:
    Negotiate TlRMTVNTUAADAAAAGAAYAKIAAAB0AXQBugAAAAAAAABYAAAALAAsAFgAAAAeAB4AhAAAABAAEAAuAgAAFYKI4goA1zoAAAAPZFwgtPM3b0HQ6sjqR/LzhUQAbwBuAGcAWQBhAG4AZwAuAEwAaQBAAGMAbgAuAGEAYgBiAC4AYwBvAG0ATABBAFAAVABPAFAALQBPAFUATQBLAE4AMgAzAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEdSgKeegkThmfCYf4Alw3gEBAAAAAAAAx2Ouj2Is0wEHlZOnrvb0PQAAAAACABYAQQBTAEkAQQBQAEEAQwBJAEYASQBDAAEAGABDAE4ALQBTAC0AVgBEAE4ARQBUADQAMAAEACYAYQBzAGkAYQBwAGEAYwBpAGYAaQBjAC4AYQBiAGIALgBjAG8AbQADAC4AQwBOAC0AUwAtAFYARABOAEUAVAA0ADAALgBjAG4ALgBhAGIAYgAuAGMAbwBtAAUADgBhAGIAYgAuAGMAbwBtAAcACADHY66PYizTAQYABAACAAAACAAwADAAAAAAAAAAAQAAAAAgAABfNwvufQg0a7aFWZeALWT6tH/s3Hk2qvpGhYUj2QHPkgoAEAAAAAAAAAAAAAAAAAAAAAAACQA4AEgAVABUAFAALwBDAE4ALQBTAC0AVgBEAE4ARQBUADQAMAAuAGMAbgAuAGEAYgBiAC4AYwBvAG0AAAAAAAAAAAAAAAAAuqBtJbteRO1rB4z8epV8Zw==
  5. Cache-Control:
    no-cache
  6. Connection:
    keep-alive
  7. Cookie:
    ASP.NET_SessionId=yxneiqxs55gtttbhpr2v1ccp; _gat=1; _ga=GA1.2.548323792.1505115839; _gid=GA1.2.1779367607.1505115839
  8. Host:
    cn-s-vdnet40.cn.abb.com
  9. Pragma:
    no-cache
  10. Upgrade-Insecure-Requests:
    1
  11. User-Agent:
    Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36

 

我用  如下的 node request 组件去模拟。

 

var options = {
url: 'http://cn-s-vtnet40.cn.abb.com/IprocessSWF/awdbau/Display?queueID=58b16290-257b-4c6e-82cd-18fb17ef6a97',
headers: {
'User-Agent': 'request',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Authorization':'Negotiate TlRMTVNTUAADAAAAGAAYAKIAAAB0AXQBugAAAAAAAABYAAAALAAsAFgAAAAeAB4AhAAAABAAEAAuAgAAFYKI4goA1zoAAAAPzMxrCPKh9QEx2sQsjcVNzUQAbwBuAGcAWQBhAG4AZwAuAEwAaQBAAGMAbgAuAGEAYgBiAC4AYwBvAG0ATABBAFAAVABPAFAALQBPAFUATQBLAE4AMgAzAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjklduhxwu4iO0OC/nzIb3AEBAAAAAAAAU82vhGAs0wFBhATZ/39fzwAAAAACABYAQQBTAEkAQQBQAEEAQwBJAEYASQBDAAEAGABDAE4ALQBTAC0AVgBEAE4ARQBUADQAMAAEACYAYQBzAGkAYQBwAGEAYwBpAGYAaQBjAC4AYQBiAGIALgBjAG8AbQADAC4AQwBOAC0AUwAtAFYARABOAEUAVAA0ADAALgBjAG4ALgBhAGIAYgAuAGMAbwBtAAUADgBhAGIAYgAuAGMAbwBtAAcACABTza+EYCzTAQYABAACAAAACAAwADAAAAAAAAAAAQAAAAAgAABfNwvufQg0a7aFWZeALWT6tH/s3Hk2qvpGhYUj2QHPkgoAEAAAAAAAAAAAAAAAAAAAAAAACQA4AEgAVABUAFAALwBDAE4ALQBTAC0AVgBEAE4ARQBUADQAMAAuAGMAbgAuAGEAYgBiAC4AYwBvAG0AAAAAAAAAAAAAAAAA2FD36r5NoSB/oqIPFE9nfg==',
'Cookie':'ASP.NET_SessionId=yxneiqxs55gtttbhpr2v1ccp; _gat=1; _ga=GA1.2.548323792.1505115839; _gid=GA1.2.1779367607.1505115839',
'Host':'cn-s-vdnet40.cn.abb.com'
}

还是无法登陆,请问应该如何写? 谢谢大家。

 

 

 

沉默的码畜的主页 沉默的码畜 | 初学一级 | 园豆:34
提问于:2017-09-11 16:57
< >
分享
所有回答(6)
0

抓包。看点登陆后发出去的包什么样的。

吴瑞祥 | 园豆:29449 (高人七级) | 2017-09-11 17:18
0

是不是basic认证?不管如何应该先查看响应代码

TCG2008 | 园豆:1150 (小虾三级) | 2017-09-11 17:26
0

试试cookie,参考:http://www.jianshu.com/p/87867f325184

ycyzharry | 园豆:25683 (高人七级) | 2017-09-11 18:45
0

你用浏览器f12或者httpwatcher或fiddler或者wireshark等,走一遍流程,然后按到这个流程的数据发送就行了

花飘水流兮 | 园豆:13595 (专家六级) | 2017-09-11 20:00
0

这个是用了http认证,  

从 

Authorization:
Negotiate TlRMTVNTU……
 
可以看出是用的 Negotiate Authorization,
不过这个协议我没用过,你可以查一下,怎么构造这种认证的http请求
苍枫露雨 | 园豆:1027 (小虾三级) | 2017-09-15 15:39
1

NTLM认证,参考这个看看http://www.cnblogs.com/shuidao/p/3634637.html

Timetombs | 园豆:3954 (老鸟四级) | 2017-09-21 13:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册