Exemplo n.º 1
0
    def __init__(self,
                 wordlist=None,
                 dname=None,
                 tld=CONST.DEFAULT_TLD,
                 deadonly=False,
                 debug=False,
                 time_to_sleep=0):

        self.wordlist = wordlist
        self.dname = dname
        self.tld = tld
        self.deadonly = deadonly
        self.debug = debug
        self.sleep = time_to_sleep
        self.whois_server = None

        self.whois_info = WhoisInfo()
        self.connection = WhoisServerConnection(self.whois_info)

        if self.debug is True:
            logging.basicConfig(level=logging.DEBUG)
        else:
            logging.basicConfig(level=logging.INFO)

        self.logger = logging.getLogger(__name__)
        self.logger.debug('constructor: __init__()')
Exemplo n.º 2
0
    def __init__(self, wordlist=None, dname=None, tld=CONST.DEFAULT_TLD, deadonly=False, debug=False, time_to_sleep=0):
        
        self.wordlist = wordlist
        self.dname = dname
        self.tld = tld
        self.deadonly = deadonly
        self.debug = debug
        self.sleep = time_to_sleep
        self.whois_server = None

        self.whois_info = WhoisInfo()
        self.connection = WhoisServerConnection(self.whois_info)

        if self.debug is True:
            logging.basicConfig(level=logging.DEBUG)
        else: 
            logging.basicConfig(level=logging.INFO)
            
        self.logger = logging.getLogger(__name__)
        self.logger.debug('constructor: __init__()')
Exemplo n.º 3
0
class WhoisSearch():
    
    def __init__(self, wordlist=None, dname=None, tld=CONST.DEFAULT_TLD, deadonly=False, debug=False, time_to_sleep=0):
        
        self.wordlist = wordlist
        self.dname = dname
        self.tld = tld
        self.deadonly = deadonly
        self.debug = debug
        self.sleep = time_to_sleep
        self.whois_server = None

        self.whois_info = WhoisInfo()
        self.connection = WhoisServerConnection(self.whois_info)

        if self.debug is True:
            logging.basicConfig(level=logging.DEBUG)
        else: 
            logging.basicConfig(level=logging.INFO)
            
        self.logger = logging.getLogger(__name__)
        self.logger.debug('constructor: __init__()')

    def whois_search(self):
        
        self.logger.debug('called whois_search()')

        self.whois_info.domain = self.dname
        
        if self.whois_server is None:
            self.whois_server = self.whois_info.get_whois_server()
        else:
            self.whois_info.get_domain_tld()
            self.whois_info.whoisserver = self.whois_server

        self.connection.sleep = self.sleep

        try:
            self.connection.connection()
        except WhoException, e:
            self.logger.info('connection issue [ %s ]' % e)
            self.whois_info.second_server = True
            self.whois_server = self.whois_info.get_whois_server()
        
        status = self.whois_info.is_domain_alive()
        
        if status is CONST.DOMAIN_SEARCH_EXCEEDED and self.connection.no_of_attempts is not 1 \
                or status is CONST.DOMAIN_STATUS_UNKNOWN:

            if status is CONST.DOMAIN_SEARCH_EXCEEDED:
                self.logger.debug('lets try a another server shall we. Attempts = %s', self.connection.no_of_attempts)
                self.whois_info.second_server = True

            self.connection.no_of_attempts = 1
            self.connection.connection()
        
        if status is CONST.DOMAIN_DEAD:
            
            return "No information about domain %s" % self.dname
        
        else:
            
            return self.whois_info.response
Exemplo n.º 4
0
class WhoisSearch():
    def __init__(self,
                 wordlist=None,
                 dname=None,
                 tld=CONST.DEFAULT_TLD,
                 deadonly=False,
                 debug=False,
                 time_to_sleep=0):

        self.wordlist = wordlist
        self.dname = dname
        self.tld = tld
        self.deadonly = deadonly
        self.debug = debug
        self.sleep = time_to_sleep
        self.whois_server = None

        self.whois_info = WhoisInfo()
        self.connection = WhoisServerConnection(self.whois_info)

        if self.debug is True:
            logging.basicConfig(level=logging.DEBUG)
        else:
            logging.basicConfig(level=logging.INFO)

        self.logger = logging.getLogger(__name__)
        self.logger.debug('constructor: __init__()')

    def whois_search(self):

        self.logger.debug('called whois_search()')

        self.whois_info.domain = self.dname

        if self.whois_server is None:
            self.whois_server = self.whois_info.get_whois_server()
        else:
            self.whois_info.get_domain_tld()
            self.whois_info.whoisserver = self.whois_server

        self.connection.sleep = self.sleep

        try:
            self.connection.connection()
        except WhoException, e:
            self.logger.info('connection issue [ %s ]' % e)
            self.whois_info.second_server = True
            self.whois_server = self.whois_info.get_whois_server()

        status = self.whois_info.is_domain_alive()

        if status is CONST.DOMAIN_SEARCH_EXCEEDED and self.connection.no_of_attempts is not 1 \
                or status is CONST.DOMAIN_STATUS_UNKNOWN:

            if status is CONST.DOMAIN_SEARCH_EXCEEDED:
                self.logger.debug(
                    'lets try a another server shall we. Attempts = %s',
                    self.connection.no_of_attempts)
                self.whois_info.second_server = True

            self.connection.no_of_attempts = 1
            self.connection.connection()

        if status is CONST.DOMAIN_DEAD:

            return "No information about domain %s" % self.dname

        else:

            return self.whois_info.response