Skip to content

Commit

Permalink
Clean some parts of the code
Browse files Browse the repository at this point in the history
Resolves:
- #1083 (comment)
- #1083 (comment)
- #1083 (comment)

Todo:
- #1083 (comment) is still
  in discussion
  • Loading branch information
ValekoZ committed Apr 14, 2024
1 parent 97b69f7 commit b98eaca
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -3528,13 +3528,12 @@ def process_lookup_path(name: str, perm: Permission = Permission.ALL) -> Optiona
err("Process is not running")
return None

matches = set()
ret = None
matches: Set[str] = set()
ret: Optional[Section] = None
for sect in gef.memory.maps:
try:
filename = pathlib.Path(sect.path).name
except:
filename = sect.path
# NOTE: There is apparently no way this line raises an exception, but if
# it does, add a `try/except` block :)
filename = pathlib.Path(sect.path).name

if name in filename and sect.permission & perm:
if ret is None:
Expand Down Expand Up @@ -10817,9 +10816,8 @@ def find_main_arena_addr() -> int:
dbg("Trying to bruteforce main_arena address")
# setup search_range for `main_arena` to `.data` of glibc
search_filter = lambda f: "libc" in pathlib.Path(f.filename).name and f.name == ".data"
dotdatas = list(filter(search_filter, get_info_files()))

for dotdata in dotdatas:
for dotdata in list(filter(search_filter, get_info_files())):
search_range = range(dotdata.zone_start, dotdata.zone_end, alignment)
# find first possible candidate
for addr in search_range:
Expand Down

0 comments on commit b98eaca

Please sign in to comment.