def start(self): """Main method for the bruteforce crack class.""" for string in MD5Check.read_file(self.__in_file): if not self.__single: string = string.split(':') self.__result = None brute_thread = Thread(target=self._run) brute_thread._args = (string, brute_thread) brute_thread.start() brute_thread.join() if self.__result: if self.__single: string = '{}:{}'.format(string, self.__result) else: string = '{}:{}'.format(string[0], self.__result) MD5Check.write_file(self.__out_file, string, True) self.__total += 1 Utils.CC.print('%g[%Gi%g] %bHash found%G: %o{}' .format(string)) Utils.CC.print('%g[%Gi%g] %bTotal hashes found%G: %o{}' .format(self.__total)) Utils.CC.print('%g[%Gi%g] %bAll hashes written to%G: %o{}' .format(self.__out_file))
def main(tokens: set): queue = Queue() threads = [] for token in tokens: queue.put_nowait(token) for _ in range(THREADS): thread = Thread() threads.append(thread) thread._target = bound_get_diff thread._args = (queue, ) thread.start() for thread in threads: thread.join()