Force conversion to int() before hex() to avoid 0xdeadbeefL

pull/99/head
Zach Riggle 10 years ago
parent d8155ee98b
commit 3d6bd1d285

@ -65,7 +65,7 @@ def print_symbols_in_section(section_name, filter_text=''):
symbols = get_symbols_in_region(start, end, filter_text)
for symbol, addr in symbols:
print(hex(addr) + ': ' + symbol)
print(hex(int(addr)) + ': ' + symbol)
def get_symbols_in_region(start, end, filter_text=''):
symbols = []

@ -42,4 +42,4 @@ def libs():
def entry_point():
"""GDBINIT compatibility alias to print the entry point.
See also the 'entry' command."""
print(hex(pwndbg.elf.entry()))
print(hex(int(pwndbg.elf.entry())))

@ -25,7 +25,7 @@ def fsbase():
"""
Prints out the FS base address. See also $fsbase.
"""
print(hex(pwndbg.regs.fsbase))
print(hex(int(pwndbg.regs.fsbase)))
@pwndbg.commands.ParsedCommand
@ -34,4 +34,4 @@ def gsbase():
"""
Prints out the GS base address. See also $gsbase.
"""
print(hex(pwndbg.regs.gsbase))
print(hex(int(pwndbg.regs.gsbase)))

@ -138,13 +138,13 @@ def autofetch():
except elftools.common.exceptions.ELFError:
continue
gdb_command = ['add-symbol-file', local_path, hex(base)]
gdb_command = ['add-symbol-file', local_path, hex(int(base))]
for section in elf.iter_sections():
name = section.name.decode('latin-1')
section = section.header
if not section.sh_flags & elftools.elf.constants.SH_FLAGS.SHF_ALLOC:
continue
gdb_command += ['-s', name, hex(base + section.sh_addr)]
gdb_command += ['-s', name, hex(int(base + section.sh_addr))]
print(' '.join(gdb_command))
# gdb.execute(' '.join(gdb_command), from_tty=False, to_string=True)

Loading…
Cancel
Save