From bff9ffc5daef3c94d572c90955b97eea6a1cc74b Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Sat, 1 Mar 2014 06:45:44 +0000 Subject: [PATCH 1/2] ARM and PPC --- lib/utils.py | 2 +- peda.py | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/utils.py b/lib/utils.py index 1307136..4b7cd60 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -147,7 +147,7 @@ def __init__(self): def bufferize(self, f=None): """Activate message's bufferization, can also be used as a decorater.""" - + return if f != None: @functools.wraps(f) def wrapper(*args, **kwargs): diff --git a/peda.py b/peda.py index 03738ce..fad56ee 100644 --- a/peda.py +++ b/peda.py @@ -34,12 +34,13 @@ import config from nasm import * +ARM_REGS = ['sp'] + map(lambda x: "r%i" % x, range(32)) + ['cpsr'] + REGISTERS = { 8 : ["al", "ah", "bl", "bh", "cl", "ch", "dl", "dh"], 16: ["ax", "bx", "cx", "dx"], - 32: ["eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", "eip"], - 64: ["rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "rsp", "rip", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"] + 32: ["eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", "eip"] + ARM_REGS, + 64: ["rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "rsp", "rip"] + ARM_REGS } ########################################################################### @@ -498,7 +499,6 @@ def getregs(self, reglist=None): r = r.split() if len(r) > 1 and to_int(r[1]) is not None: result[r[0]] = to_int(r[1]) - return result def getreg(self, register): @@ -4167,7 +4167,6 @@ def profile(self, *arg): return - @msg.bufferize def context_register(self, *arg): """ Display register information of current execution context @@ -4181,10 +4180,8 @@ def context_register(self, *arg): # display register info msg("[%s]" % "registers".center(78, "-"), "blue") self.xinfo("register") - return - @msg.bufferize def context_code(self, *arg): """ Display nearby disassembly at $PC of current execution context @@ -4254,7 +4251,6 @@ def context_code(self, *arg): return - @msg.bufferize def context_stack(self, *arg): """ Display stack of current execution context @@ -4284,7 +4280,6 @@ def context(self, *arg): """ (opt, count) = normalize_argv(arg, 2) - if to_int(count) is None: count = 8 if opt is None: @@ -4679,6 +4674,8 @@ def eflags(self, *arg): MYNAME MYNAME [set|clear] flagname """ + return "" + FLAGS = ["CF", "PF", "AF", "ZF", "SF", "TF", "IF", "DF", "OF"] FLAGS_TEXT = ["Carry", "Parity", "Adjust", "Zero", "Sign", "Trap", "Interrupt", "Direction", "Overflow"] From 794ead31467a7880fc8a4aab5b2528c65a0bdc4a Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Thu, 3 Jul 2014 23:35:31 -0700 Subject: [PATCH 2/2] Fix Python3 issue with map() being deferred --- peda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peda.py b/peda.py index fad56ee..d971320 100644 --- a/peda.py +++ b/peda.py @@ -34,7 +34,7 @@ import config from nasm import * -ARM_REGS = ['sp'] + map(lambda x: "r%i" % x, range(32)) + ['cpsr'] +ARM_REGS = ['sp'] + list(map(lambda x: "r%i" % x, range(32))) + ['cpsr'] REGISTERS = { 8 : ["al", "ah", "bl", "bh", "cl", "ch", "dl", "dh"],