Mmap
flag_dict = {'MAP_SHARED': 1, 'MAP_PRIVATE': 2, 'MAP_SHARED_VALIDATE': 3, 'MAP_FIXED': 16, 'MAP_ANONYMOUS': 32}
module-attribute
¶
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description='\nCalls the mmap syscall and prints its resulting address.\n\nNote that the mmap syscall may fail for various reasons\n(see `man mmap`) and, in case of failure, its return value\nwill not be a valid pointer.\n\nPROT values: NONE (0), READ (1), WRITE (2), EXEC (4)\nMAP values: SHARED (1), PRIVATE (2), SHARED_VALIDATE (3), FIXED (0x10),\n ANONYMOUS (0x20)\n\nFlags and protection values can be either a string containing the names of the\nflags or permissions or a single number corresponding to the bitwise OR of the\nprotection and flag numbers.\n\nExamples:\n mmap 0x0 4096 PROT_READ|PROT_WRITE|PROT_EXEC MAP_PRIVATE|MAP_ANONYMOUS -1 0\n - Maps a new private+anonymous page with RWX permissions at a location\n decided by the kernel.\n\n mmap 0x0 4096 PROT_READ MAP_PRIVATE 10 0\n - Maps 4096 bytes of the file pointed to by file descriptor number 10 with\n read permission at a location decided by the kernel.\n\n mmap 0xdeadbeef 0x1000\n - Maps a new private+anonymous page with RWX permissions at a page boundary\n near 0xdeadbeef.\n')
module-attribute
¶
prot_dict = {'PROT_NONE': 0, 'PROT_READ': 1, 'PROT_WRITE': 2, 'PROT_EXEC': 4}
module-attribute
¶
flag_str_to_val(flagstr)
¶
Heuristic to convert MAP_SHARED|MAP_FIXED to integer value.
mmap(addr, length, prot=7, flags=34, fd=-1, offset=0, quiet=False, force=False)
¶
parse_str_or_int(val, parser)
¶
Try parsing a string with one of the parsers above or by converting it to an int, or passes the value through if it is already an integer.
prot_str_to_val(protstr)
¶
Heuristic to convert PROT_EXEC|PROT_WRITE to integer value.