2018-11-21 01:04:57 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
"""
|
|
|
|
Created by laramies on 2008-08-21.
|
|
|
|
"""
|
|
|
|
|
2018-11-21 11:17:41 +08:00
|
|
|
import socket
|
2018-11-21 01:04:57 +08:00
|
|
|
|
2018-12-28 06:23:36 +08:00
|
|
|
|
2018-11-21 01:04:57 +08:00
|
|
|
class Checker():
|
|
|
|
|
|
|
|
def __init__(self, hosts):
|
|
|
|
self.hosts = hosts
|
|
|
|
self.realhosts = []
|
|
|
|
|
|
|
|
def check(self):
|
|
|
|
for x in self.hosts:
|
2018-11-21 11:17:41 +08:00
|
|
|
x = str(x)
|
2018-11-21 01:04:57 +08:00
|
|
|
try:
|
|
|
|
res = socket.gethostbyname(x)
|
2018-11-21 11:17:41 +08:00
|
|
|
res = str(res)
|
2019-01-13 14:17:06 +08:00
|
|
|
self.realhosts.append(x + ':' + res)
|
2018-11-21 01:04:57 +08:00
|
|
|
except Exception as e:
|
2019-01-13 14:17:06 +08:00
|
|
|
self.realhosts.append(x + ':' + 'empty')
|
2018-11-21 01:04:57 +08:00
|
|
|
return self.realhosts
|