如何查找託管在IP地址上的所有主機?我已經檢查了Bing的API,但我不認爲它們提供了免費的API密鑰,以便使用IP地址進行查詢。 Google可能會在搜索第2-3頁後阻止。我也在尋找shodanhq api,但我認爲shodan不支持反向查找!使用Python進行反向IP查找
我在Windows上使用python 2.7。
如何查找託管在IP地址上的所有主機?我已經檢查了Bing的API,但我不認爲它們提供了免費的API密鑰,以便使用IP地址進行查詢。 Google可能會在搜索第2-3頁後阻止。我也在尋找shodanhq api,但我認爲shodan不支持反向查找!使用Python進行反向IP查找
我在Windows上使用python 2.7。
可能是這個劇本是爲你:
import urllib2
import socket
import sys
import re
class reverseip(object):
def __init__(self, server='http://www.ip-adress.com/reverse_ip/'):
t= """ Tool made by: LeXeL lexelEZ[at]gmail[dot]com """
print t
try:
self.site = raw_input("Enter site to start scan: ")
self.fileout = raw_input("Enter logfile name: ")
except KeyboardInterrupt:
print "\n\nError: Aborted"
sys.exit(1)
self.server = server
self.ua = "Mozilla/5.0 (compatible; Konqueror/3.5.8; Linux)"
self.h = {"User-Agent": self.ua}
self.write = True
try:
outp = open(self.fileout, "w+")
outp.write(t)
outp.close()
except IOError:
print '\n Failed to write to %s' % (self.fileout)
print '\n Continuing without writing'
self.write = False
def url(self):
r = urllib2.Request('%s%s' % (self.server, self.site), headers=self.h)
f = urllib2.urlopen(r)
self.source = f.read()
def getip(self):
try:
ip = socket.gethostbyname(self.site)
except IOError, e:
print "Error: %s " %(e)
else:
print "\t\nScanning ip %s \n\n" %(ip)
def whoami(self):
found = re.findall("href=\"/whois/\S+\">Whois</a>]",self.source)
for i in found:
i = i.replace("href=\"/whois/","")
i = i.replace("\">Whois</a>]","")
print "\t%s " % (i)
if self.write:
try:
outp = open(self.fileout, "a")
outp.write('%s\n' % (i))
outp.close()
except IOError:
print '\n Failed to write'
sys.exit(1)
if __name__ == '__main__':
p = reverseip()
p.url()
p.getip()
p.whoami()
與小modifciations你可以得到你想要的東西....告訴我,你有什麼感想,讓我知道如果我能幫助更多.. 。謝謝!
感謝幫助.. ofcourse是有益的,我有類似的概念,但與www.sameip.org .....但我正在尋找替代Bing API。 – Whiskey
總是樂於幫助。但是,這個網站還能添加我的朋友? – securecurve
沒有實際上API保持簡短和甜美... dint想要做一些額外的編碼:D如果API已經存在! Anywaz我搜索了很多,並發現了Bing的替代品。猜測將不得不與你要去的網址或sameip.org一起去。 :) – Whiskey
你是否想爲通配符DNS記錄輸出字面無限的輸出? – geoffspear
@Wooble A服務器不會有無限的記錄.. 我想要這樣的.. http://www.ip-adress.com/reverse_ip/,在這裏當你輸入一個IP或網站地址,它顯示其他網站駐留在同一臺服務器上。 例如:64.34.119.12(stackoverflow)這將顯示使用此特定IP託管的網站。 – Whiskey