osbot-utils 1.16.0__py3-none-any.whl → 1.17.0__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.
- osbot_utils/helpers/SSH.py +21 -0
- osbot_utils/utils/Env.py +2 -0
- osbot_utils/utils/Misc.py +3 -0
- osbot_utils/version +1 -1
- {osbot_utils-1.16.0.dist-info → osbot_utils-1.17.0.dist-info}/METADATA +2 -2
- {osbot_utils-1.16.0.dist-info → osbot_utils-1.17.0.dist-info}/RECORD +8 -8
- {osbot_utils-1.16.0.dist-info → osbot_utils-1.17.0.dist-info}/LICENSE +0 -0
- {osbot_utils-1.16.0.dist-info → osbot_utils-1.17.0.dist-info}/WHEEL +0 -0
osbot_utils/helpers/SSH.py
CHANGED
@@ -5,6 +5,7 @@ from osbot_utils.context_managers.capture_duration import capture_duration
|
|
5
5
|
from osbot_utils.decorators.lists.group_by import group_by
|
6
6
|
from osbot_utils.decorators.lists.index_by import index_by
|
7
7
|
from osbot_utils.utils.Dev import pprint
|
8
|
+
from osbot_utils.utils.Functions import function_source_code
|
8
9
|
from osbot_utils.utils.Misc import timestamp_utc_now
|
9
10
|
from osbot_utils.utils.Process import start_process
|
10
11
|
from osbot_utils.utils.Status import status_error
|
@@ -27,6 +28,26 @@ class SSH(Kwargs_To_Self):
|
|
27
28
|
return result
|
28
29
|
return status_error(error='in execute_command not all required vars were setup')
|
29
30
|
|
31
|
+
def execute_python__code(self, python_code, python_executable='python3'):
|
32
|
+
python_command = f"{python_executable} -c \"{python_code}\""
|
33
|
+
return self.execute_command(python_command)
|
34
|
+
|
35
|
+
def execute_python__code__return_stdout(self, *args, **kwargs):
|
36
|
+
return self.execute_python__code(*args, **kwargs).get('stdout').strip()
|
37
|
+
|
38
|
+
def execute_python__function(self, function, python_executable='python3'):
|
39
|
+
function_name = function.__name__
|
40
|
+
function_code = function_source_code(function)
|
41
|
+
exec_code = f"{function_code}\nresult= {function_name}(); print(result)"
|
42
|
+
python_command = f"{python_executable} -c \"{exec_code}\""
|
43
|
+
return self.execute_command(python_command)
|
44
|
+
|
45
|
+
def execute_python__function__return_stderr(self, *args, **kwargs):
|
46
|
+
return self.execute_python__function(*args, **kwargs).get('stderr').strip()
|
47
|
+
|
48
|
+
def execute_python__function__return_stdout(self, *args, **kwargs):
|
49
|
+
return self.execute_python__function(*args, **kwargs).get('stdout').strip()
|
50
|
+
|
30
51
|
def execute_ssh_args(self, command=None):
|
31
52
|
ssh_args = []
|
32
53
|
if self.strict_host_check is False:
|
osbot_utils/utils/Env.py
CHANGED
@@ -45,6 +45,8 @@ def env_load_from_file(path, override=False):
|
|
45
45
|
line = line.strip()
|
46
46
|
if not line or line.startswith('#'): # Strip whitespace and ignore comments
|
47
47
|
continue
|
48
|
+
if line.startswith('export '): # if the line starts with export, we can ignore it and continue
|
49
|
+
line = line[7:]
|
48
50
|
key, value = line.split(sep='=', maxsplit=1) # Split the line into key and value
|
49
51
|
value = strip_quotes(value.strip()) # Handle case when the value is in quotes
|
50
52
|
if override or key.strip() not in os.environ: # Set the environment variable
|
osbot_utils/utils/Misc.py
CHANGED
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v1.
|
1
|
+
v1.17.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.17.0
|
4
4
|
Summary: OWASP Security Bot - Utils
|
5
5
|
Home-page: https://github.com/owasp-sbot/OSBot-Utils
|
6
6
|
License: MIT
|
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
|
|
22
22
|
|
23
23
|
Powerful Python util methods and classes that simplify common apis and tasks.
|
24
24
|
|
25
|
-

