Beispiel #1
0
 def get_domain_properties(self, domain):
     """
     get_domain_properties()
     """
     self.logger.debug('called get_domain_properties()')
     self.domain = domain
     prop = WhoisSearch(dname=self.domain)
     prop.whois_search()
     cdate = prop.creation_date()
     edate = prop.expiry_date()
     udate = prop.update_date()
     email = prop.emails()
     reg = prop.registrant()
     return cdate, edate, udate, email, reg
Beispiel #2
0
 def run(self):
     
     if self.type == CONST.SINGLE_TYPE:
         search = WhoisSearch()
         search.dname = self.data
         search.whois_search()
         self.obj.SetValue(search.response())
         
     else:
         self.tld = self.data[0]
         self.wordlist = self.data[1]
         self.domainlist = self.data[2]
         
         mwhois = WhoisSearch(None, self.tld, self.wordlist, self.domainlist,self.obj)
         if self.type == CONST.BASIC_TYPE:
             mwhois.whois_multi_search()
         else:
             mwhois.advance_search()
Beispiel #3
0
    def run(self):

        self.logger.debug('called SingleSearchThread().run')

        search = WhoisSearch()

        try:

            proxy_enabled = bool(
                GUIEvent(self).check_bool_settings('proxy_enabled'))

            if proxy_enabled is True:
                search.connection.proxy = True
                search.connection.proxy_host = str(
                    GUIEvent(self).check_settings('proxy_host'))
                search.connection.proxy_port = int(
                    GUIEvent(self).check_settings('proxy_port'))
                search.connection.proxy_type = int(
                    GUIEvent(self).check_settings('proxy_type'))
            else:
                search.connection.proxy = False

            self.logger.debug('trying search thread')

            if self._window_obj.history_select is True:

                self.logger.debug('history select enabled.')
                history_items = self._window_obj.m_listbox_history.GetItems()
                search.dname = history_items[
                    self._window_obj.m_listbox_history.GetSelection()]

                #TODO Have history search use stored results. Need to have history data stored in a list type
                # domain_history_list_no = self._window_obj.m_listbox_history.GetSelection()
                # self.logger.debug('history select enabled. using %s' % domain_history_list_no)
                # self._window_obj.history_select = False
                #
                # try:
                #     domain_history = str(self.get_history(domain_history_list_no))
                #     wx.PostEvent(self._window_obj, ResultEvent(self._window_obj.SINGLE_SEARCH_EVT_RESULT_ID,
                #                                                domain_history, 2))
                # except Exception, e:
                #     wx.PostEvent(self._window_obj, ResultEvent(self._window_obj.SINGLE_SEARCH_EVT_ERROR_ID, str(e)))

            else:
                search.dname = self._window_obj.m_textctrl_domain.GetValue()
                search.whois_server = str(
                    self._window_obj.m_combobox_whoisserver.GetValue())

            self.logger.debug('doing a whois search via whois servers')

            search.connection.timeout = int(
                GUIEvent(self).check_settings('connection_timeout'))
            search.whois_search()

            #self.set_history(self.history_list_counter, search.response())
            #self.history_list_counter += 1

            wx.PostEvent(
                self._window_obj,
                ResultEvent(self._window_obj.HISTORY_DISPLAY_EVT_ID,
                            search.dname))
            wx.PostEvent(
                self._window_obj,
                ResultEvent(self._window_obj.SINGLE_SEARCH_EVT_RESULT_ID,
                            search.response(),
                            search.whois_info.is_domain_alive()))
        except Exception, e:

            self.logger.error('error %s' % str(e))
            wx.PostEvent(
                self._window_obj,
                ResultEvent(self._window_obj.SINGLE_SEARCH_EVT_ERROR_ID,
                            str(e)))
            raise exception.GUIException(self._window_obj,
                                         traceback.format_exc())
