Skip to content

Commit

Permalink
Fix parsing the PLT on Windows
Browse files Browse the repository at this point in the history
The Unicorn Engine 1GB workaround doesn't work since `mmap` has different semantics on Windows.
  • Loading branch information
peace-maker committed Aug 13, 2024
1 parent 67678c2 commit 0a95d24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pwnlib/elf/plt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
from __future__ import division
import logging
import sys

from pwnlib.args import args
from pwnlib.log import getLogger
Expand Down Expand Up @@ -61,6 +62,9 @@ def __ensure_memory_to_run_unicorn():
This is a bug in Unicorn Engine, see: https://github.com/unicorn-engine/unicorn/issues/1766
"""
# Can only mmap files on Windows, would need to use VirtualAlloc.
if sys.platform == "win32":
return
try:
from mmap import mmap, MAP_ANON, MAP_PRIVATE, PROT_EXEC, PROT_READ, PROT_WRITE

Expand Down

0 comments on commit 0a95d24

Please sign in to comment.