-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind_entry.py
65 lines (56 loc) · 1.87 KB
/
find_entry.py
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
62
63
64
65
from pykeepass import PyKeePass
kp4_pass = "pass"
kp4 = PyKeePass("keepass_v4_test.kdbx", password=kp4_pass)
kp3_pass = "pass"
kp3 = PyKeePass("keepass_v4_test.kdbx", password=kp3_pass)
kp = kp4
divider = "\n" + "#" * 50 + "\n"
find_group = "Group1"
find_group2 = "Group2"
find_group_entry = "Entry1.1"
find_entry = "Entry3.1.1"
find_common_entry = "common_entry"
print("find Group")
all_group = kp.find_groups(name=find_group)
first_group = kp.find_groups(name=find_group, first=True)
first_group_by_name = kp.find_groups_by_name(group_name=find_group, first=True)
print(all_group)
print(first_group)
print(first_group_by_name)
print(divider)
print("find Entry in Group")
all_group_entry = kp.find_entries(group=first_group, title=find_group_entry)
first_group_entry = kp.find_entries(
group=first_group, title=find_group_entry, first=True
)
group_entry_by_title = kp.find_entries_by_title(
group=first_group, title=find_group_entry, first=True
)
print(all_group_entry)
print(first_group_entry)
print(group_entry_by_title)
print(divider)
print("find Entry")
all_entry = kp.find_entries(title=find_entry)
first_entry = kp.find_entries(title=find_entry, first=True)
entry_by_title = kp.find_entries_by_title(title=find_entry, first=True)
print(all_entry)
print(first_entry)
print(entry_by_title)
print(divider)
print("find Common Entry")
all_common_entry = kp.find_entries(title=find_common_entry)
first_common_entry = kp.find_entries(title=find_common_entry, first=True)
print(all_common_entry)
print(first_common_entry)
print(divider)
print("find Common Entry by Group")
group2 = kp.find_groups(name=find_group2, first=True)
all_common_entry_by_group = kp.find_entries(
title=find_common_entry, group=first_group
)
first_common_entry_by_group = kp.find_entries(
title=find_common_entry, group=first_group, first=True
)
print(all_common_entry_by_group)
print(first_common_entry_by_group)