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()
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())
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()