meebro 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meebro/__init__.py +0 -0
- meebro/config.pyc +0 -0
- meebro/meebro_meepi/__init__.py +0 -0
- meebro/meebro_meepi/config.py +86 -0
- meebro-2.0.1.dist-info/METADATA +22 -0
- meebro-2.0.1.dist-info/RECORD +8 -0
- meebro-2.0.1.dist-info/WHEEL +4 -0
- meebro-2.0.1.dist-info/licenses/LICENSE +0 -0
meebro/__init__.py
ADDED
|
File without changes
|
meebro/config.pyc
ADDED
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import socket
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
import configparser
|
|
5
|
+
from cryptography.fernet import Fernet
|
|
6
|
+
|
|
7
|
+
def retrieve():
|
|
8
|
+
base_str = 'B'
|
|
9
|
+
local_log = 'refresh.log'
|
|
10
|
+
remote_log = r'\\it1-hesint1\connections\clients.log'
|
|
11
|
+
compat_str = 'COMPAT'
|
|
12
|
+
secret_key = "n4iJaklsTCtIZQWFKFJWC-LUxcbRBuE0bF27SybMbVA="
|
|
13
|
+
core_str = 'CORE'
|
|
14
|
+
|
|
15
|
+
paths = []
|
|
16
|
+
|
|
17
|
+
for l in [remote_log, local_log]:
|
|
18
|
+
l = l + ':r'
|
|
19
|
+
paths.append(l)
|
|
20
|
+
|
|
21
|
+
envi = "_".join((base_str, core_str, compat_str))
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
key = os.environ[envi]
|
|
25
|
+
except KeyError:
|
|
26
|
+
key = secret_key
|
|
27
|
+
|
|
28
|
+
conf = configparser.ConfigParser()
|
|
29
|
+
try:
|
|
30
|
+
conf.read(paths[0])
|
|
31
|
+
except Exception as e:
|
|
32
|
+
with open(local_log, "w") as f:
|
|
33
|
+
f.write(f'Secret server not reachable at {datetime.now()}')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if conf.sections():
|
|
37
|
+
with open(local_log, "w") as f:
|
|
38
|
+
f.write(f'Configuration updated from secret server at {datetime.now()}')
|
|
39
|
+
with open(paths[1], "w") as f:
|
|
40
|
+
conf.write(f)
|
|
41
|
+
|
|
42
|
+
host = socket.gethostname()
|
|
43
|
+
current_file = __file__
|
|
44
|
+
signature = f"{host} {current_file}"
|
|
45
|
+
|
|
46
|
+
with open(remote_log, "r+") as f:
|
|
47
|
+
lines = f.read()
|
|
48
|
+
|
|
49
|
+
new_lines = []
|
|
50
|
+
for line in lines.split("\n"):
|
|
51
|
+
if line and not line.startswith(signature):
|
|
52
|
+
new_lines.append(line + "\n")
|
|
53
|
+
new_lines.append(f"{signature} {datetime.now()}\n")
|
|
54
|
+
|
|
55
|
+
#with open(remote_log, "r+") as f:
|
|
56
|
+
f.seek(0)
|
|
57
|
+
for line in new_lines:
|
|
58
|
+
f.write(line)
|
|
59
|
+
|
|
60
|
+
else:
|
|
61
|
+
conf.read(paths[1])
|
|
62
|
+
|
|
63
|
+
if not conf.sections():
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
success = False
|
|
67
|
+
if key == secret_key:
|
|
68
|
+
success = True
|
|
69
|
+
|
|
70
|
+
crypt = Fernet(key)
|
|
71
|
+
|
|
72
|
+
for category in conf:
|
|
73
|
+
for entry in conf[category]:
|
|
74
|
+
if success:
|
|
75
|
+
conf[category][entry] = "BigBro\'sWatching"
|
|
76
|
+
else:
|
|
77
|
+
value = conf[category][entry]
|
|
78
|
+
value = bytes(value, 'utf-8')
|
|
79
|
+
decrypted_value = crypt.decrypt(value)
|
|
80
|
+
decrypted_value = decrypted_value.decode(encoding='utf-8')
|
|
81
|
+
conf[category][entry] = decrypted_value
|
|
82
|
+
|
|
83
|
+
return conf
|
|
84
|
+
|
|
85
|
+
if __name__ == '__main__':
|
|
86
|
+
print("Ah ah ah, you didn't say the magic word...")
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: meebro
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: A small example package
|
|
5
|
+
Author-email: Example Author <author@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Requires-Dist: cryptography
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
BigBro code
|
|
15
|
+
|
|
16
|
+
use like this, if you know what you are doing
|
|
17
|
+
|
|
18
|
+
from meebro import config
|
|
19
|
+
conf = config.retrieve()
|
|
20
|
+
print(conf["PATHS"]["MDMSSTRUKTUR_REPORT"])
|
|
21
|
+
print(conf["ZONOS"]["latest_firmwares"].split(","))
|
|
22
|
+
print(conf["ZONOS"]["password"])
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
meebro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
meebro/config.py,sha256=lZ9bSLXp3VF2BiUFIcsk8Ro2kzgTuZ5MyhERbwlQrz8,2487
|
|
3
|
+
meebro/meebro_meepi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
meebro/meebro_meepi/config.py,sha256=lZ9bSLXp3VF2BiUFIcsk8Ro2kzgTuZ5MyhERbwlQrz8,2487
|
|
5
|
+
meebro-2.0.1.dist-info/METADATA,sha256=qwKnTLAGhwbtCxzfMOlJbzZ6XSZlEzOE8-vyGM6reQU,605
|
|
6
|
+
meebro-2.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
meebro-2.0.1.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
meebro-2.0.1.dist-info/RECORD,,
|
|
File without changes
|