|
8 | 8 | from termcolor import colored, cprint
|
9 | 9 | except ImportError:
|
10 | 10 | try:
|
11 |
| - os.system('pip3 install termcolor') |
| 11 | + os.system("pip3 install termcolor") |
12 | 12 | except Exception:
|
13 |
| - os.system('python3 -m pip install termcolor') |
| 13 | + os.system("python3 -m pip install termcolor") |
14 | 14 |
|
15 |
| -if not (os.path.isdir('log')): |
16 |
| - os.mkdir('log') |
17 |
| -logging.basicConfig(filename='log/wa_kdbe.log', level=logging.DEBUG, format='') |
| 15 | +if not (os.path.isdir("log")): |
| 16 | + os.mkdir("log") |
| 17 | +logging.basicConfig(filename="log/wa_kdbe.log", level=logging.DEBUG, format="") |
18 | 18 | masked = []
|
19 | 19 |
|
20 | 20 |
|
21 |
| -def custom_input(text_to_input, color='green', attr=[], is_get_time=True, is_log=True): |
22 |
| - time = get_time() if is_get_time else '' |
23 |
| - data = input(colored(f'{time}{text_to_input}', color, attrs=attr)) |
24 |
| - if(is_log): |
25 |
| - logging.debug(f'{time}{text_to_input}{data}') |
| 21 | +def custom_input(text_to_input, color="green", attr=[], is_get_time=True, is_log=True): |
| 22 | + time = get_time() if is_get_time else "" |
| 23 | + data = input(colored(f"{time}{text_to_input}", color, attrs=attr)) |
| 24 | + if is_log: |
| 25 | + logging.debug(f"{time}{text_to_input}{data}") |
26 | 26 | else:
|
27 |
| - logging.debug(f'{time}{text_to_input}********') |
| 27 | + logging.debug(f"{time}{text_to_input}********") |
28 | 28 | # Add that password in list, and mask that while printing also.
|
29 | 29 | masked.append(data)
|
30 | 30 | return data
|
31 | 31 |
|
32 | 32 |
|
33 |
| -def custom_print(text_to_print, color='green', attr=[], is_get_time=True, is_log=True, is_print=True, end='\n'): |
34 |
| - time = get_time() if is_get_time else '' |
| 33 | +def custom_print( |
| 34 | + text_to_print, |
| 35 | + color="green", |
| 36 | + attr=[], |
| 37 | + is_get_time=True, |
| 38 | + is_log=True, |
| 39 | + is_print=True, |
| 40 | + end="\n", |
| 41 | +): |
| 42 | + time = get_time() if is_get_time else "" |
35 | 43 | text_to_print = str(text_to_print)
|
36 |
| - if(is_print): |
37 |
| - cprint(f'{time}{text_to_print}', color, attrs=attr, end=end) |
| 44 | + if is_print: |
| 45 | + cprint(f"{time}{text_to_print}", color, attrs=attr, end=end) |
38 | 46 | else:
|
39 | 47 | pass
|
40 |
| - if(is_log): |
41 |
| - logging.debug(f'{time}{text_to_print}') |
| 48 | + if is_log: |
| 49 | + logging.debug(f"{time}{text_to_print}") |
42 | 50 | else:
|
43 | 51 | # Search for password and mask.
|
44 | 52 | for i in masked:
|
|
0 commit comments