python ip反查域名

__author__ = 'niexinming'
# -*- coding: utf-8 -*-
import os
for i in range(0,255):
    comm="nslookup 10.1.89."+str(i)
    resul= os.popen(comm)
    resulstr=resul.read()
    if resulstr.find('NXDOMAIN')==-1:
        print resulstr
        print "发现的ip:"+comm[9:]

你可能感兴趣的:(python)