Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
32 changes: 27 additions & 5 deletions peda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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',
Expand Down