Skip to content

Commit 9ade706

Browse files
committed
Add ? char for perms filtering
1 parent 116e2be commit 9ade706

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

gef.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8791,11 +8791,23 @@ def do_invoke(self, argv: List[str]) -> None:
87918791
addr = int(argv[0], 0)
87928792
if addr >= entry.page_start and addr < entry.page_end:
87938793
self.print_entry(entry)
8794-
elif argv[0][0] in 'r-' and \
8795-
argv[0][1] in 'w-' and \
8796-
argv[0][2] in 'x-':
8797-
perms = Permission.from_process_maps(argv[0])
8798-
if entry.permission == perms:
8794+
elif argv[0][0] in 'r-?' and \
8795+
argv[0][1] in 'w-?' and \
8796+
argv[0][2] in 'x-?':
8797+
correct = True
8798+
perms_dict = [Permission.READ, Permission.WRITE,
8799+
Permission.EXECUTE]
8800+
8801+
for c, perm in zip(argv[0], perms_dict):
8802+
if c == '?':
8803+
continue
8804+
elif c == '-':
8805+
correct = correct and not entry.permission & perm
8806+
else:
8807+
correct = correct and entry.permission & perm
8808+
8809+
8810+
if correct:
87998811
self.print_entry(entry)
88008812
else:
88018813
addr = safe_parse_and_eval(argv[0])

0 commit comments

Comments
 (0)