Skip to content

Commit

Permalink
Add ? char for perms filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
ValekoZ committed Jun 2, 2024
1 parent 116e2be commit 9ade706
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -8791,11 +8791,23 @@ def do_invoke(self, argv: List[str]) -> None:
addr = int(argv[0], 0)
if addr >= entry.page_start and addr < entry.page_end:
self.print_entry(entry)
elif argv[0][0] in 'r-' and \
argv[0][1] in 'w-' and \
argv[0][2] in 'x-':
perms = Permission.from_process_maps(argv[0])
if entry.permission == perms:
elif argv[0][0] in 'r-?' and \
argv[0][1] in 'w-?' and \
argv[0][2] in 'x-?':
correct = True
perms_dict = [Permission.READ, Permission.WRITE,
Permission.EXECUTE]

for c, perm in zip(argv[0], perms_dict):
if c == '?':
continue
elif c == '-':
correct = correct and not entry.permission & perm
else:
correct = correct and entry.permission & perm


if correct:
self.print_entry(entry)
else:
addr = safe_parse_and_eval(argv[0])
Expand Down

0 comments on commit 9ade706

Please sign in to comment.