From ce77916c58f1d80a1030c77e0fe79ced6def3aaf Mon Sep 17 00:00:00 2001 From: afg Date: Thu, 28 Nov 2019 19:28:54 +0800 Subject: [PATCH 1/9] fix: SyntaxWarning: "is" with a literal. Did you mean "=="? --- peda.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/peda.py b/peda.py index dfcd7cd..14a7f5e 100644 --- a/peda.py +++ b/peda.py @@ -42,7 +42,7 @@ import config from nasm import * -if sys.version_info.major is 3: +if sys.version_info.major == 3: from urllib.request import urlopen from urllib.parse import urlencode pyversion = 3 @@ -5789,9 +5789,9 @@ def list_shellcode(): while True: for os in oslist: msg('%s %s'%(yellow('[+]'),green(os))) - if pyversion is 2: + if pyversion == 2: os = input('%s'%blue('os:')) - if pyversion is 3: + if pyversion == 3: os = input('%s'%blue('os:')) if os in oslist: #check if os exist break @@ -5800,9 +5800,9 @@ def list_shellcode(): while True: for job in joblist: msg('%s %s'%(yellow('[+]'),green(job))) - if pyversion is 2: + if pyversion == 2: job = raw_input('%s'%blue('job:')) - if pyversion is 3: + if pyversion == 3: job = input('%s'%blue('job:')) if job != '': break @@ -5811,9 +5811,9 @@ def list_shellcode(): while True: for encode in encodelist: msg('%s %s'%(yellow('[+]'),green(encode))) - if pyversion is 2: + if pyversion == 2: encode = raw_input('%s'%blue('encode:')) - if pyversion is 3: + if pyversion == 3: encode = input('%s'%blue('encode:')) if encode != '': break From 2f48add05b44743fe6a305abc446b648d5e805f8 Mon Sep 17 00:00:00 2001 From: Mihai-Valentin DUMITRU Date: Fri, 29 Nov 2019 17:14:16 +0200 Subject: [PATCH 2/9] silence python3.8 warnings --- peda.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/peda.py b/peda.py index dfcd7cd..14a7f5e 100644 --- a/peda.py +++ b/peda.py @@ -42,7 +42,7 @@ import config from nasm import * -if sys.version_info.major is 3: +if sys.version_info.major == 3: from urllib.request import urlopen from urllib.parse import urlencode pyversion = 3 @@ -5789,9 +5789,9 @@ def list_shellcode(): while True: for os in oslist: msg('%s %s'%(yellow('[+]'),green(os))) - if pyversion is 2: + if pyversion == 2: os = input('%s'%blue('os:')) - if pyversion is 3: + if pyversion == 3: os = input('%s'%blue('os:')) if os in oslist: #check if os exist break @@ -5800,9 +5800,9 @@ def list_shellcode(): while True: for job in joblist: msg('%s %s'%(yellow('[+]'),green(job))) - if pyversion is 2: + if pyversion == 2: job = raw_input('%s'%blue('job:')) - if pyversion is 3: + if pyversion == 3: job = input('%s'%blue('job:')) if job != '': break @@ -5811,9 +5811,9 @@ def list_shellcode(): while True: for encode in encodelist: msg('%s %s'%(yellow('[+]'),green(encode))) - if pyversion is 2: + if pyversion == 2: encode = raw_input('%s'%blue('encode:')) - if pyversion is 3: + if pyversion == 3: encode = input('%s'%blue('encode:')) if encode != '': break From 4949ff9eec59bbf7eb01c4187e415dcfdedb327d Mon Sep 17 00:00:00 2001 From: r3dhun9 Date: Sun, 8 Dec 2019 20:15:41 +0800 Subject: [PATCH 3/9] Add cyan, purple, black, white (colorize function to cutomize the peda) --- lib/utils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/utils.py b/lib/utils.py index 8f2b038..76d5757 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -147,6 +147,22 @@ def blue(text, attrib=None): """Wrapper for colorize(text, 'blue')""" return colorize(text, "blue", attrib) +def cyan(text, attrib=None): + """Wrapper for colorize(text, 'cyan')""" + return colorize(text, "cyan", attrib) + +def purple(text, attrib=None): + """Wrapper for colorize(text, 'purple')""" + return colorize(text, "purple", attrib) + +def black(text, attrib=None): + """Wrapper for colorize(text, 'black')""" + return colorize(text, "black", attrib) + +def white(text, attrib=None): + """Wrapper for colorize(text, 'white')""" + return colorize(text, "white", attrib) + def clearscreen(): """Clear terminal screen""" sys.stdout.write("\x1b[2J\x1b[H") From 6e87c911dcbd918338762cefbb59b503aed96140 Mon Sep 17 00:00:00 2001 From: duckie <40424574+not-duckie@users.noreply.github.com> Date: Mon, 23 Dec 2019 16:40:11 +0530 Subject: [PATCH 4/9] changed is to == this python3 requirement to use == in place of 'is', otherwise it shows warning, it does affect the working but its anonying to warning everytime, so i fixed it. --- peda.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/peda.py b/peda.py index dfcd7cd..14a7f5e 100644 --- a/peda.py +++ b/peda.py @@ -42,7 +42,7 @@ import config from nasm import * -if sys.version_info.major is 3: +if sys.version_info.major == 3: from urllib.request import urlopen from urllib.parse import urlencode pyversion = 3 @@ -5789,9 +5789,9 @@ def list_shellcode(): while True: for os in oslist: msg('%s %s'%(yellow('[+]'),green(os))) - if pyversion is 2: + if pyversion == 2: os = input('%s'%blue('os:')) - if pyversion is 3: + if pyversion == 3: os = input('%s'%blue('os:')) if os in oslist: #check if os exist break @@ -5800,9 +5800,9 @@ def list_shellcode(): while True: for job in joblist: msg('%s %s'%(yellow('[+]'),green(job))) - if pyversion is 2: + if pyversion == 2: job = raw_input('%s'%blue('job:')) - if pyversion is 3: + if pyversion == 3: job = input('%s'%blue('job:')) if job != '': break @@ -5811,9 +5811,9 @@ def list_shellcode(): while True: for encode in encodelist: msg('%s %s'%(yellow('[+]'),green(encode))) - if pyversion is 2: + if pyversion == 2: encode = raw_input('%s'%blue('encode:')) - if pyversion is 3: + if pyversion == 3: encode = input('%s'%blue('encode:')) if encode != '': break From ed42e840eff116be327489c9c395cf471267a2ca Mon Sep 17 00:00:00 2001 From: duckie <40424574+not-duckie@users.noreply.github.com> Date: Mon, 23 Dec 2019 17:23:27 +0530 Subject: [PATCH 5/9] added information --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8878ab1..7b66773 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,13 @@ PEDA - Python Exploit Development Assistance for GDB ## Installation - git clone https://github.com/longld/peda.git ~/peda - echo "source ~/peda/peda.py" >> ~/.gdbinit + git clone https://github.com/not-duckie/peda.git /opt/peda + echo "source /opt/peda/peda.py" >> ~/.gdbinit echo "DONE! debug your program with gdb and enjoy" +Note: +This is exaclty the clone of peda repositry by [longld]https://github.com/longld/peda but this one doesnt throw warning to +use == instead of is when using with python3. +I changed it as it was anonying and peda is a great project by [longld]https://github.com/longld/peda and above those warnings. ## Screenshot ![start](http://i.imgur.com/P1BF5mp.png) From 0612c40c17a5a23e9f70d1d7b4fe29c3b54e1afd Mon Sep 17 00:00:00 2001 From: duckie <40424574+not-duckie@users.noreply.github.com> Date: Mon, 23 Dec 2019 17:24:12 +0530 Subject: [PATCH 6/9] markdown error --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7b66773..04d2669 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ PEDA - Python Exploit Development Assistance for GDB echo "source /opt/peda/peda.py" >> ~/.gdbinit echo "DONE! debug your program with gdb and enjoy" Note: -This is exaclty the clone of peda repositry by [longld]https://github.com/longld/peda but this one doesnt throw warning to +This is exaclty the clone of peda repositry by ![longld]https://github.com/longld/peda but this one doesnt throw warning to use == instead of is when using with python3. -I changed it as it was anonying and peda is a great project by [longld]https://github.com/longld/peda and above those warnings. +I changed it as it was anonying and peda is a great project by ![longld]https://github.com/longld/peda and above those warnings. ## Screenshot ![start](http://i.imgur.com/P1BF5mp.png) From 8441afd4037367b29354481a917014746177d3d2 Mon Sep 17 00:00:00 2001 From: duckie <40424574+not-duckie@users.noreply.github.com> Date: Mon, 23 Dec 2019 17:26:07 +0530 Subject: [PATCH 7/9] i wish i was fluent in markdown -_- --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 04d2669..7919c2a 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ PEDA - Python Exploit Development Assistance for GDB echo "source /opt/peda/peda.py" >> ~/.gdbinit echo "DONE! debug your program with gdb and enjoy" Note: -This is exaclty the clone of peda repositry by ![longld]https://github.com/longld/peda but this one doesnt throw warning to +This is exaclty the clone of peda repositry by ![longld](https://github.com/longld/peda) but this one doesnt throw warning to use == instead of is when using with python3. -I changed it as it was anonying and peda is a great project by ![longld]https://github.com/longld/peda and above those warnings. +I changed it as it was anonying and peda is a great project by ![longld](https://github.com/longld/peda) and above those warnings. ## Screenshot ![start](http://i.imgur.com/P1BF5mp.png) From 6de0f5f2b7669658fafd8e00d1333c1aa7e55b12 Mon Sep 17 00:00:00 2001 From: Long Le Date: Tue, 28 Jan 2020 07:33:40 +0700 Subject: [PATCH 8/9] Revert "changed "is" to "=="" --- README.md | 8 ++------ peda.py | 14 +++++++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7919c2a..8878ab1 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,9 @@ PEDA - Python Exploit Development Assistance for GDB ## Installation - git clone https://github.com/not-duckie/peda.git /opt/peda - echo "source /opt/peda/peda.py" >> ~/.gdbinit + git clone https://github.com/longld/peda.git ~/peda + echo "source ~/peda/peda.py" >> ~/.gdbinit echo "DONE! debug your program with gdb and enjoy" -Note: -This is exaclty the clone of peda repositry by ![longld](https://github.com/longld/peda) but this one doesnt throw warning to -use == instead of is when using with python3. -I changed it as it was anonying and peda is a great project by ![longld](https://github.com/longld/peda) and above those warnings. ## Screenshot ![start](http://i.imgur.com/P1BF5mp.png) diff --git a/peda.py b/peda.py index 14a7f5e..dfcd7cd 100644 --- a/peda.py +++ b/peda.py @@ -42,7 +42,7 @@ import config from nasm import * -if sys.version_info.major == 3: +if sys.version_info.major is 3: from urllib.request import urlopen from urllib.parse import urlencode pyversion = 3 @@ -5789,9 +5789,9 @@ def list_shellcode(): while True: for os in oslist: msg('%s %s'%(yellow('[+]'),green(os))) - if pyversion == 2: + if pyversion is 2: os = input('%s'%blue('os:')) - if pyversion == 3: + if pyversion is 3: os = input('%s'%blue('os:')) if os in oslist: #check if os exist break @@ -5800,9 +5800,9 @@ def list_shellcode(): while True: for job in joblist: msg('%s %s'%(yellow('[+]'),green(job))) - if pyversion == 2: + if pyversion is 2: job = raw_input('%s'%blue('job:')) - if pyversion == 3: + if pyversion is 3: job = input('%s'%blue('job:')) if job != '': break @@ -5811,9 +5811,9 @@ def list_shellcode(): while True: for encode in encodelist: msg('%s %s'%(yellow('[+]'),green(encode))) - if pyversion == 2: + if pyversion is 2: encode = raw_input('%s'%blue('encode:')) - if pyversion == 3: + if pyversion is 3: encode = input('%s'%blue('encode:')) if encode != '': break From 4791800c00cb1f2e4304564264b105c12a037904 Mon Sep 17 00:00:00 2001 From: r3dhun9 Date: Fri, 7 Feb 2020 14:38:16 +0800 Subject: [PATCH 9/9] Update colors --- lib/.gdb_history | 4 ++++ lib/utils.py | 22 +++++++++++++++++++--- peda.py | 12 ++++++------ 3 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 lib/.gdb_history diff --git a/lib/.gdb_history b/lib/.gdb_history new file mode 100644 index 0000000..b60bb04 --- /dev/null +++ b/lib/.gdb_history @@ -0,0 +1,4 @@ +b main +r +exit +q diff --git a/lib/utils.py b/lib/utils.py index 8f2b038..8ba3281 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -147,6 +147,22 @@ def blue(text, attrib=None): """Wrapper for colorize(text, 'blue')""" return colorize(text, "blue", attrib) +def cyan(text, attrib=None): + """Wrapper for colorize(text, 'cyan')""" + return colorize(text, "cyan", attrib) + +def purple(text, attrib=None): + """Wrapper for colorize(text, 'purple')""" + return colorize(text, "purple", attrib) + +def black(text, attrib=None): + """Wrapper for colorize(text, 'black')""" + return colorize(text, "black", attrib) + +def white(text, attrib=None): + """Wrapper for colorize(text, 'white')""" + return colorize(text, "white", attrib) + def clearscreen(): """Clear terminal screen""" sys.stdout.write("\x1b[2J\x1b[H") @@ -446,9 +462,9 @@ def check_badchars(data, chars=None): def format_address(addr, type): """Colorize an address""" colorcodes = { - "data": "blue", - "code": "red", - "rodata": "green", + "data": "cyan", + "code": "purple", + "rodata": "red", "value": None } return colorize(addr, colorcodes[type]) diff --git a/peda.py b/peda.py index 14a7f5e..0b5693d 100644 --- a/peda.py +++ b/peda.py @@ -4250,7 +4250,7 @@ def context_register(self, *arg): pc = peda.getreg("pc") # display register info - msg("[%s]" % "registers".center(78, "-"), "blue") + msg("[%s]" % "registers".center(78, "-"), "yellow") self.xinfo("register") return @@ -4276,7 +4276,7 @@ def context_code(self, *arg): else: inst = None - text = blue("[%s]" % "code".center(78, "-")) + text = yellow("[%s]" % "code".center(78, "-")) msg(text) if inst: # valid $PC text = "" @@ -4337,7 +4337,7 @@ def context_stack(self, *arg): if not self._is_running(): return - text = blue("[%s]" % "stack".center(78, "-")) + text = yellow("[%s]" % "stack".center(78, "-")) msg(text) sp = peda.getreg("sp") if peda.is_address(sp): @@ -4387,8 +4387,8 @@ def context(self, *arg): # display stack content, forced in case SIGSEGV if "stack" in opt or "SIGSEGV" in status: self.context_stack(count) - msg("[%s]" % ("-"*78), "blue") - msg("Legend: %s, %s, %s, value" % (red("code"), blue("data"), green("rodata"))) + msg("[%s]" % ("-"*78), "yellow") + msg("Legend: %s, %s, %s, value" % (cyan("code"), purple("data"), red("rodata"))) # display stopped reason if "SIG" in status: @@ -6151,7 +6151,7 @@ def sigint_handler(signal, frame): peda.execute("set confirm off") peda.execute("set verbose off") peda.execute("set output-radix 0x10") -peda.execute("set prompt \001%s\002" % red("\002gdb-peda$ \001")) # custom prompt +peda.execute("set prompt \001%s\002" % yellow("\002gdb-redhung$ \001")) # custom prompt peda.execute("set height 0") # disable paging peda.execute("set history expansion on") peda.execute("set history save on") # enable history saving