def select_fn(self, fn=False): ''' Select a file using the PyQt5 file dialog. fn : the filename. It is given when choosing with the combo box. ''' if fn == False: fn = QFileDialog.getOpenFileName(self, tr('Open file'), getcwd())[0] if fn in ((), ''): #cancel fn = tr('-- Select a file --') self.fn = fn self.rb_txt.setChecked(True) self.rb_fn.setChecked(False) return None self.fn = fn f = fn.split('/')[-1] if f not in self.lst_f: if len(self.lst_f_hist) == 0: self.opt_fn.insertSeparator(10000) if fn not in self.lst_f_hist: self.lst_f_hist.append(fn) self.opt_fn.addItem(fn) self.opt_fn.setCurrentText(fn) else: self.opt_fn.setCurrentText(f)
def pwd_entro(H=None, N=None, L=None): ''' Return the unknown value. One and only one of the 3 variables should be None. H : entropy of the password ; N : alphabet's lenth ; L : password's lenth. ''' a = None if (H == a and N == a) or (H == a and L == a) or (N == a and L == a) or ( H == a and N == a and L == a): return '\n' + tr('Only one var should be None !!!') elif H == a: return log2(N**L) elif L == a: return round(H / log2(N)) elif N == a: return round(2**(H / L)) else: return '\n' + tr('At least 1 var should be None !!!')
def __init__(self, fn, binary=True, encod='utf-8', interface=None): '''Initiate the object. .fn : the worslist's name ; .binary : Should be a boolean. Correspond to the binary mode while opening ; .encod : the encoding. Default is 'utf-8' ; .interface : the interface using this function. Should be None, 'gui', or 'console'. Used to choose the progress bar. ''' if binary not in (True, False): raise ValueError( tr('The argument "binary" should be a boolean, but "{}" of type "{}" was found !!!' ).format(binary, type(binary))) if interface not in (None, 'gui', 'console'): raise ValueError( tr('The argument "interface" should be None, "gui", or "console", but {} of type {} was found !!!' ).format(interface, type(interface))) self.fn = fn self.binary = binary self.interface = interface if binary: self.encod = None else: self.encod = encod validity = self.is_valid_file() if validity in (-1, -2): return validity
def pollard_pm1(n: int) -> (bool, list): """Find a prime factor of n with the pollard's p - 1 algorithm.""" if type(n) is not int: raise TypeError(tr('n has to be an integer')) if n < 0: raise ValueError(tr('n cannot be negative')) if n == 0 or n == 1: return False, n if n == 2: return True, 2 if n % 2 == 0: return False, 2 B = int(n**(1 / 6)) + 1 P = segmentation_erathostenes_sieve(B) s = 1 for k in P: s = s * k**int(math.log(B, k)) % n x = math.gcd(pow(2, s, n) - 1, n) if x == n: return True, n elif x == 1: k = B + 1 while x == 1: s = s * k % n x = math.gcd(pow(2, s, n) - 1, n) k = k + 1 return False, x
def decrypt(self, pwd): ''' Decrypt 'self.k_name' with AES-256-CBC using the password `pwd` (Hasher('sha256').hash(clear_pwd)), make a file 'self.k_name' + ext and remove encrypted one. - pwd : the password. ''' fn = self.get_fn('pvk') if fn[-4:] != '.enc': raise KeyError(tr('The RSA key is not encrypted !')) old_path = chd_rsa(glb.home) with open(fn, 'r') as f: f_content = f.read() try: f_dec = AES(256, pwd, hexa=True).decryptText(f_content, mode_c='hexa') except UnicodeDecodeError: msg = tr('This is not the good password !') if self.interface == 'gui': QMessageBox.critical(None, '!!! Wrong password !!!', '<h2>{}</h2>'.format(msg)) elif self.interface == 'console': cl_out(c_error, msg) else: print('Cracker: RsaKeys: decrypt: ' + msg) chdir(old_path) return -3 except ValueError: msg = tr('The file is not well formatted !') if self.interface == 'gui': QMessageBox.critical(None, '!!! File error !!!', '<h2>{}</h2>'.format(msg)) elif self.interface == 'console': cl_out(c_error, msg) else: print('Cracker: RsaKeys: decrypt: ' + msg) chdir(old_path) return -2 with open(fn[:-4], 'w') as f: f.write(f_dec) remove(fn) chdir(old_path)
def clear(self): '''Clear the text widget.''' if self.txt.toPlainText() != '': sure = QMessageBox.question(self, tr('Sure') + ' ?', '<h2>' + tr('Are you sure ?') + '</h2>', \ QMessageBox.Yes | QMessageBox.Cancel, QMessageBox.Yes) if sure != QMessageBox.Yes: return None self.txt.clear()
def c_use(c_use, c_old): while True: c_in = cl_inp( tr('Enter new color of') + " " + c_use + " " + tr('(0 to keep the color)') + ' :') if c_in in ('0', ''): return c_old elif color(c_in): cl_out(c_error, tr('The color was NOT founded') + ' !') else: return str(c_in)
def use(): color(c_prog) print('\n' + tr('Enter the password to test :')) color(c_input) word = getpass('>') color(c_prog) print(get_sth(word)) color(c_input) input(tr('---End---')) color(c_prog)
def use_open_w(): #todo: move (in the console file) and improve this try: file_name = cl_inp(tr("Enter the wordlist's name :")) wordlist_f = open(file_name, 'r') except FileNotFoundError: cl_out(c_error, tr('No file of this name !!!') + ' \n' + tr('Back menu ...')) else: wordlist_f.close() open_w(file_name)
def show_time(self, time): '''Show the time, according to the self.interface arg.''' msg = tr('Done in {} s !').format(time) if self.interface == None: print(msg) elif self.interface == 'console': cl_out(c_succes, msg) else: QMessageBox.about(None, tr('Done !'), msg)
def wheel_factorization(n: int, base=(2, 3, 5, 7)) -> (bool, list): """Improvement of trial division : the incrementation isn't 2 anymore, it varies according to the base of prime factors. Site : https://en.wikipedia.org/wiki/Wheel_factorization """ if type(n) is not int: raise TypeError(tr('n has to be an integer')) if n < 0: raise ValueError(tr('n cannot be negative')) # Generating of inc inc = [] # inc is the list of steps size = 1 # We calculate the sum of every numbers of inc for i in base: size = size * i L = [x for x in range(base[-1] + 1, size + base[-1] + 1)] for i in base: j = 0 while j < len(L): if L[j] % i == 0: del L[ j] # We delete all the numbers which are not coprimes with the base else: j = j + 1 for i in range(j - 1): # j is the length of the list inc.append(L[i + 1] - L[i]) # Every differences constistue a step inc.append(size + L[0] - L[-1]) # We add the last step l_inc = len(inc) # Divisions factors = [] for i in base: while n > i and n % i == 0: factors.append(i) n = n // i d = L[0] s = math.sqrt(n) index = 0 # index of the list of steps inc while n > 1 and d <= s: while n % d == 0: factors.append(d) n = n // d s = math.sqrt(n) d = d + inc[index] index = index + 1 if index == l_inc: index = 0 if n > 1: factors.append(n) return (len(factors) == 1, factors)
def __init__(self, parent=None): '''Create the GUI to ask password.''' #------ini super().__init__(parent) self.setWindowTitle(tr('RSA key password') + ' — KRIS') self.setWindowIcon(QIcon('Style/KRIS_logo_by_surang.ico')) #------widgets #---main widget # self.main_wid = QWidget() # self.setCentralWidget(self.main_wid) main_lay = QGridLayout() # self.main_wid.setLayout(main_lay) self.setLayout(main_lay) #---label main_lay.addWidget(QLabel(tr('RSA key password :'******'t need to press the button : press <enter> main_lay.addWidget(self.pwd, 0, 1) #---check box self.inp_show = QCheckBox(tr('Show password')) self.inp_show.toggled.connect(self._show_pwd) main_lay.addWidget(self.inp_show, 1, 0, 1, 2, alignment=Qt.AlignCenter | Qt.AlignTop) #---button self.bt_get = QPushButton('>') self.bt_get.setMaximumSize(QSize(40, 50)) self.bt_get.clicked.connect(self.send) main_lay.addWidget(self.bt_get, 0, 2) self.the_pwd = None
def encrypt(self, pwd): ''' Encrypt 'self.k_name' with AES-256-CBC using the password `pwd` (Hasher('sha256').hash(clear_pwd)), make a file 'self.k_name' + ext + '.enc' and remove clear one. - pwd : the password. ''' fn = self.get_fn('pvk') if fn[-4:] == '.enc': raise KeyError(tr('The RSA key is already encrypted !')) old_path = chd_rsa(glb.home) with open(fn, 'r') as f: f_content = f.read() f_enc = AES(256, pwd, hexa=True).encryptText(f_content, mode_c='hexa') with open(fn + '.enc', 'w') as f: f.write(f_enc) remove(fn) chdir(old_path)
def inp_lst(prompt, lst): '''Works like input but accepts only values in the list lst, reask if not.''' c = '' c = cl_inp(prompt) while c not in lst: cl_out(c_error, '\n' + tr('What you entered is NOT in list') + ' !') c = cl_inp(prompt) return c
def is_valid_file(self): '''Check if the file is reachable with the options. .Return : -1 if the file was not found ; -2 if an encoding error occur. ''' try: md = ('r', 'rb')[self.binary] with open(self.fn, mode=md, encoding=self.encod) as f: char_1 = f.read(1) if self.binary: char_1 = char_1.decode() except FileNotFoundError: ret = -1 except UnicodeDecodeError: ret = -2 else: ret = 0 if ret == -1: msg_err = tr('The file "{}" was NOT found !!!').format(self.fn) elif ret == -2: msg_err = tr('Bad encoding "{}" for the file "{}"').format( self.encod, self.fn) if ret in (-1, -2): if self.interface == None: raise FileNotFoundError(msg_err) elif self.interface == 'console': cl_out(c_error, msg_err) elif self.interface == 'gui': QMessageBox.critical(None, tr('!!! File error !!!'), msg_err) return ret
def check(self): '''Check if the typed password is the good.''' global locked locked = True hshed_entry = self.Hasher(self.pwd.text()) self.nb_try += 1 if hshed_entry == self.pwd_hshed: locked = False self.RSA_keys_pwd = Hasher('sha256').hash(self.pwd.text())[:32] self.unlock_func() self.close() elif self.nb_try < self.mx: self.pwd.setText('') if self.mx - self.nb_try > 1: self.lb_wrong.setText( str(self.mx - self.nb_try) + " " + tr('remaining attempts')) else: self.lb_wrong.setText(tr('Last attempt')) if self.mx - self.nb_try == 2: self.lb_wrong.setStyleSheet('color: #ff0') sleep(0.3) elif self.mx - self.nb_try == 1: self.lb_wrong.setStyleSheet('color: #f00') sleep(1) locked = True else: sleep(1.3) QMessageBox.critical(QWidget(), tr('Wrong password')+ ' !', \ '<h1>' + tr('Wrong password') + ' !!!</h1>\n' + tr('It was your last attempt') + ' !!!') sys.exit()
def wlth(word): '''Return the sort list of all differents word's characters, in one occurence.''' if type(word) != str: raise ValueError( tr('"word" argument should be a string, but "{}", of type "{}" was found !' ).format(word, type(word))) ret = list(set(word)) ret.sort() return ret
def select_fn_rb(self): ''' Activated when pressing the radio button "plain file". If no file is selected, launch select_fn. ''' if self.opt_fn.currentText() == tr('-- Select a file --'): self.select_fn() self.rb_bytes.setChecked(True) self.check_bytes()
def parser_use(n, pb=False): """Use prima functions with the parser console mode. Lasercata""" if not pb: p, L = trial_division(n) else: p = fermat2(n) if p and pb: return str(n) + ' ' + tr('is likely a prime number') elif p: return str(n) + ' ' + tr('is a prime number') elif pb: return str(n) + ' ' + tr('is a composite number') else: return str(n) + ' ' + tr('is a composite number') + '\n' + tr( 'List of prime factors : ') + str(L)
def err_not_well_formated(): msg = tr('The file is not well formatted !') if self.interface == 'gui': QMessageBox.critical(None, '!!! File error !!!', '<h2>{}</h2>'.format(msg)) elif self.interface == 'console': cl_out(c_error, msg) else: print('Cracker: RsaKeys: read: ' + msg) return -2
def read_file(self, fn, bytes_md=False, encod='utf-8', silent=True): ''' Read the content of a file and return its content in a string. fn : filename ; bytes_md : the bytes mode. Should be False for text (default) or True for binary (bytes) ; encod : the encoding. Should be "utf-8", "latin-1", "ascii". Default is "utf-8" ; silent : should be a bool. If False, show error message box in case if one occur. return -1 if the file "fn" was not found, -2 if an encoding error occur, the text otherwise. ''' if bytes_md not in (True, False): return 'The bytes_md should be "True" or "False", but "' + str( bytes_md) + '" was found !!!' try: if not bytes_md: #text with open(fn, mode='r', encoding=encod) as file: txt = file.read() else: with open(fn, mode='rb') as file: txt = file.read() except FileNotFoundError: if not silent: QMessageBox.critical(QWidget(), '!!! ' + tr('File error') + ' !!!', \ '<h2>' + tr('The file') + ' "' + str(fn) + '"' + tr(' was NOT found') + ' !!!</h2>') return -1 except UnicodeDecodeError: if not silent: QMessageBox.critical(QWidget(), '!!! ' + tr('Encoding error') + ' !!!', \ '<h2>' + tr('The file can\'t be decoded with this encoding') + ' !!!</h2>') return -2 return txt
def reload(self): ''' Function which reload the files combo boxes. It can be used if a new file was copied while running, for example. ''' self.lst_f = (tr('-- Select a file --'), *list_files(), *self.lst_f_hist) self.opt_fn.clear() self.opt_fn.addItems((tr('-- Select a file --'), *list_files())) self.opt_fn.insertSeparator(1) self.opt_fn.insertSeparator(10000) if len(self.lst_f_hist) > 0: self.opt_fn.addItems(self.lst_f_hist) self.opt_fn.insertSeparator(20000) if self.fn not in self.lst_f: self.fn = tr('-- Select a file --') self.opt_fn.setCurrentText(tr('-- Select a file --')) else: self.opt_fn.setCurrentText(self.fn)
def fermat(n: int) -> int: """Return a non trivial factor of n or 1 if he is prime or equals to 1.""" if n == 0: raise ValueError(tr('0 is not factorizable')) if n == 2: return 1 x = int(math.sqrt(n)) y = 0.5 while int(y) != y: x = x + 1 y = x**2 % n y = math.sqrt(y) return math.gcd(x - int(y), n)
def trial_division(n: int) -> (bool, list): """Decompose the integer n as a product of prime factors by trial division method. Here, the divisors are tested until sqrt(n) and only 2 and odd numbers are tested.""" if type(n) is not int: raise TypeError(tr('n has to be an integer')) if n < 0: raise ValueError(tr('n cannot be negative')) factors = [] while n > 2 and n % 2 == 0: factors.append(2) n = n // 2 d = 3 s = math.sqrt(n) while n > 1 and d <= s: while n % d == 0: factors.append(d) n = n // d s = math.sqrt(n) d = d + 2 if n > 1: factors.append(n) return (len(factors) == 1, factors)
def color(choice_color): '''Changes the color ; Return False if there was no error ; Return True if choice_color is not in dct_col (if an error occur).''' global dct_col try: col(dct_col[choice_color]) except KeyError: print(tr('The input is not a color') + ' !!!') return True else: return False
def setText(self, txt): '''Fill the text widget or the file with txt, according to the radiobuttons.''' txt_t = self.txt.toPlainText() if self.opt_fn.currentText() != tr('-- Select a file --'): txt_f = self.read_file(self.opt_fn.currentText(), \ self.rb_bytes.isChecked(), self.opt_encod.currentText()) else: txt_f = None if self.rb_txt.isChecked(): # The text widget is chosen if txt_t != '' and txt_f == '': rep = QMessageBox.question(self, '!!! ' + tr('Text is not empty') + ' !!!', \ '<h2>' + tr('The text widget is not empty, but the file is') + '.</h2>\n<h3>' + tr('Write the file (Yes) or overwrite text (Ignore) ?') + '</h3>', \ QMessageBox.Yes | QMessageBox.Ignore | QMessageBox.Cancel, QMessageBox.Ignore) if rep == QMessageBox.Yes: self.save_fn(txt) elif rep == QMessageBox.Ignore: self.txt.setPlainText(txt) else: return -3 # Abort else: self.txt.setPlainText(txt) else: # The file is chosen if txt_f == -1: rep = QMessageBox.question(self, '!!! ' + tr('File error') + ' !!!', \ '<h2>' + tr('The file') + ' "' + str(fn) + '" ' + tr('was NOT found') + ' !!!</h2>\n<h3>' + tr('Write in the text widget ?') + '</h3>', \ QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) if rep == QMessageBox.Yes: self.txt.setPlainText(txt) else: return -1 else: self.save_fn(txt)
def ana(self, print_verbose=False): ''' Function which analyse a wordlist. .self.fn : the worslist's name ; .self.binary : Should be a boolean. Correspond to the binary mode while opening ; .self.encod : the encoding. Default is 'utf-8' ; .self.interface : the interface using this function. Should be None, 'gui', or 'console'. Used to choose the progress bar ; .print_verbose : if True, print 'Processing ...' when activated. .Return : (size_b, size_d), (mtime, atime, ctime), infos ; where 'infos' is a dict containing some informations ''' if self.interface == 'gui': pb = GuiProgressBar(title=tr('Reading "{}" ... ― Cracker').format( self.fn), verbose=True, mn=1) elif self.interface == 'console': pb = ConsoleProgressBar() lib_C = True try: if platform.system() == 'Windows': dll_fn = 'wordlist_analyzer_win.dll' else: dll_fn = 'wordlist_analyzer_unix.dll' lib = ctypes.cdll.LoadLibrary( '{}/modules/wordlists/library/{}'.format(os.getcwd(), dll_fn)) f_ana = lib.analyzeWordlist f_ana.argtypes = (ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int) f_ana.restype = ctypes.POINTER(ctypes.c_ulonglong) if self.encod == 'utf-8': encoding = 1 else: encoding = 0 L = f_ana( os.path.abspath(self.fn).encode('ascii'), "\n".encode('ascii'), encoding) if L[0] != 0: if L[0] == 1: # File not found return -1 else: return -3 # Other error, access denied for example D = {} D["Size in octets"] = L[2] D["Number of characters"] = L[3] D["Number of different characters (without separators)"] = L[4] D["Code point minimum"] = L[5] D["Code point maximum"] = L[6] D["Number of words"] = L[7] D["Minimum length"] = L[8] D["Maximum length"] = L[9] D["Average length"] = L[10] / 1000 if L[11] != 2**64 - 1: D["Median length"] = L[11] / 10 else: D["Median length"] = 'Not calculated' except: lib_C = False md = ('r', 'rb')[self.binary] dct_occ = {} mn = 10**6 mx = 0 i = 0 if print_verbose: print(tr('Processing ...')) t0 = dt.now() f_info = FileInfo(self.fn) size_d = f_info.h_size(bi=False) #KB, MB, ... size_b = f_info.h_size() #KiB, MiB, ... mtime = f_info.h_dates('m') atime = f_info.h_dates('a') ctime = f_info.h_dates('c') if not lib_C: nb_lines = self.count_lines() with open(self.fn, mode=md, encoding=self.encod) as f: for j, line in enumerate(f): if self.binary: line = line.decode(errors='ignore') line = line.strip('\r\n') #------number of lines i += 1 #------occ for char in line: try: dct_occ[char] += 1 except KeyError: dct_occ[char] = 1 #------min if len(line) < mn: mn = len(line) #------max if len(line) > mx: mx = len(line) #------progress bar if j % 2**10 == 0: if self.interface in ('gui', 'console'): pb.set(i, nb_lines) lst_alf = walf(list(dct_occ.keys())) nb_occ = len(list(dct_occ.keys())) else: mn = D["Minimum length"] mx = D["Maximum length"] nb_lines = D["Number of words"] for k in range(268 + D["Code point minimum"], 268 + D["Code point maximum"] + 1): if L[k] != 0: dct_occ[chr(k - 268)] = L[k] lst_alf = walf(list(dct_occ.keys())) nb_occ = D["Number of different characters (without separators)"] if mx > 254: mx2 = 254 else: mx2 = mx W = {} for k in range(12 + mn, 12 + mx2 + 1): if L[k] != 0: W[k - 12] = L[k] if L[267] != 0: W['>254'] = L[267] t_end = dt.now() self.show_time(t_end - t0) self.nb_lines = nb_lines #for the show_lines function #-sort the dct_occ : old_dct_occ = dct_occ dct_occ = {} for k in sorted(old_dct_occ): dct_occ[k] = old_dct_occ[k] infos = { 'dct_occ': dct_occ, #Counted occurences (dict) ; 'lst_alf': lst_alf[1], #Tuple of the alphabets ; 'alf_lth': lst_alf[0], #Length of the alphabets ; 'nb_occ': nb_occ, #Number of differents characters ; 'nb_lines': nb_lines, #Number of lines ; 'min': mn, #Smaller line length ; 'max': mx #Longer line length. } infosLibC = {} if lib_C: infosLibC = { 'nb_car': D["Number of characters"], 'av_len': D["Average length"], 'med_len': D["Median length"], 'dct_len_w': W #Repartition of word length } ret = (size_b, size_d), (mtime, atime, ctime), infos, (lib_C, infosLibC) self.analysis = ret return ret
color__last_update = '11.11.2020' color__version = '2.3' ##-import import ctypes import platform from Languages.lang import translate as tr if platform.system() == 'Windows': handle = ctypes.windll.kernel32.GetStdHandle(-11) col = lambda x: ctypes.windll.kernel32.SetConsoleTextAttribute(handle, x) dct_col = { tr('invisible'): 0, tr('orange'): 1, tr('blue'): 9, tr('green'): 10, tr('light_blue'): 11, tr('red'): 12, tr('pink'): 13, tr('yellow'): 14, tr('white'): 15 } elif platform.system() == 'Linux': col = lambda x: print('\033[' + str(x) + 'm', end='') dct_col = { tr('none'): 0,
def __str__(self): '''Return the analysis in a readable string.''' try: ana = self.analysis #don't analyse again if already done except AttributeError: ana = self.ana() if ana == -1: msg_err = tr('The file "{}" was NOT found !!!').format(self.fn) elif ana == -2: msg_err = tr('Bad encoding "{}" for the file "{}"').format( self.encod, self.fn) if ana in (-1, -2, -3): if self.interface == None: raise FileNotFoundError(msg_err) elif self.interface == 'console': cl_out(c_error, msg_err) return ana elif self.interface == 'gui': QMessageBox.critical(None, tr('!!! File error !!!'), msg_err) return ana sizes = ana[0] times = ana[1] infos = ana[2] lib_C = ana[3][0] infosLibC = ana[3][1] ret = tr('Filename : {} ;').format(self.fn) ret += '\n\n' + tr('Size : {} ({}) ;').format(*sizes) ret += '\n\n' + tr('Last modification : {} ;').format(times[0]) ret += '\n' + tr('Last access : {} ;').format(times[1]) ret += '\n' + tr('Creation : {} ;').format(times[2]) if lib_C: ret += '\n\n' + tr('Number of characters : {} ;').format( infosLibC['nb_car']) ret += '\n\n' + tr('Minimum line length : {} characters ;').format( infos['min']) ret += '\n' + tr('Maximum line length : {} characters ;').format( infos['max']) if lib_C: ret += '\n' + tr('Average line length : {} characters ;').format( infosLibC['av_len']) ret += '\n' + tr('Median line length : {} characters ;').format( infosLibC['med_len']) ret += '\n' + tr("Wordlist's length : {} lines ;").format( space_b(infos['nb_lines'])) if lib_C: ret += '\n' + tr('Wordlength repartition :') for k in infosLibC['dct_len_w']: ret += "\n\t'{}': {} ;".format( k, space_b(infosLibC['dct_len_w'][k])) ret += '\n\n' + tr('Length of the alphabet : {} characters ;').format( infos['alf_lth']) ret += '\n' + tr('Alphabets : {} ;').format( set_prompt(infos['lst_alf'])) ret += '\n\n' + tr('Number of differents characters : {} ;').format( infos['nb_occ']) ret += '\n' + tr("Characters' repartition :") for k in infos['dct_occ']: ret += "\n\t'{}': {} ;".format(k, space_b(infos['dct_occ'][k])) ret = ret[:-2] + '.' #replace ' ;' by '.' at the last line. return ret
def c_color(): global c_prog global c_input global c_output global c_error global c_wrdlt global c_succes global c_ascii c_lst = [c_prog, c_input, c_output, c_error, c_wrdlt, c_succes, c_ascii] c_lst_prnt = (tr('program'), tr('input'), tr('output'), tr('error'), tr('wordlist'), tr('succes'), tr('ascii art')) print('\n' + tr('Current colors') + ' :\n') color(c_prog) print(' ' + tr('Program color') + ' :', c_prog) color(c_input) print(' ' + tr('Input color') + ' :', c_input) color(c_output) print(' ' + tr('Output color') + ' :', c_output) color(c_error) print(' ' + tr('Error color') + ' :', c_error) color(c_wrdlt) print(' ' + tr('Wordlists color') + ' :', c_wrdlt) color(c_succes) print(' ' + tr('Succes color') + ' :', c_succes) color(c_ascii) print(' ' + tr('Ascii art color') + ' :', c_ascii) color(c_prog) c = inp_lst( tr('Change colors ?') + " " + tr('(y/n)') + ' :', (tr('y'), tr('n'))) if c == tr('y'): ch = inp_lst( tr('Restore default program colors (1) or change colors one by one (2) ?' ) + ' :', ('1', '2')) if ch == '1': c_prog = tr('light_blue') c_input = tr('green') c_output = tr('yellow') c_error = tr('red') c_wrdlt = tr('pink') c_succes = tr('green') c_ascii = tr('orange') cl_out(c_succes, tr('Done') + ' !\n' + tr('Back menu') + ' ...') else: for k in range(len(c_lst)): c_lst[k] = c_use(c_lst_prnt[k], c_lst[k]) c_prog = c_lst[0] c_input = c_lst[1] c_output = c_lst[2] c_error = c_lst[3] c_wrdlt = c_lst[4] c_succes = c_lst[5] c_ascii = c_lst[6] else: print('\nBack menu ...')