From abd0a6854c90c3647d17dfb3ea980fa49aa5372f Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Wed, 11 May 2016 22:25:23 -0700 Subject: [PATCH] Add fsbase and gsbase commands --- pwndbg/commands/segments.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pwndbg/commands/segments.py b/pwndbg/commands/segments.py index 0076944e9..6587fb725 100644 --- a/pwndbg/commands/segments.py +++ b/pwndbg/commands/segments.py @@ -1,6 +1,7 @@ from __future__ import print_function import gdb import pwndbg.regs +import pwndbg.commands class segment(gdb.Function): """Get the flat address of memory based off of the named segment register. @@ -14,3 +15,20 @@ class segment(gdb.Function): segment('fsbase') segment('gsbase') + +@pwndbg.commands.OnlyWhenRunning +@pwndbg.commands.ParsedCommand +def fsbase(): + """ + Prints out the FS base address. See also $fsbase. + """ + print(hex(pwndbg.regs.fsbase)) + + +@pwndbg.commands.OnlyWhenRunning +@pwndbg.commands.ParsedCommand +def gsbase(): + """ + Prints out the GS base address. See also $gsbase. + """ + print(hex(pwndbg.regs.gsbase))