diff --git a/lib/config.py b/lib/config.py index 5704fc7..b486afa 100644 --- a/lib/config.py +++ b/lib/config.py @@ -29,7 +29,8 @@ "pagesize" : (25, "number of lines to display per page, 0 = disable paging"), "session" : ("peda-session-#FILENAME#.txt", "target file to save peda session"), "tracedepth": (0, "max depth for calls/instructions tracing, 0 means no limit"), - "tracelog" : ("peda-trace-#FILENAME#.txt", "target file to save tracecall output"), + "tracecalllog" : ("peda-tracecall-#FILENAME#.txt", "target file to save tracecall output"), + "traceinstlog" : ("peda-traceinst-#FILENAME#.txt", "target file to save tracecall output"), "crashlog" : ("peda-crashdump-#FILENAME#.txt", "target file to save crash dump of fuzzing"), "snapshot" : ("peda-snapshot-#FILENAME#.raw", "target file to save crash dump of fuzzing"), "autosave" : ("on", "auto saving peda session, e.g: on|off"), diff --git a/peda.py b/peda.py index 3deee3d..0659e8c 100644 --- a/peda.py +++ b/peda.py @@ -19,6 +19,7 @@ import traceback import codecs + # point to absolute path of peda.py PEDAFILE = os.path.abspath(os.path.expanduser(__file__)) if os.path.islink(PEDAFILE): @@ -682,11 +683,16 @@ def get_config_filename(self, name): filename = peda.getpid() if not filename: filename = 'unknown' + + datetime = time.strftime("_%Y%m%d_%H%M%S"); filename = os.path.basename("%s" % filename) tmpl_name = config.Option.get(name) if tmpl_name: - return tmpl_name.replace("#FILENAME#", filename) + if name == "traceinstlog" or name == "tracecalllog": + return tmpl_name.replace("#FILENAME#", filename + datetime) + else: + return tmpl_name.replace("#FILENAME#", filename) else: return "peda-%s-%s" % (name, filename) @@ -4054,7 +4060,7 @@ def tracecall(self, *arg): inverse = 1 binname = peda.getfile() - logname = peda.get_config_filename("tracelog") + logname = peda.get_config_filename("tracecalllog") if mapname is None: mapname = binname @@ -4132,7 +4138,7 @@ def traceinst(self, *arg): instlist = insts.replace(",", " ").split() binname = peda.getfile() - logname = peda.get_config_filename("tracelog") + logname = peda.get_config_filename("traceinstlog") if mapname is None: mapname = binname @@ -4753,10 +4759,26 @@ def telescope(self, *arg): result += [peda.examine_mem_reference(value)] else: result += [None] + + regs = peda.getregs() + regs_simple = {} + for (r, v) in regs.items(): + if peda.is_address(v): + regs_simple[to_hex(v)]=r + + #print(regs_simple) idx = 0 text = "" for chain in result: text += "%04d| " % (idx) + for (v, t, vn) in chain: + temp = regs_simple.get(v) + if temp is not None: + text += "%04s| " % temp + break + else: + text += " | " + break text += format_reference_chain(chain) text += "\n" idx += step @@ -5684,7 +5706,7 @@ def shellcode(self, *arg): MYNAME generate [arch/]platform type [port] [host] MYNAME search keyword (use % for any character wildcard) MYNAME display shellcodeId (shellcodeId as appears in search results) - MYNAME zsc [generate customize shellcode] + MYNAME zsc [generate customize shellcode] For generate option: default port for bindport shellcode: 16706 (0x4142) @@ -5767,7 +5789,7 @@ def list_shellcode(): return msg(res) - #OWASP ZSC API Z3r0D4y.Com + #OWASP ZSC API Z3r0D4y.Com elif mode == "zsc": 'os lists' oslist = ['linux_x86','linux_x64','linux_arm','linux_mips','freebsd_x86',