domain_GooglePDF.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:DataSploit 作者: zanyarjamal 项目源码 文件源码
def googlesearch(query, ext):
    print query
    google="https://www.google.co.in/search?filter=0&q=site:" 
    getrequrl="https://www.google.co.in/search?filter=0&num=100&q=%s&start=" % (query)
    hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', 
       'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 
       'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 
       'Accept-Encoding': 'none', 
       'Accept-Language': 'en-US,en;q=0.8', 
       'Connection': 'keep-alive'} 
    req=urllib2.Request(getrequrl, headers=hdr) 
    response=urllib2.urlopen(req) 
    data = response.read() 
    data=re.sub('<b>','',data) 
    for e in ('>','=','<','\\','(',')','"','http',':','//'): 
        data = string.replace(data,e,' ') 

    r1 = re.compile('[-_.a-zA-Z0-9.-_]*'+'\.'+ ext)     
    res = r1.findall(data) 
    if res==[]:
        print "No results were found"
    else:
        return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号