Skip to content

Commit

Permalink
Return path to cache file if not extract
Browse files Browse the repository at this point in the history
  • Loading branch information
peace-maker committed Feb 25, 2024
1 parent 3496d98 commit 5724c39
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pwnlib/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,11 @@ def asm(shellcode, vma = 0, extract = True, shared = False):
asm_hash = sha1sumhex(_encode(shellcode) + _encode(hash_params))
cache_file = os.path.join(cache_dir, asm_hash)
if os.path.exists(cache_file):
with open(cache_file, 'rb') as f:
return f.read()
if extract:
with open(cache_file, 'rb') as f:
return f.read()
else:
return cache_file

assembler = _assembler()
linker = _linker()
Expand Down

0 comments on commit 5724c39

Please sign in to comment.