-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword_migration.py
More file actions
61 lines (48 loc) · 1.64 KB
/
password_migration.py
File metadata and controls
61 lines (48 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import msvcrt
import os
def get_input(prompt):
print(prompt, end='', flush=True)
return msvcrt.getch().decode('utf-8')
def extract_data_sets(file_path, identifier):
with open(file_path, 'r') as file:
data = file.read()
data_sets = data.split(identifier)
return [data_set.strip() for data_set in data_sets if data_set.strip()]
def display_data_set(data_set):
print(data_set)
print('-' * 10)
def clear_screen():
if os.name == 'nt': # For Windows
os.system('cls')
else: # For Linux/Unix
os.system('clear')
def main():
file_path = './passwords.txt' # Replace with your file path
identifier = '-+=' # Replace with your unique identifier
data_sets = extract_data_sets(file_path, identifier)
num_data_sets = len(data_sets)
current_index = 0
while True:
clear_screen()
display_data_set(data_sets[current_index])
user_input = get_input("[N]ext, [B]ack, or [Q]uit:").lower()
clear_screen()
if user_input == 'n':
current_index += 1
if current_index >= num_data_sets:
print("No more data sets.")
current_index = num_data_sets - 1
elif user_input == 'b':
current_index -= 1
if current_index < 0:
print("Already at the first data set.")
current_index = 0
elif user_input == 'q':
print("Quitting.")
break
else:
print("Invalid input. Please try again.")
if current_index >= num_data_sets:
current_index = num_data_sets - 1
if __name__ == '__main__':
main()