1、在https://datamarket.azure.com/account/datasets这里注册帐号后申请一个免费的KEY,一个月可以查询5000次,其申请方法网上有很多教程了。
2、此脚本使用Sqlite作数据库,申请的KEY可以在使用前保存在数据库中。使用方法看使用提示。
3、使用示例:
bing.py -add P1f3+ZAPBRv/wy7i3bxxxxxm2MXq3aA+iuu1UT6ypkY //保存一个key到数据库中
bing.py -set 1 //把ID为1的Key设为默认使用的KEY.
bing.py -url www.google.com //查询google.com同IP的其他域名
bing.py -url 192.168.1.1-192.168.1.254 -save //查询指定IP段的域名,并保存到数据库中以便查询
bing.py -url -view //浏览数据库中保存的数据
以下是Python代码:
# -*- coding: utf-8 -*-
#https://datamarket.azure.com/account/datasets
#Code by Anle
import sys
import urllib
import urllib2
import base64
import sqlite3
import socket
import struct
import time
from datetime import datetime,timedelta
try:
import json
except ImportError:
import simplejson as json
AccountKey=''
top=100
skip=0
formats='json'
useCounts = 0
useID = 0
ConfigFile='%s\\bing.db' % (sys.path[0])
def _usage():
print 'Bing Domain dig Usage:'
print '\t%s <options> [Host]' % sys.argv[0]
print 'Options:\t'
print '-url\t\tOnly view url.\t'
print '-uri\t\tView url of full path.\t'
print '-desc\t\tView description info.\t'
print '-key\t\tView all account key.\t'
print '-add <key>\tAdd a key to database.\t'
print '-set <id> [num]\tSet a key to current use.\t'
print '-del <id>\tDelete a key from database.\t'
print '-view\t\tView the last saved record.\t'
print '-save\t\tSave to databse.\t'
print '-export <path>\tExport data to file.\n'
def CheckDatabaseExist():
szSQL="SELECT name FROM sqlite_master WHERE type='table' order by name;"
try:
conn=sqlite3.con