# 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[i])[0]
                print url
                filename.write(url+"\n")
                print u"已成功导出url.txt"
                pass
        filename.close()
if __name__ == '__main__':
        main()

QQ截图20150820224308