longld / peda

PEDA - Python Exploit Development Assistance for GDB
Other
5.87k stars 806 forks source link

context call in hook-stop without line count parameter #85

Open lortas opened 8 years ago

lortas commented 8 years ago

context call in hook-stop without any parameter. line count was not defined in config.

diff --git a/lib/config.py b/lib/config.py
index 5704fc7..422a410 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -35,6 +35,7 @@ OPTIONS = {
     "autosave"  : ("on", "auto saving peda session, e.g: on|off"),
     "payload"   : ("peda-payload-#FILENAME#.txt", "target file to save output of payload command"),
     "context"   : ("register,code,stack", "context display setting, e.g: register, code, stack, all"),
+    "context_lines" : ("8", "amount of lines for each context region"),
     "verbose"   : ("off", "show detail execution of commands, e.g: on|off"),
     "debug"     : ("off", "show detail error of peda commands, e.g: on|off"),
     "_teefd"    : ("", "internal use only for tracelog/crashlog writing")
diff --git a/peda.py b/peda.py
index 9f1d10b..98b8ad0 100644
--- a/peda.py
+++ b/peda.py
@@ -4374,7 +4374,7 @@ class PEDACmd(object):
         (opt, count) = normalize_argv(arg, 2)

         if to_int(count) is None:
-            count = 8
+            count = config.Option.get("context_lines")
         if opt is None:
             opt = config.Option.get("context")
         if opt == "all":
manuelbua commented 7 years ago

This would be cool since it looks like there is no way to specify custom context_lines without hacking the code.