mmap ¤
Functions:
-
prot_str_to_val
–Heuristic to convert PROT_EXEC|PROT_WRITE to integer value.
-
flag_str_to_val
–Heuristic to convert MAP_SHARED|MAP_FIXED to integer value.
-
parse_str_or_int
–Try parsing a string with one of the parsers above or by converting it to
-
mmap
–
Attributes:
parser module-attribute
¤
parser = ArgumentParser(
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"
)
prot_dict module-attribute
¤
flag_dict module-attribute
¤
flag_dict = {
"MAP_SHARED": 1,
"MAP_PRIVATE": 2,
"MAP_SHARED_VALIDATE": 3,
"MAP_FIXED": 16,
"MAP_ANONYMOUS": 32,
}
prot_str_to_val ¤
Heuristic to convert PROT_EXEC|PROT_WRITE to integer value.
flag_str_to_val ¤
Heuristic to convert MAP_SHARED|MAP_FIXED to integer value.
parse_str_or_int ¤
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.