Commit graph

75 commits

Author SHA1 Message Date
Riccardo Schirone
4fe99052f4
build: propagate OpenSSL in CMake exports (#6284)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: NOT XVilka <notxvilka@proton.me>
2026-05-06 10:04:34 +00:00
Giovanni
daeee9ac1a
Fix ISO C23 warnings related the usage of strstr & strchr (#6182) 2026-04-08 22:04:39 +08:00
Giovanni
70fdd67278
Allow rizin tools to run as standalone binaries (#6011)
* Implement TOOL/ENVS/EXIT_STATUS for rz-test

* update readme
2026-03-11 16:24:23 +00:00
Thomas Strömberg
a65be1e6cd
Fix Illumos/Solaris platform support (#5972) 2026-02-27 13:01:40 +08:00
Ahmed Kamal
93d914bd81
Remove Global/Static variables in path.c to make it thread safe (#5148) 2025-06-13 21:34:33 +08:00
NOT XVilka
30ae60a759
Remove RAP protocol (#5046)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-03-27 00:55:06 +08:00
Rot127
29e25fd895 String/Hex-Search 2/9: Improve Unicode support.
This commit adds several improvements, updates and fixes to Unicode related logic.

- Update Unicode tables to version 16.
- Escaped strings now escape valid Unicode code points to /Uhhhhhh and invalid code points to /xhh.
- Generally applies RzStrEscOptions way more consistently. The legacy escape is still used at some places though.
- Fix inconsistencies in Unicode decoders/encoders and checkers. They now either return 0 on an invalid decode or the number of bytes the code point requires.
- Add many unit tests for Unicode related logic.
- Add helpers to check code points.

Part 2/9. Likely won't build in between parts.

Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
2025-02-22 04:12:49 +08:00
Khairul Azhar Kasmiran
9ef17a4484
socket_http_get_recursive: Free err (#4720) 2024-11-16 08:49:33 +08:00
Khairul Azhar Kasmiran
0b24a9f1fc
socket_http.c: Show curl error on failure (#4719) 2024-11-16 06:26:34 +08:00
Giovanni
db1e4993a0
Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
Ahmed_Hany
a5297b57c2
Add help and colors for rz-run -h (#4225) (#4237)
* `-l` flag for listing profile options
* `-d` for ouputing a base profile template.
* Updated relevant manpage.
2024-02-16 01:54:12 +08:00
Giovanni
4b5cd86682
Refactor how ASLR and implement rz_sys_execv using RzSubprocess (#4202) 2024-02-12 12:22:55 +08:00
Huzaifa
e82033d92c
Convert from rz_str_new to rz_str_dup (#4178) 2024-02-07 00:07:53 +08:00
Florian Märkl
6b9d56282c
Fix use-after-free of _args[0] in RzRunProfile (#4019)
Happens e.g. on `rz-run input= -- echo hello`, when echo is resolved
through PATH and _program is freed, but the pointer stays in _args[0].
2023-12-03 23:27:35 +08:00
Riccardo Schirone
3b903caa96
librz: add some initial documentation (#3782) 2023-10-13 13:46:19 +08:00
Khairul Azhar Kasmiran
6d202f1698
rz-run resolve_value: Pass single-quoted strings unaltered (#3800)
* Test whether there is error on `rizin -d`

* Make env more like local env

* Add space btw `env` and its arg

* rz-run resolve_value: Pass single-quoted strings unaltered
2023-08-29 07:24:34 +08:00
Siddharth Mishra
9ab709bc34
Improve cmd_help.yaml and fix random number generator (#3452)
* Improve cmd_help.yaml and fix a small bug
* Add support for 64bit random numbers
* Make a distinction between 32- and 64-bit PRNG
* Add documentation for new functions
* Change the RBTree test to use 32-bit random numbers
2023-04-07 20:22:01 +08:00
Giovanni
ba130cdb59
Remove TCP_NODELAY (#3443) 2023-03-31 21:44:06 +08:00
Riccardo Schirone
c4767cf1ac
Fix plugin removal and clean code (#3277)
* cmd: Fix summary of few "L" sub-commands
* util: start decluttering plugins handling

- Add Doxygen docs
- Remove unused API functions and make others internal only
- Use RzLibType enum for plugin type instead of int

* util: move dlopen/dlsym/dlclose to rz_sys
* util: make rz_lib_open/close return bool
* util: simplify rz_lib_add_handler and rz_lib_open*
* libs: implement rz_*_plugin_del to remove a plugin
* core: remove commands from RzCmd when removing plugins
* librz: call plugins 'fini' method when removing a plugin
* core/cmd: do not fail if the hashmap removal fails

When removing a group command, the inner command might have the same
name, thus it would result in trying to remove the same name twice.
Ignore it, as it is fine.

* librz: make RzCrypto plugins handling like the others
* librz/crypto: add rz_crypto_reset and use it
* librz: allocate the plugin structures before adding them
2023-01-16 13:32:46 +01:00
wargio
0eef58115b Rewritten (partially) rz_run_parseline 2022-08-22 13:50:39 +02:00
Florian Märkl
4e5857cacf
Meson refactor: collect modules in dict and centralize config (#2945)
Duplicated code for pkg-config and cmake configuration is avoided by
letting every rizin module register itself in a global dictionary
called "modules" which is then iterated in one place to perform any
shared logic, inspired by how qemu handles multiple targets in its meson
build system.

This is an almost pure refactor, so the resulting .pc/.cmake files
should be identical with the following exceptions:
- rz_reg.pc does not have plugindir anymore as rz_reg has no plugins.
- Some other modules have their dependencies in .pc files altered to be
  consistent with cmake.
2022-08-20 19:59:27 +02:00
Florian Märkl
5f97d93327 Rewrite and fix non-libuv tcp server (Rt command)
The non-libuv tcp server implementation had several issues:
* Relied on EINTR or self-connect through global vars for breaking,
  which did not work during recv() for example.
* Never retried on EINTR
* Called recv() only once, thus subject to fragmentation issues

To support breaking otherwise blocking socket calls, RzStopPipe has been
imported from chiaki (I am the sole author so I can relicense).

rz_socket_block_time() was also detected to be doing the exact opposite
than it should on Windows through the tests, and fixed.
2022-08-06 13:20:52 +02:00
Riccardo Schirone
8939fdbd7d
Use add_global_arguments instead of passing cflags/ldflags all around (#2812)
See also 66a0e22293/docs/TESTING_WITH_SANITIZERS.md (clang)
2022-07-17 21:33:51 +08:00
Giovanni
a988941bf2
Refactor thread code and add RzThreadQueue (#2683)
* Kill the thread only if is alive.
* Remove rz_th_lock_guard.
* Use rz_sys_usleep since pthread_yield/sched_yield are not portable.
* Kill threads only on error.
* Avoid killing already-dead threads.
* RzThreadFunction now returns void* and added test_thread_queue.
* Removed pthread_exit
2022-06-19 21:07:13 +08:00
Riccardo Schirone
ce6ac3e467 meson: use major/minor only in the lib soversion 2022-05-10 21:04:43 +02:00
Florian Märkl
79bf04dcf4 Fix test_run on ppc Mac OS X
These things guarded by !__POWERPC__ work perfectly fine on Mac OS X
10.5 with PowerPC, so we can only assume they were supposed to guard
only older Mac OS X versions, but abusing __POWERPC__ for this is wrong.
Error printing for posix_spawnp has also been fixed, as it does not set
errno and instead returns an errno-like value.
2022-03-29 01:50:29 +08:00
Giovanni
bfec86a12e
Add option to install sigdb systemwise and custom user location for additional signatures (#2328) 2022-02-28 14:32:38 +01:00
Riccardo Schirone
6f40dfe493
Move remaining things from shlr/ to meson subprojects (#2126)
* Move binrz meson directives to binrz/ dir

* Move rizin-shell-parser to a subproject

* Move bochs to a meson subproject

* Move rzqnx to meson subproject

* Move winkd to a meson subproject

* Move rzar to a meson subproject

* Move rzw32dbg_wrap to a meson subproject

* Move ptrace-wrap to a meson subproject

* Move rzgdb to a meson subproject

* Rename w32dbg_wrap to rzw32dbg_wrap

* Update CODEOWNERS

* Remove old references to shlr

* Move shlr/heap stuff in core and remove shlr/arm

* Move spp to a meson subproject

* Remove last references to shlr

* Remove use_webui option

* Move include files directives to librz/include/meson.build

* Move librz meson directives into librz/meson.build

* Handle d/ directories inside the specific module meson.build

* Move plugins listing to specific module meson.build

* Move rzheap to its own subproject

* Fix js linter and licenses

* Use meson.override_dependency for all rz_ modules
2021-12-22 09:20:39 +08:00
Riccardo Schirone
47e1cb8335
Provide CMake config files for CMake projects (#2057)
* Remove wrong librz.pc.in file
* Add plugindir variable to .pc files to allow easy plugin configuration
* Add CMake config files to find Rizin in CMake projects
* Add CI jobs to check cmake files
* Provide workaround for mesonbuild/meson#9702
* Use .lib suffix and no prefix on MSVC to make CMake files work
* Disable cmake files on static libraries build
2021-12-17 09:16:25 +00:00
Riccardo Schirone
64469f2811
Changes in how paths are handled (#1997)
* Remove `RIZIN_EXTRAS` because useless

Extras plugin should be treated as any other regular plugin, they should
not have their own directory. I believe we did not have anyway any
plugin using that directory.

* Do not use `<version>` in `/usr/share`

Users can only install one version of Rizin at a time anyway, thus
splitting the `/usr/share/rizin` directories does not really bring
multi-version install possible. At the same time, we stick to what's
common for other tools, which do not use version in `/usr/share`

* Move plugin directory to `/usr/lib64/rizin/plugins`
* Remove `RZ_HOME_BIN` env var because not useful anymore
* Introduce `rz_util/rz_path` to provide rizin paths
* Use `rz_path_system_sdb_types` whenever it makes sense
* Use some others `rz_path_*` functions instead of custom ones
* Use `rz_path` APIs for themes, fortunes and signatures
* Remove `rz_sys_prefix`
* Reduce the number of defines needed to handle home and system paths
* Reduce the number of `rz_path` functions
* Make the lib debug depending on log level and `RZ_LOG_DEBUG`
* Refactor a bit how directory of plugins are loaded
* Keep supporting old plugins directory for at least 0.4.0
2021-11-30 13:36:38 +08:00
Dhruv Maroo
34d345d884 Format according to clang-format-13 2021-11-25 15:44:28 +08:00
Khairul Azhar Kasmiran
906ece4211
Add asan build for clang (#1910) 2021-11-17 21:02:02 +08:00
Khairul Azhar Kasmiran
637c192145
bin.str.enc: Rename latin1 to the more generic 8bit (#1847)
* Rename `rz_str_escape_latin1()` to `rz_str_escape_8bit()`
* test_serialize_analysis.c: Change string from "latin1" to "8bit"
* `bin.str.enc`: Rename `latin1` to the more generic `8bit`
2021-10-18 12:07:52 +08:00
Anton Kochkov
022c606372 Rename RzStrEncOptions to RzStrEscOptions 2021-10-16 11:33:48 +08:00
Anton Kochkov
39613b5c16
Port C (metainformation) commands to the rzshell (#1752)
* Do not escape strings during the search
* Port `C` (metainformation) commands to the rzshell
* Improve string autodetection
* Remove `Cr` and RZ_META_TYPE_RUN
* Escape `\x1b` as `\e` character in strings
* Move string encoding options to `RzStrEncOptions` struct
* Add `esc_double_quotes` option to `RzStrEncOptions`
* Do not filter out unprintable characters for uppercase check
* Use `esc_double_quotes` when printing the string between '"' in disasm
* Use signed chars on all platforms/architectures

Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
2021-10-15 16:48:18 +08:00
Riccardo Schirone
461d73c298
Add pid/pidfile on man/rz-run and make pid option a boolean (#1741) 2021-09-23 20:35:19 +02:00
Anton Kochkov
7e276b3f09 Check pty.h functions presense in Meson 2021-08-23 18:45:22 +08:00
David CARLIER
07faec08ef
socket try to disable per process first on freebsd. (#1491)
using new api/flag available when aslr was made available on this platform.
2021-08-20 16:42:06 +02:00
pancake
c378134a80 System LIBRARY_PATH must be honored (not replaced) on HaikuOS
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2021-08-18 09:16:23 +02:00
David CARLIER
0f978dd836
HaikuOS nice() socket function detection. (#1408) 2021-08-09 13:08:23 +08:00
Anton Kochkov
2ef19a2bcb
First step to fix #1261 - remove unused libc function checkers (#1327) 2021-07-29 08:38:52 +02:00
David CARLIER
10acbb74e5
haiku build fix proposal (#1265) 2021-07-05 05:27:57 +08:00
Florian Märkl
8e97bf218f Replace rz_buf_new() by rz_buf_new_with_bytes(NULL, 0) 2021-05-30 10:53:13 +02:00
Riccardo Schirone
db04bed503
Fix autocompletion of rz- commands in rizin shell and rename wrong rz_ (#944) 2021-03-31 16:10:54 +02:00
pancake
a22ceb2de8 Add rz_file_binsh() and avoid hardcoding /bin/sh for Termux ##android (#18409)
Inspired by https://github.com/termux/termux-packages/blob/master/packages/radare2/libr-util-sandbox.c.patch
2021-03-16 16:57:32 +08:00
Riccardo Schirone
53bf5c497f SPDX Copyright text for all files based on history
- Add LICENSES directory
- Download additional licenses used
- Add .reuse directory
- Add doc about SPDX/reuse

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-03-05 19:39:15 +08:00
Riccardo Schirone
53b4537160 Introduce portable build option to use relative paths
`portable` makes rizin use paths relative to the executable binary path,
so that all resource files (e.g. SDB files) can be retrieved without
having an hard-coded prefix in the binary. By doing so, rizin
installation directory can be moved from location to location and still
work. This is useful when having a static rizin that you want to execute
on another system.

It makes sure that all PATHs defined in rz_userconf.h are just relative
to the prefix and that, in the code, the prefix is prepended to all
these paths.
2021-02-25 19:41:38 +08:00
Alexis Ehret
a470c8df93 Fix uninitialized argument value librz/socket/run.c 2021-02-21 19:55:18 +01:00
Riccardo Schirone
43e4269d34 Make use_sys_* meson option features instead of boolean
* Use the features directly as argument of `dependency`.
* Remove doc/capstone.md doc file because already in PACKAGERS.md
2021-02-12 11:08:51 +08:00
Alexis Ehret
3e03b3c966 Fix dead nested assignment librz/socket/socket.c 2021-02-02 21:47:49 +00:00