-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathn0vault.pydoc
243 lines (234 loc) · 10.3 KB
/
n0vault.pydoc
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
Help on package n0vault:
NAME
n0vault
DESCRIPTION
# 0.01 = 2021-03-06 = Initial version
# 0.02 = 2021-07-19 = Added functionality to enter sensitive data without easy retrieving
# 0.03 = 2021-08-04 Impossible easely adopt for 3.6, only for 3.7, because of some modules (for example: immutables)
# are not precompiled for 3.6 at pypi.org. So installing of Visual C/C++ (or MinGW) is required.
# 0.04 = 2023-02-25 = AES.MODE_CBC -> AES.MODE_GCM accoding sonarcloud.io: Use secure mode and padding scheme.
PACKAGE CONTENTS
__main__
test (package)
CLASSES
builtins.dict(builtins.object)
n0Vault
class n0Vault(builtins.dict)
| n0Vault(vault_file_name: str = None, encrypted=True, password: str = None, key=None)
|
| dict() -> new empty dictionary
| dict(mapping) -> new dictionary initialized from a mapping object's
| (key, value) pairs
| dict(iterable) -> new dictionary initialized as if via:
| d = {}
| for k, v in iterable:
| d[k] = v
| dict(**kwargs) -> new dictionary initialized with the name=value pairs
| in the keyword argument list. For example: dict(one=1, two=2)
|
| Method resolution order:
| n0Vault
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __getitem__(self, xpath)
| Public operator: isntance[xpath]
| return isntance._vault[where1/where2/.../whereN]
| AKA
| return isntance._vault[where1][where2]...[whereN]
|
| If any of [where1][where2]...[whereN] are not found, exception IndexError will be raised
|
| __init__(self, vault_file_name: str = None, encrypted=True, password: str = None, key=None)
| Constructor for n0Vault
|
| vault_file_name: str = None, storage file name
| encrypted = True, save as encrypted by default
| password: str = None, password will be used during saving
| key = None 256-bit Key encrypted with base64
|
| __setitem__(self, xpath: str, new_value)
| Public operator: isntance[xpath] = new_value
|
| Update isntance._vault with {xpath:new_value}
|
| delete(self, xpath) -> dict
| Public method: isntance.delete(xpath)
|
| Delete item 'xpath' from isntance._vault
|
| get(self, xpath: str, if_not_found=None)
| Public method: isntance.get(xpath: str, if_not_found = None)
| return _vault[where1/where2/.../whereN]
| AKA
| return _vault[where1][where2]...[whereN]
|
| If any of [where1][where2]...[whereN] are not found, if_not_found will be returned
|
| is_bit_set(self, bit_offset: int = 0, binary_mask: int = 1, bytes_array: int = None) -> int
| Public method: isntance.is_bit_set(bit_offset: int = 0, binary_mask: int = 0b1, bytes_array: int = None) -> int:
|
| Return bits' set from bit_offset of bytes_array/self.__flags and applied binary_mask
|
| load(self, vault_file_name: str)
| Public method: isntance.load(vault_file_name: str):
|
| Load 'vault_file_name' and decrypt it if it was encrypted.
|
| pop(self, xpath) -> dict
| Public method: isntance.pop(xpath)
|
| Return value associated with 'xpath' and delete item 'xpath' from isntance._vault
|
| save(self, new_vault_file_name: str = None, forbid_next_saving=False)
| Public method: isntance.save(new_vault_file_name: str = None, forbid_next_saving = False):
|
| Save file depends of self._encrypted flag into encrypted or decrypted format.
| if 3rd bit in self.__flags is already set previously, then Exception will be raised -- saving is forbidden.
|
| set_bits(self, bytes_array: int, bits_value: int, bits_len: int = 1, bits_offset: int = 0, bits_in_bytes: int = 32) -> int
| Public method: isntance.set_bits(bytes_array: int, bits_value: int, bits_len: int = 1, bits_offset: int = 0, bits_in_bytes: int = 32)
|
| Apply bits_value to bits_offset of bytes_array
|
| 1) Prepare all bits mask depends of bits_in_bytes (bytes_array size): 0xFF, 0xFFFF, 0xFFFFFFFF
| bits_in_bytes = 8 => bits_mask = b0000_0000__0000_0000___0000_0000__1111_1111
| bits_in_bytes = 16 => bits_mask = b0000_0000__0000_0000___1111_1111__1111_1111
| bits_in_bytes = 32 => bits_mask = b1111_1111__1111_1111___1111_1111__1111_1111
|
| 2) Prepare the mask for bits place clearing, depends of bits_len and bits_offset
| bits_len = 1, bits_offset = 0 => b0000_0000__0000_0000___0000_0000__0000_0001 => clear_bits_mask = b1111_1111__1111_1111___1111_1111__1111_1110
| bits_len = 2, bits_offset = 0 => b0000_0000__0000_0000___0000_0000__0000_0011 => clear_bits_mask = b1111_1111__1111_1111___1111_1111__1111_1100
| bits_len = 3, bits_offset = 0 => b0000_0000__0000_0000___0000_0000__0000_0111 => clear_bits_mask = b1111_1111__1111_1111___1111_1111__1111_1000
| bits_len = 8, bits_offset = 0 => b0000_0000__0000_0000___0000_0000__1111_1111 => clear_bits_mask = b1111_1111__1111_1111___1111_1111__0000_0000
|
| bits_len = 1, bits_offset = 4 => b0000_0000__0000_0000___0000_0000__0001_0000 => clear_bits_mask = b1111_1111__1111_1111___1111_1111__1110_1111
| bits_len = 2, bits_offset = 4 => b0000_0000__0000_0000___0000_0000__0011_0000 => clear_bits_mask = b1111_1111__1111_1111___1111_1111__1100_1111
| bits_len = 3, bits_offset = 4 => b0000_0000__0000_0000___0000_0000__0111_0000 => clear_bits_mask = b1111_1111__1111_1111___1111_1111__1000_1111
| bits_len = 8, bits_offset = 4 => b0000_0000__0000_0000___0000_1111__1111_0000 => clear_bits_mask = b1111_1111__1111_1111___1111_0000__0000_1111
|
| 3) Clearing the bits place
|
| 4) Update the cleared place with bits_value
|
| show(self, start_from=None) -> dict
| Public method: isntance.show(start_from = None)
|
| Return json structure of isntance._vault or isntance._vault[start_from]
|
| update(self, xpath: Union[dict, str], new_value: str = None) -> dict
| Public method: isntance.update(xpath: typing.Union[dict, str], new_value: str = None)
|
| Update isntance._vault with {xpath:new_value} or {xpath as a dictionary}
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| vault_file_name = None
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| fromkeys(iterable, value=None, /) from builtins.type
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
DATA
AES_MODE = 3
DEBUG_MODE = False
annotations = _Feature((3, 7, 0, 'beta', 1), (4, 0, 0, 'alpha', 0), 16...
compiled_regexp_mask_pan = re.compile('(([^0-9]|^)?(000)?[456][0-9]{5}...
logger = <loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>
FILE
c:\repo\n0vault\n0vault\__init__.py