搜索网站

2024-05-23 19:41:27 发布

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

import urllib
import re
import os
search = (raw_input('[!]Search: '))
site = "http://www.exploit-db.com/list.php?description="+search+"&author=&platform=&type=&port=&osvdb=&cve="   
print site
source = urllib.urlopen(site).read()
founds = re.findall("href='/exploits/\d+",source)
print "\n[+]Search",len(founds),"Results\n"
if len(founds) >=1:
        for found in founds:
                found = found.replace("href='","")
                print "http://www.exploit-db.com"+found
else:
        print "\nCouldnt find anything with your search\n"

当我搜索漏洞时-数据库我的网站我只得出25个结果,我如何才能使它转到另一个页面或去通过25个结果。在


Tags: importrecomhttpsourcedbsearchwww
2条回答

只需访问站点并在手动页面时查看URL即可轻松检查:只需将URL中的?放在page=1&后面查看结果的第二页,或者{}查看第三页,依此类推。在

这怎么会是一个Python问题?这是一个(非常基本的!)”“屏幕抓取”问题。在

显然是利用-数据库网站不允许扩展页面大小。因此,您需要通过重复urllib.urlopen()以获取后续页面。URL与最初使用的URL相同,加上&page=n参数。注意:此n值似乎是从0开始的(即&page=1将给出页)

相关问题 更多 >