Beispiel #4
0
    def run(self):

        self.logger.debug('called MultiSearchThread().run')

        search = WhoisSearch()
        search.wordlist = self._window_obj.m_list_multi_list.GetItems()

        #TODO If multi list box has values use it else get file from file textbox
        #Disabled....
        # if len(self._window_obj.m_list_multi_list.GetItems()):
        #     self.logger.debug('using mutil gui listbox')
        #     search.wordlist = self._window_obj.m_list_multi_list.GetItems()
        # else:
        #     self.logger.debug('using mutil word file textbox')
        #     search.wordlist = self._window_obj.m_textctrl_file.GetValue()

        tld = self._window_obj.m_combo_tld.GetValue()
        cctld = self._window_obj.m_combo_cctld.GetValue()
        gtld = self._window_obj.m_combo_gtld.GetValue()

        if tld != '' and cctld != '': search.tld = tld + "." + cctld
        elif tld != '': search.tld = tld
        elif cctld != '': search.tld = cctld
        elif gtld != '': search.tld = gtld
        #else:search.tld = 'com'

        if self._window_obj.m_checkbox_dead.GetValue() is True:
            search.deadonly = True

        if not len(self._window_obj.m_textctrl_sleep.GetValue()):
            self._window_obj.m_textctrl_sleep.SetValue('0')

        search.sleep = float(self._window_obj.m_textctrl_sleep.GetValue())

        try:

            proxy_enabled = bool(
                GUIEvent(self).check_bool_settings('proxy_enabled'))

            if proxy_enabled is True:
                search.connection.proxy = True
                search.connection.proxy_host = str(
                    GUIEvent(self).check_settings('proxy_host'))
                search.connection.proxy_port = int(
                    GUIEvent(self).check_settings('proxy_port'))
                search.connection.proxy_type = int(
                    GUIEvent(self).check_settings('proxy_type'))
            else:
                search.connection.proxy = False

            search.connection.timeout = int(
                GUIEvent(self).check_settings('connection_timeout'))

            multi = search.whois_multi_search()

            for multi_list in multi:

                status = multi_list[0]
                domain = multi_list[1]
                whois_server = search.whois_server
                creation_date = search.creation_date()
                expiry_date = search.expiry_date()
                update_date = search.update_date()

                if self._want_abort is 0:
                    wx.PostEvent(
                        self._window_obj,
                        ResultEvent(
                            self._window_obj.MULTI_SEARCH_EVT_RESULT_ID,
                            status, domain, creation_date, expiry_date,
                            update_date, whois_server))
                else:
                    self.logger.debug('aborted MultiSearchThread()')
                    break

        except Exception, e:

            self.logger.debug('error in MultiSearchThread() %s' % e)
            wx.PostEvent(
                self._window_obj,
                ResultEvent(self._window_obj.MULTI_SEARCH_EVT_ERROR_ID, e))
            raise exception.GUIException(self._window_obj,
                                         traceback.format_exc())
