Пример #1
0
def largebins(addr=None, verbose=False):
    """
    Prints out the contents of the large bin of the main arena or the arena
    at the specified address.
    """
    main_heap = pwndbg.heap.current
    largebins = main_heap.largebins(addr)

    if largebins is None:
        return

    formatted_bins = format_bin(largebins, verbose)

    print(underline(yellow('largebins')))
    for node in formatted_bins:
        print(node)
Пример #2
0
def unsortedbin(addr=None, verbose=True):
    """
    Prints out the contents of the unsorted bin of the main arena or the
    arena at the specified address.
    """
    main_heap = pwndbg.heap.current
    unsortedbin = main_heap.unsortedbin(addr)

    if unsortedbin is None:
        return

    formatted_bins = format_bin(unsortedbin, verbose)

    print(underline(yellow('unsortedbin')))
    for node in formatted_bins:
        print(node)
Пример #3
0
def fastbins(addr=None, verbose=True):
    """
    Prints out the contents of the fastbins of the main arena or the arena
    at the specified address.
    """
    main_heap = pwndbg.heap.current
    fastbins = main_heap.fastbins(addr)

    if fastbins is None:
        return

    formatted_bins = format_bin(fastbins, verbose)

    print(underline(yellow('fastbins')))
    for node in formatted_bins:
        print(node)
Пример #4
0
def bins(addr=None):
    """
    Prints out the contents of the fastbins of the main arena or the arena
    at the specified address.
    """
    main_arena = get_main_arena(addr)
    if main_arena == None:
        return

    fastbins = main_arena['fastbinsY']
    bins = main_arena['bins']

    size_t_size = pwndbg.typeinfo.load('size_t').sizeof
    num_fastbins = int(fastbins.type.sizeof / fastbins.type.target().sizeof)
    num_bins = int(bins.type.sizeof / bins.type.target().sizeof)
    fd_field_offset = 2 * size_t_size

    print(underline(yellow('fastbins')))
    for i in range(num_fastbins):
        size = 2 * size_t_size * (i + 1)
        chain = pwndbg.chain.format(int(fastbins[i]), offset=fd_field_offset)
        print((bold(size) + ': ').ljust(13) + chain)
Пример #5
0
def bins(addr=None):
    """
    Prints out the contents of the fastbins of the main arena or the arena
    at the specified address.
    """
    main_arena = get_main_arena(addr)
    if main_arena == None:
        return

    fastbins = main_arena['fastbinsY']
    bins = main_arena['bins']

    size_t_size = pwndbg.typeinfo.load('size_t').sizeof
    num_fastbins = int(fastbins.type.sizeof / fastbins.type.target().sizeof)
    num_bins = int(bins.type.sizeof / bins.type.target().sizeof)
    fd_field_offset = 2 * size_t_size

    print(underline(yellow('fastbins')))
    for i in range(num_fastbins):
        size = 2 * size_t_size * (i + 1)
        chain = pwndbg.chain.format(int(fastbins[i]), offset=fd_field_offset)
        print((bold(size) + ': ').ljust(13) + chain)