1. gdb 的打印内存 alais
  2. flat in pwntools

gdb 的打印内存 alais

我想要快速的计算这一段内存的减去一个偏移的大小

pwndbg> x/30gx   0x7ffff7dd06e0
0x7ffff7dd06e0 <_IO_file_jumps>:        0x0000000000000000      0x0000000000000000
0x7ffff7dd06f0 <_IO_file_jumps+16>:     0x00007ffff7a869c0      0x00007ffff7a87730
0x7ffff7dd0700 <_IO_file_jumps+32>:     0x00007ffff7a874a0      0x00007ffff7a88600
0x7ffff7dd0710 <_IO_file_jumps+48>:     0x00007ffff7a89980      0x00007ffff7a861e0
0x7ffff7dd0720 <_IO_file_jumps+64>:     0x00007ffff7a85ec0      0x00007ffff7a854c0
0x7ffff7dd0730 <_IO_file_jumps+80>:     0x00007ffff7a88a00      0x00007ffff7a85430
0x7ffff7dd0740 <_IO_file_jumps+96>:     0x00007ffff7a85370      0x00007ffff7a7a180
0x7ffff7dd0750 <_IO_file_jumps+112>:    0x00007ffff7a861a0      0x00007ffff7a85b70
0x7ffff7dd0760 <_IO_file_jumps+128>:    0x00007ffff7a85970      0x00007ffff7a85340
0x7ffff7dd0770 <_IO_file_jumps+144>:    0x00007ffff7a85b60      0x00007ffff7a89af0
0x7ffff7dd0780 <_IO_file_jumps+160>:    0x00007ffff7a89b00      0x0000000000000000

以数组形式打印内容

p *(double(*)[144])udata

然后用 python lambda + map 处理偏移

flat in pwntools

flat in pwntools

参数可以是 list tuple string。能够以字典形式设置偏移

filter
Space between pieces of data is filled out using the iterable filler. The n’th byte in the output will be byte at index n % len(iterable) byte in filler if it has finite length or the byte at index n otherwise.

length
If length is given, the output will be padded with bytes from filler to be this size. If the output is longer than length, a ValueError exception is raised.