python实现批量扫描iphttpbanner

一帘幽梦a 发布于 2015/06/09 17:08
阅读 1K+
收藏 1
大牛们帮我写一段批量从文本读取ip,扫描ip的httpbanner 

python
返回结果格式这样:


205.186.175.254  Apache/2.2.22  
205.186.175.155  Apache/2.2.22  
184.168.27.116 Microsoft-IIS/7.0  
?


万分感谢    
加载中
0
薄皮儿脆沙瓤
薄皮儿脆沙瓤
import urllib
import os,sys
def check(url):
    try:
        req=urllib.urlopen("http://"+url)
        info = req.info()
        webServerType = (info.dict)['server']
        print url + " : " + webServerType
    except Exception, e:
        print str(e)
if __name__ == '__main__':
    ipList = sys.argv[1]
    openfile = open(ipList,'r')
    for read in openfile.readlines():
        read = read.strip()

        check(read)

python script.py iplist


好用给分啊

一帘幽梦a
一帘幽梦a
非常不错,感谢 !
返回顶部
顶部