Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix path syscall-args search #107

Closed
wants to merge 1 commit into from
Closed

fix path syscall-args search #107

wants to merge 1 commit into from

Conversation

therealdreg
Copy link
Collaborator

Description/Motivation/Screenshots

fix syscall-args path search

How Has This Been Tested ?

"Tested" indicates that the PR works and the unit test (i.e. make test) run passes without issue.

  • x86-32
  • x86-64
  • ARM
  • AARCH64
  • MIPS
  • POWERPC
  • SPARC
  • RISC-V

Checklist

  • My code follows the code style of this project.
  • My change includes a change to the documentation, if required.
  • If my change adds new code,
    adequate tests have been added.
  • I have read and agree to the
    CONTRIBUTING document.

@therealdreg therealdreg requested a review from hugsy April 19, 2024 10:02
@therealdreg therealdreg self-assigned this Apr 19, 2024
@therealdreg therealdreg added this to the 2024.05 milestone Apr 19, 2024
path = CURRENT_DIRECTORY / "syscall-tables"
self["path"] = (str(path.absolute()),
"Path to store/load the syscall tables files")
caller_frame = inspect.stack()[0]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to using prefer pathlib.Path(__file__)

"Path to store/load the syscall tables files")
caller_frame = inspect.stack()[0]
path = caller_frame.filename
path = os.path.join(os.path.dirname(os.path.abspath(path)), "syscall-tables")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, prefer pathlib over legacy os.path

@hugsy
Copy link
Owner

hugsy commented Apr 22, 2024

From @therealdreg

Repro:

root@fr33project:~# bash -c "$(curl -fsSL https://gef.blah.cat/sh)"
root@fr33project:~# wget -q -O- https://github.com/hugsy/gef/raw/main/scripts/gef-extras.sh | sh

image

Re-posting reply here for tracking:

I could reproduce your issue. there is a problem, but your PR doesn't solve it, it 's just a side effect of it. the problem is that the setting is overwritten by its default value when it shouldn't be
basically all values are overwritten by their default
tbh that may be tricky to solve quickly, so what I'd suggest you is simply make a gef restore to force reloading the .gef.rc

This PR fixes the visible side-effect rather than the root cause of the issue. One possible way to address this would be to force gef restore once the setting gef.extra_plugins_dir is changed to a different value. This will fix the issue this PR tries to fix, because the setting is originally correctly set by the gef-extras.sh install script.

@therealdreg
Copy link
Collaborator Author

thx for your research @hugsy

@hugsy hugsy mentioned this pull request Apr 22, 2024
4 tasks
hugsy added a commit to hugsy/gef that referenced this pull request Apr 23, 2024
## Description

This PR fixes some issues in the setting loading process resulting in
the default value always being taken for gef-extras scripts (as
underlined by hugsy/gef-extras#107

`GefSetting` now offers the possibility to trigger a callback,
`on_changed` which behaves just like `on_write` but only if the value
was changed.
therealdreg added a commit to therealdreg/gef-extras that referenced this pull request Apr 23, 2024
therealdreg added a commit that referenced this pull request Apr 23, 2024
fix path issues scripts glibc syscalls #106 #107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants