mirror of https://github.com/pwndbg/pwndbg.git
Enable cache-while-running; add ASLR command; work around GDB internal aborts
parent
937fd1e05e
commit
18aa627d31
@ -1,13 +1,34 @@
|
|||||||
|
import gdb
|
||||||
import pwndbg.color
|
import pwndbg.color
|
||||||
import pwndbg.commands
|
import pwndbg.commands
|
||||||
|
import pwndbg.proc
|
||||||
import pwndbg.vmmap
|
import pwndbg.vmmap
|
||||||
|
|
||||||
|
|
||||||
@pwndbg.commands.OnlyWhenRunning
|
@pwndbg.commands.OnlyWhenRunning
|
||||||
@pwndbg.commands.Command
|
@pwndbg.commands.Command
|
||||||
def aslr():
|
def aslr(on_or_off=None):
|
||||||
|
"""
|
||||||
|
Check the current ASLR status, or turn it on/off.
|
||||||
|
|
||||||
|
Does not take effect until the program is restarted.
|
||||||
|
"""
|
||||||
|
options = {'on':'off', 'off':'on'}
|
||||||
|
|
||||||
|
if on_or_off is not None:
|
||||||
|
on_or_off = on_or_off.lower()
|
||||||
|
if on_or_off not in options:
|
||||||
|
print('Valid options are %s' % ', '.join(map(repr, options.keys())))
|
||||||
|
else:
|
||||||
|
gdb.execute('set disable-randomization %s' % options[on_or_off], from_tty=False, to_string=True)
|
||||||
|
|
||||||
|
if pwndbg.proc.alive:
|
||||||
|
print("Change will take effect when the process restarts")
|
||||||
|
|
||||||
|
aslr = pwndbg.vmmap.check_aslr()
|
||||||
status = pwndbg.color.red('OFF')
|
status = pwndbg.color.red('OFF')
|
||||||
if pwndbg.vmmap.aslr:
|
|
||||||
|
if aslr:
|
||||||
status = pwndbg.color.green('ON')
|
status = pwndbg.color.green('ON')
|
||||||
|
|
||||||
print("ASLR is %s" % status)
|
print("ASLR is %s" % status)
|
||||||
|
|||||||
Loading…
Reference in new issue