如何在Python中检索和显示Internet历史信息?

2024-09-30 03:23:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用Python显示系统的所有Internet历史信息。这个索引.dat文件包含用户的所有历史信息,但它是经过编码的。我该怎么解码呢?在

[我听说过WinInet方法INTERNET_CACHE_ENTRY_INFO。它提供有关访问过的网站、点击量等信息。]

Python中有没有可用的库来实现这一点?如果没有,是否有其他选择?在


Tags: 文件方法用户info信息cache编码系统
2条回答

如果您想对Firefox历史记录执行此操作,那么它是文件中的一个SQLITE数据库places.sqlite在用户的firefox配置文件中。它可以用python的sqlite3库打开。如果你只关心探索者(正如你提到的索引.dat),我不知道。在

仅从中获取URL的代码索引.dat文件(仅IE历史记录)

import sys,os
from string import *
from binascii import *
from chardet import *
import re
arr=[]
ar=[]
st=""
url=""
lines=[]

def removenonascii(s):

    l=""
    for i in s:
        if(ord(i)==46 or ord(i)==47 or ord(i)==72 or ord(i) in range(97,97+26) or ord(i) in range(65,65+26)):
        l=l+i
    lines=l.split('\n')


    for line in lines:
        if line.startswith("http"):
            print line.split("URL")[0]

infile =open("C:\Users\Cho\AppData\Local\Microsoft\Windows\History\History.IE5\MSHist012012030720120308\index.dat","r")
for line in infile:
    arr=line.split("Cho")

for s in arr:
    removenonascii(s)
    print s

相关问题 更多 >

    热门问题