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

RzSearch refactor #4762

Draft
wants to merge 60 commits into
base: dev
Choose a base branch
from
Draft

RzSearch refactor #4762

wants to merge 60 commits into from

Conversation

Rot127
Copy link
Member

@Rot127 Rot127 commented Dec 10, 2024

WIP

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

Companion PR: rizinorg/rizin-testbins#162

What happens here:
Slowly copying changes from https://github.com/Rot127/rizin/tree/rz-search-reference (which is #4742 with some comments already addressed).

Will resend to fuzz-dist when all the tests pass here.

Stuff to do (without any order)

  • Move essential changes from https://github.com/Rot127/rizin/tree/rz-search-reference / Add / (search) commands to newshell + rewrite of rz_search #4742 before starting with commands
  • Fix commands
    • Bytes search
      • Implement
      • Fix suggestions
      • Use RzBuffer
      • Document usage in book (normal, wildcards, different maps, searching with debug + don't forget to run until mapped, API).
    • String search
      • Implement
      • Fix suggestions
        • Encoding names in command arguments.
      • Name hits based on encoding.
      • Testing
        • Case insensitivity on non latin alphabets.
        • Encoding + endianess
          • RZ_STRING_ENC_IBM290
          • RZ_STRING_ENC_EBCDIC_UK
          • RZ_STRING_ENC_EBCDIC_US
          • RZ_STRING_ENC_EBCDIC_ES
          • Fix: Offset into memory, not into the utf8 string.
        • diacritics
        • Search for strings less then 4 bytes.
        • Search within buffers which have no \0 in it (non-C strings).
        • Regex search
      • Document in book (basic usage, API, usage of distance, behavior of edge cases of distance: utf8 and other encodings, diacritics), case (in)sensitive.
  • Update book (with example API implementation).
  • Implement general search IO API which doesn't require knowledge of search spaces (what rz_search_run() was before).
  • Show progress of search.
  • Use RzBuffer for byte space searches
  • search.align shoudl default to search.alignment=asm.cpu_bits/8.
  • (Optional) Allow to cancel search with ctrl + c
  • (Optional) Extend RzSearchHit to hold more complex data.
  • (Optional) Add option to define search/divide strategy.
  • (Optional) Dispatch views into IO as chunks to the find() callback.

Test plan

...

Closing issues

closes #1586

@notxvilka
Copy link

The string search is nearly done. I would propose to merge this PR after all tests are fixed and refactor the rest of the searches in another one.

This one is already huge. And the other searches will be much less complicated (due to less refactoring). Except you don't care to review all of it of course.

Yes, makes perfect sense.

@Rot127
Copy link
Member Author

Rot127 commented Jan 30, 2025

@imbillow Please pay special attention to: c882028. Please wait though until I have added the new "string guess" function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port / (search) to rzshell
5 participants