summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-03-13 23:34:23 -0400
committerdusoleil <howcansocksbereal@gmail.com>2022-03-13 23:34:23 -0400
commitcd12c17a6a41102f55ef034fb819a2ee093df356 (patch)
tree7d13b3c12a2c82e4ca4169215a77fdd537be8eb4 /tools
parentafdc128959004fc630382debf29d47f367463d7e (diff)
downloadlib-des-gnux-cd12c17a6a41102f55ef034fb819a2ee093df356.tar.gz
lib-des-gnux-cd12c17a6a41102f55ef034fb819a2ee093df356.zip
sploit: Move __attr_filter__ to a general place in util
Found a spot to use __attr_filter__ in the rev module, so moving it out of mem and into a shared place (util). Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/sploit/sploit/mem.py4
-rw-r--r--tools/sploit/sploit/rev/elf.py4
-rw-r--r--tools/sploit/sploit/util.py6
3 files changed, 11 insertions, 3 deletions
diff --git a/tools/sploit/sploit/mem.py b/tools/sploit/sploit/mem.py
index c953fce..ac2bbb1 100644
--- a/tools/sploit/sploit/mem.py
+++ b/tools/sploit/sploit/mem.py
@@ -1,3 +1,5 @@
+from sploit.util import __attr_filter__
+
class Symtbl:
__subs__ = {}
def __init__(self, **kwargs):
@@ -84,5 +86,3 @@ def __str__(self,tbl):
else:
s += __tbl_format__.format(hex(addr),sym)
return s
-
-__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__']
diff --git a/tools/sploit/sploit/rev/elf.py b/tools/sploit/sploit/rev/elf.py
index acfe73b..7bfd31f 100644
--- a/tools/sploit/sploit/rev/elf.py
+++ b/tools/sploit/sploit/rev/elf.py
@@ -1,4 +1,5 @@
from sploit.rev import ldd, r2
+from sploit.util import __attr_filter__
class ELF:
def __init__(self, path):
@@ -38,7 +39,8 @@ class ELF:
def __init__(self, elf):
self.elf = elf
def __getattribute__(self, sym):
- if(sym=='elf'):return object.__getattribute__(self,sym)
+ if(sym in (['elf'] + __attr_filter__)):
+ return object.__getattribute__(self,sym)
return r2.get_locals(self.elf.path, getattr(self.elf.sym, sym))
def retaddr(self, caller, callee):
diff --git a/tools/sploit/sploit/util.py b/tools/sploit/sploit/util.py
index 610ab31..8a259c4 100644
--- a/tools/sploit/sploit/util.py
+++ b/tools/sploit/sploit/util.py
@@ -13,4 +13,10 @@ def run_cmd_cached(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__']