File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ to determine which section it belongs to, or the permissions of the sections to
1616 - filter by address -> parses the next argument as an integer or asks gdb to interpret the value
17172 . ` -n ` / ` --name ` :
1818 - filter based on section name
19+ 2 . ` -p ` / ` --perms ` :
20+ - filter based on section permissions
19213 . If nothing is specified, it prints a warning and guesses the type
2022
2123![ vmmap-grep] ( https://github.com/hugsy/gef/assets/11377623/a3dbaa3e-88b0-407f-a0dd-07e65c4a3f73 )
Original file line number Diff line number Diff line change @@ -668,24 +668,15 @@ def from_info_mem(cls, perm_str: str) -> "Permission":
668668 @classmethod
669669 def from_filter_repr (cls , filter_str : str ) -> List ["Permission" ]:
670670 perms = [cls (0 )]
671- if filter_str [0 ] == "r" :
672- for i in range (len (perms )):
673- perms [i ] |= Permission .READ
674- elif filter_str [0 ] == "?" :
675- for i in range (len (perms )):
676- perms .append (perms [i ] | Permission .READ )
677- if filter_str [1 ] == "w" :
678- for i in range (len (perms )):
679- perms [i ] |= Permission .WRITE
680- elif filter_str [1 ] == "?" :
681- for i in range (len (perms )):
682- perms .append (perms [i ] | Permission .WRITE )
683- if filter_str [2 ] == "x" :
684- for i in range (len (perms )):
685- perms [i ] |= Permission .EXECUTE
686- elif filter_str [2 ] == "?" :
671+
672+ for k in range (3 ):
687673 for i in range (len (perms )):
688- perms .append (perms [i ] | Permission .EXECUTE )
674+ p = cls (1 << (2 - k ))
675+ if filter_str [k ] == "rwx" [k ]:
676+ perms [i ] |= p
677+ elif filter_str [k ] == "?" :
678+ perms .append (perms [i ] | p )
679+
689680 return perms
690681
691682
You can’t perform that action at this time.
0 commit comments