|
26
26
|
[](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
|
27
27
|
|
28
28
|
|
@@ -60,7 +60,7 @@ osbot_utils/helpers/Print_Table.py,sha256=vYpz-HXX_dDIzSRptwkzpOFADT9R7w3FG9skbV
|
|
60
60
|
osbot_utils/helpers/Python_Audit.py,sha256=shpZlluJwqJBAlad6xN01FkgC1TsQ48RLvR5ZjmrKa4,1539
|
61
61
|
osbot_utils/helpers/Random_Seed.py,sha256=14btja8LDN9cMGWaz4fCNcMRU_eyx49gas-_PQvHgy4,634
|
62
62
|
osbot_utils/helpers/SCP.py,sha256=fK1xu5mk_axsI7MU2-WIXEjdYetWkUBDb33p6oALgaI,2687
|
63
|
-
osbot_utils/helpers/SSH.py,sha256
|
63
|
+
osbot_utils/helpers/SSH.py,sha256=-dQkwGJzMRrq5iWWf0ZdZkrmHiFpSBt0lMkX9iTti0M,7264
|
64
64
|
osbot_utils/helpers/Type_Registry.py,sha256=Ajk3SyMSKDi2g9SJYUtTgg7PZkAgydaHcpbGuEN3S94,311
|
65
65
|
osbot_utils/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
66
|
osbot_utils/helpers/ast/Ast.py,sha256=lcPQOSxXI6zgmMnIVF9WM6ISqViWX-sq4d_UC0CDG8s,1155
|
@@ -235,7 +235,7 @@ osbot_utils/utils/Assert.py,sha256=u9XLgYn91QvNWZGyPi29SjPJSXRHlm9andIn3NJEVog,1
|
|
235
235
|
osbot_utils/utils/Call_Stack.py,sha256=MAq_0vMxnbeLfCe9qQz7GwJYaOuXpt3qtQwN6wiXsU0,6595
|
236
236
|
osbot_utils/utils/Csv.py,sha256=oHLVpjRJqrLMz9lubMCNEoThXWju5rNTprcwHc1zq2c,1012
|
237
237
|
osbot_utils/utils/Dev.py,sha256=HibpQutYy_iG8gGV8g1GztxNN4l29E4Bi7UZaVL6-L8,1203
|
238
|
-
osbot_utils/utils/Env.py,sha256=
|
238
|
+
osbot_utils/utils/Env.py,sha256=fRYX9cIgbZSjK-Fe8IKiGaBc70-fqRfg6TzFxPgxhwk,4228
|
239
239
|
osbot_utils/utils/Exceptions.py,sha256=KyOUHkXQ_6jDTq04Xm261dbEZuRidtsM4dgzNwSG8-8,389
|
240
240
|
osbot_utils/utils/Files.py,sha256=HRMdDq1ZctDfCkIfuZGgQ3fG6O03qJEFEIkb8HTYzfU,19407
|
241
241
|
osbot_utils/utils/Functions.py,sha256=0E6alPJ0fJpBiJgFOWooCOi265wSRyxxXAJ5CELBnso,3498
|
@@ -244,7 +244,7 @@ osbot_utils/utils/Int.py,sha256=PmlUdU4lSwf4gJdmTVdqclulkEp7KPCVUDO6AcISMF4,116
|
|
244
244
|
osbot_utils/utils/Json.py,sha256=AfOXYBxAGzqwaNeHZ-aC-RpurNmHzPxGoym7MMY8UN4,6366
|
245
245
|
osbot_utils/utils/Json_Cache.py,sha256=mLPkkDZN-3ZVJiDvV1KBJXILtKkTZ4OepzOsDoBPhWg,2006
|
246
246
|
osbot_utils/utils/Lists.py,sha256=CLEjgZwAixJAFlubWEKjnUUhUN85oqvR7UqExVW7rdY,5502
|
247
|
-
osbot_utils/utils/Misc.py,sha256=
|
247
|
+
osbot_utils/utils/Misc.py,sha256=AhacU4Wood7-d-mEypPaUUMLEOZyPlVvkOSQa3HRyNU,16784
|
248
248
|
osbot_utils/utils/Objects.py,sha256=qI6EVvx7kzXQrVGzsDk8txJkIXjsy7m2EEPZnYGy5R0,13867
|
249
249
|
osbot_utils/utils/Png.py,sha256=V1juGp6wkpPigMJ8HcxrPDIP4bSwu51oNkLI8YqP76Y,1172
|
250
250
|
osbot_utils/utils/Process.py,sha256=lr3CTiEkN3EiBx3ZmzYmTKlQoPdkgZBRjPulMxG-zdo,2357
|
@@ -254,8 +254,8 @@ osbot_utils/utils/Str.py,sha256=gcStFbB57ol74ASIr00pWImpd6ObBr5BLpSB0VUKNTE,1749
|
|
254
254
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
255
255
|
osbot_utils/utils/Zip.py,sha256=YFahdBguVK71mLdYy4m7mqVAQ5al-60QnTmYK-txCfY,6784
|
256
256
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
257
|
-
osbot_utils/version,sha256=
|
258
|
-
osbot_utils-1.
|
259
|
-
osbot_utils-1.
|
260
|
-
osbot_utils-1.
|
261
|
-
osbot_utils-1.
|
257
|
+
osbot_utils/version,sha256=VTpLwd--VoDn3yNbvY_3ModCDIw3sM07Mu6DZ7U1mD8,8
|
258
|
+
osbot_utils-1.17.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
259
|
+
osbot_utils-1.17.0.dist-info/METADATA,sha256=rLrA0JScCugXwuwBVfq7Uq2FaMHps2la9ukW2oIfIb0,1266
|
260
|
+
osbot_utils-1.17.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
261
|
+
osbot_utils-1.17.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|