Beispiel #5
0
def main():
    usage = "usage: %prog [options] -i [file-to-read-from] -o [file-to-write-too]\n \n Examples:\n mwhois -t net -i /tmp/wordlist -o /tmp/domains\n mwhois sourceforge.net\n mwhois --gui \n\nWordlists Found @ http://www.packetstormsecurity.org/Crackers/wordlists/"
    parser = OptionParser(usage=usage)

    try:
        parser.add_option(
            "-t",
            "--tld",
            action="store",
            type="string",
            dest="tld",
            help=
            "--tld com/net/org/biz/edu/info - Search for these TLD's (Only use one of these tlds for each whois search"
        )
        #parser.add_option("-s", "--single", action="store_true", dest="single", help="Single domain search")
        #       parser.add_option("-a", "--advance", action="store_true", dest="advance", help="Advanced domain search")
        parser.add_option("-i",
                          "--file-in",
                          dest="filein",
                          type="string",
                          help="File to read from")
        parser.add_option("-o",
                          "--file-out",
                          dest="fileout",
                          type="string",
                          help="File to write to (csv format)")
        #        parser.add_option("--sql", action="store_true", dest="sql", help="Connect to a MySQL database")

        parser.add_option("-d",
                          action="store_true",
                          dest="dead",
                          help="Only display dead domains")
        parser.add_option("-v",
                          action="store_true",
                          dest="debug",
                          help="Verbose output")
        parser.add_option("-z",
                          "--sleep",
                          dest="sleep",
                          type="float",
                          default=0,
                          help="Time to sleep between queries")

        #         parser.add_option("--host", dest="host", type="string", help="Host address for MySQL database connection (Default 127.0.0.1)")
        #         parser.add_option("--port", dest="port", type="int", help="Port to use for MySQL database connection (Default 3306)")
        #         parser.add_option("--user", dest="user", type="string", help="User to use for MySQL database connection")
        #         parser.add_option("-p", "--passwd", action='store_true', dest="passwd",  help="Prompt for a password to use with MySQL database connection")
        #         parser.add_option("--database", dest="database", type="string", help="Database to use for MySQL database query")
        #         parser.add_option("--table", dest="table", type="string", help="Table to use for MySQL database query")
        #         parser.add_option("--column", dest="column", type="string", help="Column to use for MySQL database query")
        #        parser.add_option("-g", "--gui", action="store_true", dest="gui", help="Start GUI Interface")

        (options, args) = parser.parse_args()

        if len(sys.argv) == 1:
            print(usage)
            sys.exit()

        search = WhoisSearch(debug=options.debug)

        #search.debug = options.debug
        search.deadonly = options.dead
        search.sleep = options.sleep

        if len(args) == 1:
            search.dname = args[0]
            search.whois_search()
            print(search.response())


#         if len(sys.argv) == 1 or options.gui == True:
#             window = StartGUI()
#             window.main()

#         if options.single == True:
#             search = WhoisSearch(dname=sys.argv[2]).whois_search()
#             print(search)

        else:
            #             if options.sql == True:
            #                 options.filein = options.fileout + ".tmp"
            #                 if options.passwd == True:
            #                     options.passwd = getpass.getpass()
            #                 conn = WhoisServer()
            #                 DBConnection().connection(options.user, options.passwd, options.host, options.port, options.database, options.table, \
            #                                         options.column, options.filein)

            search.tld = options.tld
            search.wordlist = options.filein
            #w = WhoisSearch(tld=options.tld,wordlist=options.filein,deadonly=options.dead,debug=options.debug)

            #w.sleep = options.sleep

            cl = CLDisplay()

            #if options.advance == True:
            #    multi_search = w.deeper_search()
            #else:
            multi_search = search.whois_multi_search()

            for i in multi_search:
                if options.fileout:
                    file_output = cl.file_format_output(i)
                    write_to_file = open(options.fileout,
                                         'a').write(file_output + "\n")
                    #write_to_file.close()
                #cl_txt = cl.format_this(i,30)
                print(cl.format_output(i))

    except IOError as (errno, strerror):
        print("\nI/O error({0}): {1}".format(errno, strerror) + "\n")
        print(parser.get_usage())
        sys.exit()
Beispiel #6
0
def main():
    usage = "usage: %prog [options] -i [file-to-read-from] -o [file-to-write-too]\n \n Examples:\n mwhois -t net -i /tmp/wordlist -o /tmp/domains\n mwhois sourceforge.net\n mwhois --gui \n\nWordlists Found @ http://www.packetstormsecurity.org/Crackers/wordlists/"
    parser = OptionParser(usage=usage)

    try:
        parser.add_option("-t", "--tld", action="store", type="string", dest="tld",
                          help="--tld com/net/org/biz/edu/info - Search for these TLD's (Only use one of these tlds for each whois search")
        #parser.add_option("-s", "--single", action="store_true", dest="single", help="Single domain search")
 #       parser.add_option("-a", "--advance", action="store_true", dest="advance", help="Advanced domain search")
        parser.add_option("-i", "--file-in", dest="filein",  type="string", help="File to read from")
        parser.add_option("-o", "--file-out", dest="fileout", type="string",  help="File to write to (csv format)")
