summaryrefslogtreecommitdiffstats
path: root/sploit/util.py
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-03-14 00:43:15 -0400
committerMalfurious <m@lfurio.us>2022-03-14 00:43:15 -0400
commit616c8b8eadbde6fbb2fe16a6a2167e04f9d16382 (patch)
tree6560d8b5fea2b40d041f52683cd7accc61ce67a5 /sploit/util.py
parentdcba5f2b3d13f5142e4e552bdd717286f953bf1a (diff)
parentc493a8f8073702bcdccdbc40bf09931e201c9013 (diff)
downloadnsploit-616c8b8eadbde6fbb2fe16a6a2167e04f9d16382.tar.gz
nsploit-616c8b8eadbde6fbb2fe16a6a2167e04f9d16382.zip
Merge tag 'pull-sploit-rev' of https://github.com/Dusoleil/lib-des-gnux
Add rev for basic reverse engineering * tag 'pull-sploit-rev' of https://github.com/Dusoleil/lib-des-gnux: sploit: Move __attr_filter__ to a general place in util sploit: Filter all magic python members by default in mem module sploit: add stack base pointer to locals symtbl sploit: print hex of addresses in rev logs sploit: add status logging to rev module sploit: lazy load libs for ELF sploit: cache results of external commands sploit: add the rest of r2 functions through elf sploit: typo fix in rev.r2 sploit: cache ELF loads sploit: add ELF helper class to rev sploit: consolidate r2 symbol search calls sploit: fix r2 module syntax error sploit: reverse direction of r2 get_locals offsets sploit: add r2 funcionality to rev module sploit: add ldd ability to rev module sploit: add rev module to sploit
Diffstat (limited to '')
-rw-r--r--sploit/util.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/sploit/util.py b/sploit/util.py
new file mode 100644
index 0000000..8a259c4
--- /dev/null
+++ b/sploit/util.py
@@ -0,0 +1,22 @@
+from subprocess import run
+
+def run_cmd(cmd):
+ return run(cmd,capture_output=True).stdout.decode('utf-8').split('\n')[:-1]
+
+__RUN_CACHE__ = {}
+def run_cmd_cached(cmd):
+ key = ''.join(cmd)
+ if key in __RUN_CACHE__:
+ return __RUN_CACHE__[key]
+ else:
+ result = run_cmd(cmd)
+ __RUN_CACHE__[key] = result
+ return result
+
+__attr_filter__ = ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__',
+ '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__',
+ '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__',
+ '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
+ '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__',
+ '__weakref__']
+