summaryrefslogtreecommitdiffstats
path: root/sploit/util
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2025-01-02 19:17:34 -0500
committerMalfurious <m@lfurio.us>2025-01-04 23:54:51 -0500
commit0f00627964a4b2e515108401fa2cfe94600ad648 (patch)
tree56da2ccaf393a1124220cc187a7225a4efcfbcba /sploit/util
parent640726aa11369d328c1cdfe00b4344b6a925729c (diff)
downloadnsploit-0f00627964a4b2e515108401fa2cfe94600ad648.tar.gz
nsploit-0f00627964a4b2e515108401fa2cfe94600ad648.zip
Rename sploit package to nsploit
Rename all affected files, references to file paths, and module imports within the code. Since this line of development represents a fork from the original sploit, a name change is seen as necessary to distinguish the projects, as well as allow them to be installed side by side. What does the "n" mean? Great question! You can think of it as meaning "new sploit" if you want, though that's not quite intended. The name is simply distinct and easy to pronounce. I had originally settled on "msploit" (something along the lines of "Malf's sploit"), but this name is too close to "metasploit" for me - and N is right next to it on the keyboard. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'sploit/util')
-rw-r--r--sploit/util/__init__.py2
-rw-r--r--sploit/util/cmd.py26
-rw-r--r--sploit/util/log.py32
3 files changed, 0 insertions, 60 deletions
diff --git a/sploit/util/__init__.py b/sploit/util/__init__.py
deleted file mode 100644
index 32a079b..0000000
--- a/sploit/util/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from .cmd import *
-from .log import *
diff --git a/sploit/util/cmd.py b/sploit/util/cmd.py
deleted file mode 100644
index 3a2b842..0000000
--- a/sploit/util/cmd.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"
diff --git a/sploit/util/log.py b/sploit/util/log.py
deleted file mode 100644
index 823b252..0000000
--- a/sploit/util/log.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import codecs
-import sys
-
-# https://docs.python.org/3/library/codecs.html#standard-encodings
-ENCODING = None
-
-ERROR = 31
-WARNING = 33
-STATUS = 32
-NORMAL = 0
-ALT = 90
-
-def enc_value(value, enc):
- if type(value) is bytes:
- if enc is not None:
- value = codecs.encode(value, enc)
- elif ENCODING is not None:
- value = codecs.encode(value, ENCODING)
- value = str(value)[2:-1] # strip b''
- return str(value)
-
-def generic_log(*values, sep, end, file, flush, enc, color):
- string = sep.join([ enc_value(x, enc) for x in values ])
- print(f'\033[{color}m{string}\033[0m', end=end, file=file, flush=flush)
-
-# For library internal use
-def ilog(*values, sep=' ', end='\n', file=sys.stderr, flush=True, enc=None, color=STATUS):
- generic_log(*values, sep=sep, end=end, file=file, flush=flush, enc=enc, color=color)
-
-# For external use in user script (via print = elog)
-def elog(*values, sep=' ', end='\n', file=sys.stdout, flush=True, enc=None, color=ALT):
- generic_log(*values, sep=sep, end=end, file=file, flush=flush, enc=enc, color=color)