diff options
author | Malfurious <m@lfurio.us> | 2024-01-12 14:28:26 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-01-13 17:22:12 -0500 |
commit | ead4ec1340555569e00919891383e05dca839b01 (patch) | |
tree | bb0187544dfd9ef265e31051775d55135c6198a0 /sploit/util.py | |
parent | 4a39e37e19fe02be9169d8a37ee09190acd09527 (diff) | |
download | nsploit-ead4ec1340555569e00919891383e05dca839b01.tar.gz nsploit-ead4ec1340555569e00919891383e05dca839b01.zip |
util: Promote from module to package
We would like to move additional modules under the namespace of "util"
to clean up the top-level "sploit" package. To start, the functions
from the previous util module are moved. Given the package is named
"util" the module is renamed to "cmd" to somewhat match the theme of the
contained functions.
Per the previous commits, these functions are now exposed via the util
package as well.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'sploit/util.py')
-rw-r--r-- | sploit/util.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/sploit/util.py b/sploit/util.py deleted file mode 100644 index 3a2b842..0000000 --- a/sploit/util.py +++ /dev/null @@ -1,26 +0,0 @@ -from os import path -from subprocess import run - -def run_cmd(cmd,cwd=None): - return run(cmd,cwd=cwd,capture_output=True,text=True,check=True).stdout.split('\n')[:-1] - -__RUN_CACHE__ = {} -def run_cmd_cached(cmd,cwd=None): - key = ''.join(cmd) - if key in __RUN_CACHE__: - return __RUN_CACHE__[key] - else: - result = run_cmd(cmd,cwd) - __RUN_CACHE__[key] = result - return result - -#try to get the version through git -def git_version(): - try: - cwd = path.dirname(path.realpath(__file__)) - version = run_cmd(["git","describe","--always","--first-parent","--dirty"],cwd=cwd)[0] - #PEP440 compliance - version = version.replace('-','+',1).replace('-','.') - return version - except: - return "0+unknown.version" |