hugsy / gef-extras

Extra goodies for GEF to (try to) make GDB suck even less
https://hugsy.github.io/gef-extras
MIT License
148 stars 50 forks source link

`gef-extras` Automatic Installation Fails #102

Closed CuckooEXE closed 1 month ago

CuckooEXE commented 5 months ago

Bug Report

Step 1: Describe your environment

Step 2: Describe your problem

Automatic installation of gef-extra fails, because the latest_tag defaults to a version where libc.txt.gz doesn't exist in the repository.

Steps to reproduce

  1. On a fresh system, install gef with bash -c "$(curl -fsSL https://gef.blah.cat/sh)" and gef-extras with wget -q -O- https://github.com/hugsy/gef/raw/main/scripts/gef-extras.sh | sh
Installation Output ```bash @CuckooEXE ➜ ~ $ wget -q -O- https://github.com/hugsy/gef/raw/main/scripts/gef-extras.sh | sh Cloning into '/home/codespace/.config/gef-extras'... remote: Enumerating objects: 1302, done. remote: Counting objects: 100% (367/367), done. remote: Compressing objects: 100% (134/134), done. remote: Total 1302 (delta 272), reused 238 (delta 229), pack-reused 935 Receiving objects: 100% (1302/1302), 1.80 MiB | 22.71 MiB/s, done. Resolving deltas: 100% (707/707), done. Note: switching to 'a669c30255a98a101e6c6883a8a071d3d5286a22'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false Requirement already up-to-date: retdec-python in ./.local/lib/python3.8/site-packages (from -r /home/codespace/.config/gef-extras/requirements.txt (line 1)) (0.5.2) Requirement already up-to-date: pygments in ./.local/lib/python3.8/site-packages (from -r /home/codespace/.config/gef-extras/requirements.txt (line 2)) (2.17.2) Requirement already up-to-date: rpyc in ./.local/lib/python3.8/site-packages (from -r /home/codespace/.config/gef-extras/requirements.txt (line 3)) (5.3.1) Requirement already up-to-date: keystone-engine in ./.local/lib/python3.8/site-packages (from -r /home/codespace/.config/gef-extras/requirements.txt (line 4)) (0.9.2) Requirement already up-to-date: capstone in ./.local/lib/python3.8/site-packages (from -r /home/codespace/.config/gef-extras/requirements.txt (line 5)) (5.0.1) Requirement already up-to-date: unicorn in ./.local/lib/python3.8/site-packages (from -r /home/codespace/.config/gef-extras/requirements.txt (line 6)) (2.0.1.post1) Requirement already up-to-date: ropper in ./.local/lib/python3.8/site-packages (from -r /home/codespace/.config/gef-extras/requirements.txt (line 7)) (1.13.8) Requirement already satisfied, skipping upgrade: requests in /usr/lib/python3/dist-packages (from retdec-python->-r /home/codespace/.config/gef-extras/requirements.txt (line 1)) (2.22.0) Requirement already satisfied, skipping upgrade: plumbum in ./.local/lib/python3.8/site-packages (from rpyc->-r /home/codespace/.config/gef-extras/requirements.txt (line 3)) (1.8.2) Requirement already satisfied, skipping upgrade: filebytes>=0.10.0 in ./.local/lib/python3.8/site-packages (from ropper->-r /home/codespace/.config/gef-extras/requirements.txt (line 7)) (0.10.2) GEF for linux ready, type `gef' to start, `gef config' to configure 88 commands loaded and 5 functions added for GDB 9.2 in 0.00ms using Python engine 3.8 file libc.txt.gz cannot be found. download it from https://www.gnu.org/software/libc/manual/text/libc.txt.gz Traceback (most recent call last): File "/home/codespace/.config/gef-extras/scripts/libc_function_args/tables/generate_glibc_args_json.py", line 56, in fh = gzip.open(file_name, "r") File "/usr/lib/python3.8/gzip.py", line 58, in open binary_file = GzipFile(filename, gz_mode, compresslevel) File "/usr/lib/python3.8/gzip.py", line 173, in __init__ fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'libc.txt.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/codespace/.config/gef-extras/scripts/libc_function_args/tables/generate_glibc_args_json.py", line 63, in sys.exit(-1) File "~/.gef-.py", line 446, in FakeExit RuntimeWarning [+] 42 extra commands added in 0.32 seconds [+] Configuration saved to '/home/codespace/.gef.rc' @CuckooEXE ➜ ~ $ gdb GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word". GEF for linux ready, type `gef' to start, `gef config' to configure 88 commands loaded and 5 functions added for GDB 9.2 in 0.00ms using Python engine 3.8 file libc.txt.gz cannot be found. download it from https://www.gnu.org/software/libc/manual/text/libc.txt.gz Traceback (most recent call last): File "/home/codespace/.config/gef-extras/scripts/libc_function_args/tables/generate_glibc_args_json.py", line 56, in fh = gzip.open(file_name, "r") File "/usr/lib/python3.8/gzip.py", line 58, in open binary_file = GzipFile(filename, gz_mode, compresslevel) File "/usr/lib/python3.8/gzip.py", line 173, in __init__ fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'libc.txt.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/codespace/.config/gef-extras/scripts/libc_function_args/tables/generate_glibc_args_json.py", line 63, in sys.exit(-1) File "~/.gef-.py", line 446, in FakeExit RuntimeWarning [+] 42 extra commands added in 0.34 seconds gef➤ quit ```

Minimalist test case

N/A

Observed Results

Expected results

Conclusion

Anyway, I think you just need to bump up the latest release tag so it installs properly

hugsy commented 5 months ago

It's not a bug, just an unwanted error which doesn't affect the loading part. As you can see at the end, all extra plugins were successfully loaded.

[+] 42 extra commands added in 0.34 seconds

We might silent this warning soon.

CuckooEXE commented 5 months ago

Ah, okay, I didn't read that file closely enough. It doesn't really matter to run this script, since you package the two .json files in the repo anyway. Makes sense to me. The only thing I'd say that still makes this an issue is that it prints out every time you run gdb, which is a little annoying.

My $0.02: definitely silence the error and just print a nicely worded warning, since I definitely thought gef didn't install properly.

Regardless, thanks for the speedy response (and merges on my two other PRs).