Closed aliencaocao closed 2 months ago
the same bug: #107
@hugsy Is aware of the (bug) cause and is working on it
Oh so this is supposed to be persistent but it is a bug that it is not?
The current code is not behaving as it should, so it is a bug.
As you can see, the libc and JSON files are already included, but it fails to find the path....
@aliencaocao can you test a simple crappy fix?
cd ~/.config/gef-extras/scripts/libc_function_args/tables
wget https://www.gnu.org/software/libc/manual/text/libc.txt.gz
~/.config/gef-extras/scripts/libc_function_args/tables/generate_glibc_args_json.py
file_name = "libc.txt.gz"
with this:
file_name = pathlib.Path(inspect.getfile(inspect.currentframe())).parent.resolve() / "libc.txt.gz"
with open(outfile_name, "w") as outfile:
with this:
with open(pathlib.Path(inspect.getfile(inspect.currentframe())).parent.resolve() / outfile_name, "w") as outfile:
~/.config/gef-extras/scripts/libc_function_args/__init__.py
GLIBC_FUNCTION_ARGS_CURRENT_FILE = ...
GLIBC_FUNCTION_ARGS_CURRENT_DIRECTORY = ....
with this:
GLIBC_FUNCTION_ARGS_CURRENT_FILE = pathlib.Path(inspect.getfile(inspect.currentframe())).parent.resolve()
GLIBC_FUNCTION_ARGS_CURRENT_DIRECTORY = pathlib.Path(inspect.getfile(inspect.currentframe())).parent.resolve()
This works now as expected?
I did the mods, launched gef once and saw the json written messages, then deleted the txt.gz, still same error come out. I should be expecting it to just read the existing json instead of trying to extract a new one right? The patches given does not seem to fix this for me as it still point to the txt.gz and does not check for any existing json.
If I switch to the different dir without deleting the txt.gz, it works fine but it seem to be extracting it every time i run gef which is not very necessary.
Also, when I run gef in tables
, I get file x86_64.json exists, overwrite? [y/N]
for both json.
Let's tackle this step by step.
First, I want to address the path issue, and then we'll move on to the other matters.
If we keep the files in the tables/ directory (json + tgz), everything works as you would expect, right?
(After fixing this, I'll look into ensuring that the JSON files aren't generated every time, etc.)
I was having a similar issue with the libc.txt.gz not being read from tables. I had no idea the cause, but using step 1 and 2 it fixed the issue and now properly recognizes the lic.txt.gz file in the tables directory. Also to note it does generate the x86_32 and x86_64 files in my directory every time I run gdb but it's not a big deal to me I just overwrite them every time and everything runs smooth. I did the other steps to see if it would resolve the overwrite json issue but unfortunately the json is another issue anyway.
Yes it does work if i keep the txt.gz, but that was not the reason I opened the issue as I thought the json itself should be cached and reused. Seems like this is a feature request instead of a bug then
I have to download https://www.gnu.org/software/libc/manual/text/libc.txt.gz everytime I work on a new project/switch to a different dir
This should not happen, and this is my fix :D. So yes, this part is a bug!
I want to make sure everything works well.
Can you test the latest dev versions of gef-extras and gef and let me know if everything now works as you expect, please? @aliencaocao @DimSumCodes
Related to: #109 #111 https://github.com/hugsy/gef/pull/1093
Can I close this issue?
Just checked it, works perfectly doesn't generate a new file in my active directory and doesn't have any issues referencing the files.
Same for me.
Great work on fixing this @therealdreg 🎉
Is your feature request related to a problem? Please describe. Im always frustrated when I have to download https://www.gnu.org/software/libc/manual/text/libc.txt.gz everytime I work on a new project/switch to a different dir. I hope there can be a way to read the extracted json from a fixed path in env var.
Describe the solution you'd like Use the path defined in
context.libc_args_path
ingef config
.