有没有办法从Firefox cookies文件中提取cookies? [英] Is there a way to extract cookies from the Firefox cookies file?

查看:927
本文介绍了有没有办法从Firefox cookies文件中提取cookies?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否可行,但是有没有办法从Firefox的cookies.sqlite文件中获取来自yahoo的cookie,然后在Java程序中使用这些信息?当我登录到雅虎,我告诉它让我登录。由于浏览器认为我仍然登录,该信息存储在一个cookie(我假设)。



我看到雅虎有他们的开发者的API 和一些OAuth库。为了能够使用OAuth登录,我需要注册我的程序,但我不想注册,除非必须注册。我发现这个从SO <关于如何使用sqlite.exe来查看文件。然而,该文件看起来像胡言乱语(对一个人),我不能告诉什么是我的cookie入口。

是否有另一种方法来解析这个文件,让我的雅虎饼干,并在Java程序中使用它?我必须注册我的秘密程序与雅虎正确使用OAuth登录到雅虎?感谢您提前给我的任何帮助。

对于Firefox,试试这个。它基于使用会话恢复文件的Firefox商店。这是bash语法,不是Java,但可以很容易地进行调整。

grep -o'{host:< HOSTNAME> ;[^}] *}'$ HOME / .mozilla / firefox / *。default / sessionstore-backups / recovery.js



这应该将每个cookie转储为一个JSON条目,该条目与您为< HOSTNAME> 放置的任何内容相关联。如果你有多个FF配置文件,你可能需要调整 *。default 部分。目录名存储在 .mozilla / firefox / profiles.ini 中,但是如果只存在一个配置文件,那么从中提取它实际上是过度的。


I'm not sure if this is possible but is there a way to grab the cookie from yahoo from Firefox's cookies.sqlite file and then use that information in a Java program? When I log into yahoo, I told it to leave me logged in. Since the browser thinks I'm still logged in, that info is stored in a cookie (I assume).

I saw yahoo has their developer's API and some OAuth library. To be able to use OAuth to log in, I would need to register my program but I don't want to register unless I have to. I found this post from SO on how to use sqlite.exe to view the file. However, the file looks like gibberish (to a human) and I can't tell what entry is my cookie.

Is there another way to parse this file to get my yahoo cookie and use it in a Java program? Do I have to register my "secret" program with yahoo to use OAuth properly to log into yahoo? Thanks in advance for any help you can give me.

解决方案

For Firefox, try this. It's based on using the session recovery file Firefox stores. This is bash syntax, not Java, but can probably be adapted pretty easily.

grep -o '{"host":"<HOSTNAME>"[^}]*}' $HOME/.mozilla/firefox/*.default/sessionstore-backups/recovery.js

That should dump out each cookie as a JSON entry that is associated with whatever you put in for <HOSTNAME>. You can adjust beyond that to extract the specific cookie you want.

Note: If you have more than one FF profile, you may need to adjust the *.default portion. The directory name is stored in .mozilla/firefox/profiles.ini, but extracting it from there is really overkill if only a single profile exists.

这篇关于有没有办法从Firefox cookies文件中提取cookies?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