Make "clearscreen" more reasonable and configurable
This commit is contained in:
parent
5458dd5ba8
commit
847a926b04
|
@ -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"),
|
||||
"clearscr" : ("on", "clear screen for each context display"),
|
||||
"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")
|
||||
|
|
|
@ -147,6 +147,10 @@ def blue(text, attrib=None):
|
|||
"""Wrapper for colorize(text, 'blue')"""
|
||||
return colorize(text, "blue", attrib)
|
||||
|
||||
def clearscreen():
|
||||
"""Clear terminal screen"""
|
||||
sys.stdout.write("\x1b[2J\x1b[H")
|
||||
|
||||
class message(object):
|
||||
"""
|
||||
Generic pretty printer with redirection.
|
||||
|
|
6
peda.py
6
peda.py
|
@ -4271,7 +4271,7 @@ class PEDACmd(object):
|
|||
|
||||
pc = peda.getreg("pc")
|
||||
# display register info
|
||||
msg("\033[2J\033[0;0H [%s]" % "registers".center(78, "-"), "blue")
|
||||
msg("[%s]" % "registers".center(78, "-"), "blue")
|
||||
self.xinfo("register")
|
||||
|
||||
return
|
||||
|
@ -4392,6 +4392,10 @@ class PEDACmd(object):
|
|||
if not self._is_running():
|
||||
return
|
||||
|
||||
clearscr = config.Option.get("clearscr")
|
||||
if clearscr == "on":
|
||||
clearscreen()
|
||||
|
||||
status = peda.get_status()
|
||||
# display registers
|
||||
if "reg" in opt or "register" in opt:
|
||||
|
|
Loading…
Reference in New Issue