90_ 发表于 2015-8-22 23:31:46

旁注查询脚本(python)

本帖最后由 90_ 于 2015-8-22 23:33 编辑

90sec@Joseph

# coding=utf-8
#author: 小续/Joseph
 
 
import urllib
import urllib2
import base64
import re
import sys
#填写供可以使用的key
AccountKey='OP8/b5S8imIbXfU1yOYpLbL7tcEgjJ/RJAJjJkTcrJo'
top=1000
skip=0
format='json'
def BingSearch(query):
    payload={}
    payload['$top']=top
    payload['$skip']=skip
    payload['$format']=format
    payload['Query']="'"+query+"'"
    url='https://api.datamarket.azure.com/Bing/Search/Web?' + urllib.urlencode(payload)    
    sAuth='Basic '+base64.b64encode(':'+AccountKey)
     
    headers = { }
    headers['Authorization']= sAuth
    try:
        req = urllib2.Request(url,headers=headers)       
        response = urllib2.urlopen(req)
        data=response.read()        
        return data
    except Exception as e:
        print e
def main():
        ip=raw_input('请输入你要查旁站的IP?127.0.0.1:'.decode('utf-8').encode('gbk'))
        print u"use exploit...."
        data=BingSearch("ip:"+ip)
        #setile=re.compile(r'\"Title\":\"(.*?)\"') 网址标题
        seurl=re.compile(r'\"Url\":\"(.*?)\"')
        #titles=setile.findall(data)
        filename=open('url.txt','a+')
        urls=seurl.findall(data)
        for i in xrange(0,len(urls)):
                seturl=re.compile(r'//(.*?)\/')
                url=seturl.findall(urls)
                print url
                filename.write(url+"\n")
                print u"已成功导出url.txt"
                pass
        filename.close()
if __name__ == '__main__':
        main()

Bat 发表于 2015-8-22 23:33:31

收下了。。

Jack-5 发表于 2015-8-23 03:37:56

还是不错的哦,顶了

borall 发表于 2015-8-23 07:48:51

感谢楼主的分享~

wanmznh 发表于 2015-8-23 19:02:30

感谢楼主的分享~

小路 发表于 2015-8-23 22:52:07

Sty,涛 发表于 2015-8-23 23:45:42

支持中国红客联盟(ihonker.org)

arctic 发表于 2015-8-23 23:59:47

支持,看起来不错呢!

ruguoruo 发表于 2015-8-24 20:21:32

学习学习技术,加油!

小路 发表于 2015-8-24 21:57:47

支持,看起来不错呢!
页: [1]
查看完整版本: 旁注查询脚本(python)