获取cookie信息,保存到本地
- curl命令访问
curl -L -c cookie -b cookie 'http://10.0.0.71/zabbix/index.php'
- 查看本地cookie文件
[root@zabbix-server ~]# cat cookie
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_10.0.0.71 FALSE /zabbix FALSE 0 PHPSESSID udhf7gpc7pc2n7ektn0iod2aj5
模拟登陆网站,或取登陆的cookie信息
- 在浏览器登陆网站,然后在开发着模式中找到session
- 使用curl命令模拟登录站点
curl -L -c cookie -b cookie -d 'name=Admin&password=zabbix&autologn+in' http://10.0.0.71/zabbix/index.php
- 查看cookie文件
[root@zabbix-server ~]# cat cookie
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_10.0.0.71 FALSE /zabbix FALSE 0 PHPSESSID udhf7gpc7pc2n7ektn0iod2aj5
#HttpOnly_10.0.0.71 FALSE /zabbix FALSE 1593072411 zbx_sessionid 412203d48b2ce4ad4f2457f0d52c42dd
文档更新时间: 2020-12-28 19:03 作者:Wan Hebin