From 9ade7068ac60e4453bc28aba0861f035a6a28976 Mon Sep 17 00:00:00 2001 From: ValekoZ Date: Sun, 2 Jun 2024 23:43:23 +0200 Subject: [PATCH] Add `?` char for perms filtering --- gef.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/gef.py b/gef.py index c70afb5ce..87cac6dfb 100644 --- a/gef.py +++ b/gef.py @@ -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])