[问题]cURL抓取javascript 生成的cookie的问题

软件和网站开发以及相关技术探讨
回复
头像
onedayoneday
帖子: 26
注册时间: 2008-04-24 17:02

[问题]cURL抓取javascript 生成的cookie的问题

#1

帖子 onedayoneday » 2008-07-11 10:43

可以用下面的方法保存www.baidu.com 的cookie,但页面中有javascript生成cookie时,firefox的工具-页面信息中有显示但好像curl识别不了 我curl的那个页面嵌套了http://www.google-analytics.com/urchin.js ,它也设置了一些cookies
btw 我是想现用cURL熟悉一下 登录bbs 及 发帖 发送的数据post 过程 再用python去编写

curl 官方页面上说“Some web-based login systems features various amounts of javascript, and
sometimes they use such code to set or modify cookie contents. Possibly they
do that to prevent programmed logins, like this manual describes how to...
Anyway, if reading the code isn't enough to let you repeat the behavior
manually, capturing the HTTP requests done by your browers and analyzing the
sent cookies is usually a working method to work out how to shortcut the
javascript need.”

是不是必需人工处理啊 顺便问一下,firefox cookie 默认保存在哪个文件夹 ,自己先去找找

发帖时 我把用wireshark抓取的头(浏览器中发帖,包含cookie) 加上 发帖内容等 post 给发帖的 /cgi-bin/.... 显示没有登录 ,浏览器没有关,并且也用curl登录了,只是没有获取cookie
谢谢各位善良坛友的阅读 期待cURL高手指教





:~$ curl -c baiducookie www.baidu.com
################################baidu cookie#########
# Netscape HTTP Cookie File
# http://curlm.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

.baidu.com TRUE / FALSE 2147483647 BAIDUID 7522B475D7A6073ADC0566A7B7A4150B:FG=1
头像
onedayoneday
帖子: 26
注册时间: 2008-04-24 17:02

#2

帖子 onedayoneday » 2008-07-11 10:59

这应该不算Cookie欺骗吧

   :D
头像
solcomo
帖子: 2838
注册时间: 2007-04-25 13:12

#3

帖子 solcomo » 2008-07-11 11:19

代码: 全选

:~$ curl -c baiducookie www.baidu.com
获得这个cookie没什么用啊
你得到登录页面
提交Form再获取cookie
头像
onedayoneday
帖子: 26
注册时间: 2008-04-24 17:02

#4

帖子 onedayoneday » 2008-07-11 13:21

我是说登录学校的bbs ,而不是登录baidu空间之类的

学校的bbs login 之后,是一个框架 frameset ,curl不会返回里面的frame(而浏览器回打开),如果里面的页面也设置cookie,怎么办呢?
当cookie 是javascript生成的
curl 可以抓到么?
solcomo 写了:

代码: 全选

:~$ curl -c baiducookie www.baidu.com
获得这个cookie没什么用啊
你得到登录页面
提交Form再获取cookie
头像
solcomo
帖子: 2838
注册时间: 2007-04-25 13:12

#5

帖子 solcomo » 2008-07-11 14:52

...那你就只能自己分析curl返回的东西了
头像
onedayoneday
帖子: 26
注册时间: 2008-04-24 17:02

#6

帖子 onedayoneday » 2008-07-11 15:34

solcomo 写了:...那你就只能自己分析curl返回的东西了
发帖过程中,发现cookie 一直没变,用wireshark 截取了 保存下来

curl -b "cookie内容“ -d "post内容“ url(发帖处理脚本)

可以继续发帖
已经成功


谢谢 :P
回复