#        parser.add_option("--sql", action="store_true", dest="sql", help="Connect to a MySQL database")
        
        parser.add_option("-d", action="store_true", dest="dead", help="Only display dead domains")
        parser.add_option("-v", action="store_true", dest="debug", help="Verbose output")
        parser.add_option("-z","--sleep", dest="sleep", type="float", default=0, help="Time to sleep between queries")
        
#         parser.add_option("--host", dest="host", type="string", help="Host address for MySQL database connection (Default 127.0.0.1)")
#         parser.add_option("--port", dest="port", type="int", help="Port to use for MySQL database connection (Default 3306)")
#         parser.add_option("--user", dest="user", type="string", help="User to use for MySQL database connection")
#         parser.add_option("-p", "--passwd", action='store_true', dest="passwd",  help="Prompt for a password to use with MySQL database connection")
#         parser.add_option("--database", dest="database", type="string", help="Database to use for MySQL database query")
#         parser.add_option("--table", dest="table", type="string", help="Table to use for MySQL database query")
#         parser.add_option("--column", dest="column", type="string", help="Column to use for MySQL database query")
#        parser.add_option("-g", "--gui", action="store_true", dest="gui", help="Start GUI Interface")

        (options, args) = parser.parse_args()
        
        if len(sys.argv) == 1:
            print(usage)
            sys.exit()
        
        
        search = WhoisSearch(debug=options.debug)
        
        #search.debug = options.debug
        search.deadonly = options.dead
        search.sleep = options.sleep
        
        if len(args) == 1:
            search.dname = args[0]
            search.whois_search()
            print(search.response())
            
#         if len(sys.argv) == 1 or options.gui == True:
#             window = StartGUI()
#             window.main()
        
#         if options.single == True:
#             search = WhoisSearch(dname=sys.argv[2]).whois_search()
#             print(search)
           
        else:
#             if options.sql == True:
#                 options.filein = options.fileout + ".tmp"
#                 if options.passwd == True:
#                     options.passwd = getpass.getpass()
#                 conn = WhoisServer()
#                 DBConnection().connection(options.user, options.passwd, options.host, options.port, options.database, options.table, \
#                                         options.column, options.filein)
            
            
            search.tld = options.tld
            search.wordlist = options.filein
            #w = WhoisSearch(tld=options.tld,wordlist=options.filein,deadonly=options.dead,debug=options.debug)
            
            #w.sleep = options.sleep
            
            cl = CLDisplay()
            
            #if options.advance == True:
            #    multi_search = w.deeper_search()
            #else:
            multi_search = search.whois_multi_search()
            
            for i in multi_search:
                if options.fileout:
                    file_output = cl.file_format_output(i)
                    write_to_file = open(options.fileout, 'a').write(file_output+"\n")
                    #write_to_file.close()
                #cl_txt = cl.format_this(i,30)
                print(cl.format_output(i))

    except IOError as (errno, strerror):
        print("\nI/O error({0}): {1}".format(errno, strerror) +"\n")
        print(parser.get_usage())
        sys.exit()
Beispiel #7
0
    def run(self):

        if self.type == CONST.SINGLE_TYPE:
            search = WhoisSearch()
            search.dname = self.data
            search.whois_search()
            self.obj.SetValue(search.response())

        else:
            self.tld = self.data[0]
            self.wordlist = self.data[1]
            self.domainlist = self.data[2]

            mwhois = WhoisSearch(None, self.tld, self.wordlist,
                                 self.domainlist, self.obj)
            if self.type == CONST.BASIC_TYPE:
                mwhois.whois_multi_search()
            else:
                mwhois.advance_search()