summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-03-11 08:56:28 -0500
committerdusoleil <howcansocksbereal@gmail.com>2023-03-13 19:21:49 -0400
commit158ff535c4995f70a6fefddee5bc8775d3084ccb (patch)
tree545ff4aedbd492f18408bd80bc80e494230bdd8b
parent756fc02e145e176c37af5c5125c55d74d0c89ad3 (diff)
downloadsploit-158ff535c4995f70a6fefddee5bc8775d3084ccb.tar.gz
sploit-158ff535c4995f70a6fefddee5bc8775d3084ccb.zip
symtbl: Only print column headings if table is populated
QoL change - Don't print the headings if the table is empty. Just report "0 symbols" and the base address. Signed-off-by: Malfurious <m@lfurio.us> Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--sploit/symtbl.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sploit/symtbl.py b/sploit/symtbl.py
index e51b72d..ce57277 100644
--- a/sploit/symtbl.py
+++ b/sploit/symtbl.py
@@ -173,7 +173,8 @@ class SymtblImpl:
"""Return human-readable Symtbl"""
FMT = "\n{:<20} {:<20}"
s = f"{len(self)} symbols @ {hex(self)}"
- s += FMT.format("ADDRESS", "SYMBOL")
+ if len(self) > 0:
+ s += FMT.format("ADDRESS", "SYMBOL")
for symbol, offset in sorted(self, key=lambda v: int(v[1])):
disp = f"[{symbol}]" if type(offset) is not int else symbol
s += FMT.format(hex(offset), disp)