gef for windows
guard-wait opened this issue · 4 comments
GEF+GDB version
GNU gdb (GDB) 10.2
Operating System
windows
Describe the issue you encountered
when I use gef by windows,I found that issue.So that I wonder if gef supports Windows?if can,what should I do?if not,can you solve this problem?
Do you read the docs and look at previously closed issues/PRs for similar cases?
No
Architecture impacted
- X86
- X64
- ARM
- ARM64
- MIPS
- MIPS64
- PPC
- PPC64
- RISCV
Describe your issue. Without a proper reproduction step-by-step, your issue will be ignored.
I don't know anything.Because I just want to do winpwn
Minimalist test case
Use this field for a minimal code to compile and spot the issue:
// compile with gcc -fPIE -pic -o my_issue.out my_issue.c
int main(){ return 0; }
You can also provide a Dockerfile if you prefer
Additional context?
- Screenshots
- Callstack
- Coredumps
- If possible and useful, please upload the binary
Hi @guard-wait
Your error indicates a binary required for gef is missing. So it's a user setup problem, unrelated to gef.
Regarding support for Windows, GEF is aimed for Linux.
There is an embryo of support for Windows - and macOS too - but very limited.
You're welcome to try it, and improve if you can.
Thanks
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You can reopen it by adding a comment to this issue.
which
fails to find the python interpreter because executables on windows can have a file extension. This is a gef problem and not a user setup problem. This isn't hard to fix:
def which(program: str) -> pathlib.Path:
"""Locate a command on the filesystem."""
for path in os.environ["PATH"].split(os.pathsep):
dirname = pathlib.Path(path)
fpath = dirname / program
if os.access(fpath, os.X_OK):
return fpath
+ if platform.system() == "Windows" and not program.endswith(".exe"):
+ return which(program+".exe")
raise FileNotFoundError(f"Missing file `{program}`")
After adding these lines I at least get gef
to successfully load. However I get an encoding error and the command line prefix is (gdb)
instead of gef
.
vs WSL:
Trying to run an executable from here in windows results in the executable running normally and some errors that it's not an ELF executable (since, of course, it's a PE executable, not an ELF executable). If I run a program that does __builtin_trap()
, I get something resembling gef's screen, but a lot of commands fail:
If I use the extra PE support script I get slightly more info but the screen is still full of kanji:
On WSL I get gef's UI, but it's bugged. I can't tell if it's because of my locale or not:
Yes, that's definitely your locale settings.