Commit graph

634 commits

Author SHA1 Message Date
Khairul Azhar Kasmiran
04ff3f3af5
Fix #2288: Clear ds->opstr on pdf '..' (#2294)
* Fix #2288: Clear `ds->opstr` on pdf '`..`'
* Base test output
* Fix cmd_pd2 test
* Fix elf/reloc test
* Fix cmd_af test
2022-02-08 18:03:43 +01:00
Riccardo Schirone
2c02457109
Convert o commands to rzshell (#2281) 2022-02-07 18:23:31 +01:00
chinggg
95be95e89a
Add floating point support to math operations (#2287) 2022-02-07 11:18:22 +01:00
Giovanni
687b8e8fec
Rename functions properly and ensure to remove the old flags. (#2289)
* Rename functions properly and ensure to remove the old flags.
* Rename flag instead of deleting it
* When renamed, the flags are not set in the right flag space.

This reverts commit bf39802452b7545551f52c4c32f8c01764ab2a75.
2022-02-06 22:21:21 +08:00
wargio
1b98f63b6c Fixed tests 2022-02-06 12:08:16 +01:00
Florian Märkl
bd98b8c28e Add asm.cmt.il and refactor asm.cmt.esil
asm.cmt.esil was handled in a somewhat peculiar way, printing below the
disassembly if asm.cmt.right=0, even though every other comment is
printed above. Now it is more in line with all other commenting and the
new asm.cmt.il works in the same way.
2022-02-05 21:50:48 +01:00
Anton Kochkov
2f638cad1e Convert f commands to rzshell
* Changed behavior of `f` to only add flag if there is none
* Changed behavior of `f+` to add flag in any case
* Moved listing subcommands from `f` to `fl`
* Moved listing subcommands from `f.` to `f.l`
* Added subcommand `f.l*` to list all local flags in all functions
* Listing flags at the current offset became `fl.`
* Moved `f=` to `fl=`
* Old `fl` (flag length) now became `fL`
* Removed original `fe` commands
* Old `f?` (check if flag exists) now became `fe`
* Removed `fV` commands
* Removed `fn` commands in favor of `fl` and `asm.flags.real=true`
* Removed `fS` commands (`fSo` and `fSn`)
* `fo` became `fortune` and moved from "flags" to "shell" category
* Removed oldshell handlers of the `z` commands
2022-02-03 21:46:42 +08:00
Dhruva Gole
64740dd2d3
Add power/exponent to math operations (#2220) 2022-01-27 14:49:19 +01:00
GustavoLCR
66d6bb9438
Fix OOB write in rz_str_unescape() if last char is \ (#2238) 2022-01-24 17:06:41 +08:00
Giovanni
afe1dc3bae
[FLIRT] Add sigdb details and fixed bugs #2223 2022-01-20 17:19:40 +01:00
Florian Märkl
f9e01ba07d [RzIL] Rewrite RzAnalysisRzil as RzAnalysisILVM with config
RzAnalysisILVM wraps around the low-level RzILVM and enables emulation
of real code from disassembly, rather than raw IL.
Analysis plugins now don't actively initialize the vm anymore, but
return a fully declarative description RzAnalysisILConfig of how to set
up the vm and optionally its initial state.
This also enables multiple IL vms to exist at the same time as plugins
can not mess with the global vm anymore. See the added integration test
for an example.
2022-01-17 16:50:40 +01:00
Florian Märkl
65efe6699c [RzIL] Make aezs and aezse stop on error 2022-01-17 16:50:40 +01:00
Khairul Azhar Kasmiran
50638dfb19
Simplify pt boundaries test using ..( (#2213) 2022-01-15 17:19:40 +08:00
Anton Kochkov
538ffe3739 Convert fs commands to rzshell 2022-01-15 09:11:40 +08:00
Riccardo Schirone
0d415bc346
Delete ESIL stack memory after type propagation (#2207) 2022-01-14 16:52:39 +00:00
Florian Märkl
6ba0f3a091 [RzIL] Make aezsu stop on invalid ops 2022-01-14 17:24:35 +08:00
Florian Märkl
5be9fa2f0f [RzIL] Update flags on init and step 2022-01-14 17:24:35 +08:00
Riccardo Schirone
6c2ee73fe7
Convert 'ob' commands to rzshell (#2201)
* Use API instead of 'oba' command in rizin.c
* Fix tests and use API instead of 'ob' commands
2022-01-14 08:45:16 +00:00
Khairul Azhar Kasmiran
4a9d3f2438
Fix #2135: Add ..( command (#2184)
* Fix #2135 - Add `..(` command
* Use `RZ_LOG_ERROR` instead of `eprintf` inside `macro_call()`
* Improve `(?`
2022-01-13 18:10:23 +08:00
Riccardo Schirone
afc635f6d1
Convert om commands to rzshell (#2192)
* removal of `omo` command
* use of `oml`, `oml.` and `oml=` to list maps instead of `om`
* removal of RIZIN output from `oml`
* removal of `omn.` and just assume `omn` uses core->offset
2022-01-11 17:29:20 +01:00
Florian Märkl
cd938d2083 Add -I (IL lifting) option to rz-asm
$? is also set to the return value of a command run by ! for testing
this.
2022-01-10 19:27:09 +01:00
Anton Kochkov
4487d7e1ac Port fd commands to the rzshell 2022-01-08 10:59:10 +08:00
Anton Kochkov
d80d70a361 Port fz commands to the rzshell 2022-01-08 10:59:10 +08:00
Paul I
dd6de07c96
Convert ac commands to rzshell (#2160) 2022-01-08 10:58:43 +08:00
GustavoLCR
2e065789a7
Fix #1377 - Handle forward definitions in PDB parser 2022-01-05 18:38:02 +08:00
Florian Märkl
b338949dd4 [RzIL] Fix PC initialization and instruction fetch
Intruction was fetched from possibly outdated RzIL PC.
2022-01-03 17:18:33 +01:00
Florian Märkl
9938a85c4b
[RzIL] Add RzReg/Variable Binding (#2155)
Plugins do not create register-based variables themselves anymore, but
they are derived from the register profile. However not all registers
may be bound and not all variables may be actual registers. The concrete
relations between an RzILVM and registers is described by an
RzILRegBinding object. It is simply a list of register names and
variables are created of the same names. When stepping with aezs, the
registers are synchronized automatically. From now on, aezv is primarily
useful for debugging, but interacting with emulation from the user side
should be done with ar.
2022-01-02 17:56:19 +00:00
Anton Kochkov
9c18ea0dc6
Port ft commands to the rzshell (#2162) 2022-01-03 00:33:01 +08:00
Khairul Azhar Kasmiran
e0fe262360
Show error if no-arg macro is called with args (#2161) 2022-01-03 00:26:36 +08:00
Pedro-Bernardo
4f9fe46b34
Fix optype-to-string conversion (#2158) 2022-01-01 01:35:29 +08:00
Paul I
f8d222e138
Convert ah commands to rzshell (#2130) 2021-12-30 12:44:51 +08:00
Paul I
6fca51c6cb
Convert afn commands to rzshell (#2139)
* Convert afn commands to rzshell
* Remove oldshell help for afn
2021-12-27 18:19:01 +01:00
Florian Märkl
1a2afca338
Fix Double Free in Cs without a Bin File 2021-12-26 15:23:31 +08:00
Anton Angelov
00fe25867b
Fix x86 disassembly issues related to MASM syntax (#2123) 2021-12-24 16:58:12 +01:00
Giovanni
5963da2bba
[RzIL] Add loadw/storew and bind memories against RzBuffer (#2105)
* [RzIL] Load/Store via RzIO and RzBuffer
* [RzIL] LoadW/StorWe via RzIO and RzBuffer
Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-12-24 16:53:20 +01:00
Anton Kochkov
89d61756c1
Fix self-referential typedef format (#2134) 2021-12-24 00:53:36 +08:00
wargio
e80968f031 [FLIRT] verify the name is always unique. 2021-12-23 17:06:55 +01:00
wargio
d92a708541 [FLIRT] add info extraction 2021-12-23 17:06:55 +01:00
wargio
5dafbf7e67 [core] aezv - modify variables in RzIL VM 2021-12-21 19:50:17 +01:00
wargio
869a36d55b [core] Add aezsu - RzIL step until addr 2021-12-21 19:50:17 +01:00
Florian Märkl
9b60670013 Prepare various RzReg accesses for splitting
Common accesses for both debug and analysis must not use
debug->reg or analysis->reg, but go through rz_core_reg_default().
2021-12-21 13:14:08 +01:00
Florian Märkl
affe8c89e1 Make fs+ trim whitespace of the arg
Previously, `fs+ myname` would use the flagspace " myname" with a
leading space. This made .arf inconsistent with setting regs-flags from
C and the syntax `fs+myname` would not be allowed in the future with
newshell anyway.
2021-12-21 13:14:08 +01:00
Giovanni
84b226e895
[Core] Integration of Rizin SigDB in aaa and add aaF (#2120) 2021-12-20 23:47:32 +01:00
Giovanni
d6625126d5
[FLIRT] pac to pat (#2116) 2021-12-19 13:42:00 +01:00
Khairul Azhar Kasmiran
b1c3595c6b
newshell help: Remove brackets from list tail (#2114) 2021-12-18 09:54:10 +01:00
Riccardo Schirone
9465cca0f5 Replace AES code with Nettle one which is LGPLv3
Code taken from https://git.lysator.liu.se/nettle/nettle and placed in
its own subproject.
2021-12-17 09:18:47 +01:00
Paul I
d2302facd6
Remove oldshell handlers from cmd_analysis.c (#2106)
* Remove oldshell handlers for `afb` commands
* Remove oldshell handlers for `afB` command
* Remove oldshell handlers for `afs` commands
* Remove oldshell handlers for `afu` command
* Remove oldshell handlers for `afx` commands
* Remove oldshell handlers for `afS` command
* Remove oldshell handlers for `afv` commands
* Add missing `afvb-*`/`afvr-*` and update tests
* Move <delete all> feature out from `analysis_function_vars_del()`
2021-12-16 11:18:40 +08:00
Giovanni
57f83bd657
[FLIRT] Create signatures from RzAnalysis data (#2036)
Add pac and sig creation with options & compression via commands and via new rz-sign
Add missing arch (arc, pic, riscv, spc700 xtensa, and more)

Side note:
on other tools public functions and references are generated in a sequential 
way besides the first one which is the first to be assigned.
since we do not search for sequential references, then we can avoid to
add extra public or referenced functions

Extra:
* Refactoring rz_analysis_mask definition
* Add rz_str_startswith_const and rz_list_iter_get_next_data
2021-12-15 19:08:16 +01:00
Khairul Azhar Kasmiran
298f92cf56
newshell help: Start arg numbering from 1 (#2107) 2021-12-15 23:53:04 +08:00
Paul I
5914b79982
Convert afl/afi commands to rzhell (#2040)
* Convert afl/afi commands to rzhell
* Reuse code
* Update tests
2021-12-14 17:49:16 +08:00
Florian Märkl
96a85e573e Remove ESIL Pins (#2096)
ESIL Pins were an untested feature to run a command when emulation hit a
specific address. This can be solved in other ways, e.g. scripting.
Project version 7 has been introduced for this change.
2021-12-12 18:27:34 +01:00
Giovanni
bda1e9cfca
Disable GPL code and Add RISC-V support via Capstone 5 (#2087)
* -Duse_gpl=false is supported by rizin and added riscv_cs for capstone v5
* Added GPL build workflow in CI
2021-12-11 13:30:01 +01:00
Anton Kochkov
8c1ef7672b
Remove unused and untested PPC GNU target (#2090) 2021-12-10 19:40:22 +01:00
Anton Kochkov
715dd14811
Remove unused, unupdated and largely untested ARM WineDBG and GNU (Binutils) plugins (#2085)
* Remove WineDBG ARM RzAsm plugin
* Remove unused and untested ARM GNU target
2021-12-10 16:40:58 +01:00
Khairul Azhar Kasmiran
5b6aaed68d
Fix optional brackets termination of newshell help (#2077) 2021-12-09 10:58:54 +01:00
Khairul Azhar Kasmiran
3ff8effa4c
Improve slightly dte test (#2075) 2021-12-07 22:30:05 +08:00
Florian Märkl
3c2e4bf63a
Rewrite ar and dr with newshell (#2006)
* Show group-level details of commands

Details can be defined at either a group command or its subcommand of
the same name. If define on group-level it will also be shown in the
group help without needing ??.

* Fix > $ redirection for errored command and leak

* Rewrite ar and dr commands with newshell

Breaking changes:
ar* => arf, ar- => arf-, ar. => ar*
ar, => art, ar? => arq
ar0 => ara0, arb => arab, ars => araS
arC => arpC
arn => arR
art => arT
arf => arF
Removed: drm, aer
2021-12-06 19:02:43 +01:00
Rot127
40ca3d7672
Check for plugin ESIL support before running ESIL code in aaa. (#2039)
* Check for plugin ESIL support before running ESIL code.
* Set ESIL flag for riscv analysis plugin.
2021-11-27 23:22:14 +08:00
GustavoLCR
ba5adf0045 Fix wrong buffer size reporting with shm:// 2021-11-26 13:21:34 +08:00
GustavoLCR
8a1e58db82 Fix #1758: Add support for shm:// on Windows
* Move `shm://` test out of `not-windows-any`
2021-11-26 13:21:34 +08:00
Dhruv Maroo
0801f7adf6
Port c commands to newshell (#1854)
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2021-11-25 17:55:08 +05:30
billow
46533d41eb
EBCDIC character support (#1643) 2021-11-22 09:48:57 +08:00
Florian Märkl
5757c37cee
Use rz_analysis_get_address_bits() in pxr and fix asserts (#2002) 2021-11-21 12:19:33 +01:00
Giovanni
446a56929b
[FLIRT] Improvements and added pac support & tests (#1992)
* Enforce architecture type on sig, files
* Added terminal output when calling zfs to display the number of matches 
* Added pac support
* Added tests
2021-11-18 18:47:29 +01:00
Khairul Azhar Kasmiran
906ece4211
Add asan build for clang (#1910) 2021-11-17 21:02:02 +08:00
Florian Märkl
a96edeb0c6
Disambiguate cmd_b/cmd_B for case-insensitive fs (#1987) 2021-11-16 10:56:58 +00:00
Giovanni
87311c3759
Basefind (#1966)
Co-authored-by: gnole <olegbouchin@gmail.com>
2021-11-15 22:33:38 +01:00
Giovanni
9c830435d6
Fix #1952 - Implement iR <hashes> (#1979) 2021-11-15 14:30:48 +01:00
Riccardo Schirone
9ee830054b
RzShell: convert wh command to shell/which (#1964) 2021-11-12 11:42:58 +01:00
Giovanni
f41ea3c284
[FLIRT] Refactoring and create rz_sign library (#1960) 2021-11-11 20:29:59 +01:00
Riccardo Schirone
589ab9299c Fix tests after more rigid wx 2021-11-09 12:01:41 +01:00
Riccardo Schirone
b9382426ee RzCmd: print RzCmdStateOutput only if command returns OK 2021-11-05 11:58:24 +01:00
Riccardo Schirone
a1ce0f8dd7 RzShell: convert o- commands to rzshell
* Remove o-*h because it was the same as o--
* Remove o-! because not used
* Remove unread test case because it was not doing anything (o-fd did
  not work)
2021-11-05 11:58:24 +01:00
Aswin C
4ec188d219
Refactor APIs related to themes and remove global variables from cmd_eval (#1879)
* Refactor `rz_core_theme_nextpal()`

* Add tests for `ecp`, `ecn` and `ecoj`

* Add braces to avoid declaration after the label

* Use `RzCmdStateOutput` in `eco`

* Fix the output of the test for `ecoj`

* Introduce `RzConsPalSeekMode` and refactor `nextpal_item`

* Rename the APIs related to themes

* Rename `rz_core_get_theme` to `rz_core_theme_get`
* Rename `rz_core_load_theme` to `rz_core_theme_load`
* Rename `rz_core_list_themes` to `rz_core_theme_list`

* Add `curtheme` to `RzCore`

* Eliminate all global variables in cmd_eval.c

* Put the loop outside the `switch` in
  `rz_cmd_eval_color_load_theme_handler`
* Remove `getNext` variable and use the `RzListIter`'s `p` variable

* Sort the list of loadable themes

* Use a normal `strcmp` as the comparator function while sorting themes
2021-10-29 20:25:00 +08:00
Riccardo Schirone
3e4660650c
RzShell: add autocompletion for @@ iterator operators, @@., @@=, etc. (#1896)
* RzShell: add autocompletion for @@ iterator operators, @@., @@=, etc.
* Update help for @@ii
* Fix test for @@?~?
2021-10-29 00:11:45 +08:00
Riccardo Schirone
0a5b00edd2 Fix all db/cmd tests 2021-10-27 09:31:50 +02:00
Anton Kochkov
8fab461328
Port g (egg/shellcode) commands to the rzshell (#1744) 2021-10-25 22:15:38 +08:00
Florian Märkl
8de3870d5c
Rewrite most of the bFLT bin plugin (#1863) 2021-10-23 17:45:54 +00:00
Aswin C
54b6e53feb
Convert ec to the rzshell (#1809)
* Convert `ec` to the rzshell
* Port the `echo` command
* Make the `color` argument optional for `ecHw`
* Remove `rz_core_echo`
* Make `echo` a part of `e` commands
* Add tests for `eco` and `ecHw`
* Move the definition of `bool2status` to `cmd_eval.c`
* Fix `ecHj` and add a test for it
2021-10-22 13:33:35 +08:00
Anton Kochkov
1e53cb7f8a Add few missing Windows types 2021-10-20 09:57:33 +02: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
Khairul Azhar Kasmiran
cb46249098
Rename Csa to Csb (#1844) 2021-10-16 15:50:59 +08:00
Anton Kochkov
9ac3e8f263 Add Csp command to add Pascal strings 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
Theofilos Pechlivanis
2f181b9053
Fix #469 by checking the value of analysis.jmp.cref (#1594) 2021-10-13 14:32:47 +02:00
Heersin
e0d3d6bc66
New RZIL integration (#1663)
The new intermediate language is based on the BAP (Binary Analysis Platform) Core Theory.
It operates on SMT-like bitvectors and their arrays to represent values and memory.
Apart from that, it has also representation for the data and code side effects.
2021-10-09 18:14:44 +08:00
Basstorm
19a6a929f9
Rewrite PDB parser ##bin (#1517)
* Rewrite PDB parser to become endianess-independent
* Use type pretty-printing API
* Use `RzCmdStateOutput` instead of `RzOutputMode` to solve invalid JSON issue
* Move PDB-related print functions to `cpdb.c`
* Use flag API instead of calling commands from the code
* Separate printing from parsing and applying the type information
* Delete useless `main.c`
2021-10-09 16:57:29 +08:00
Dhruv Maroo
afd1bab3c0
Port db commands to newshell (#1777)
* Add `db` commands in `cmd_debug.yaml`

* Use bool instead of int as return value

* Port `db` commands to newshell

* Fix integration tests. Use `db- <addr>`, instead of `db-<addr>`

* Fix `dbW` handler and update `rz_w32_add_winmsg_breakpoint`

* Remove checks for `argc` in `cmd_debug.c` (from review)

* Fix failing Windows tests

* Change control flow in conditional expressions

* Use `RzCmdStateOutput` in handler for `dbt` to print backtrace in various formats

* Use forward slash (/) instead of pipe (|) for command descriptions

* Use output modes for printing breakpoints in `db` handler

* Remove extra newline while printing breakpoints in JSON format

* Change description for `dbc` command

* Update descriptions and handlers; Remove <addr> argument wherever necessary

* Use `RZ_CMD_ARG_TYPE_CHOICES` for perm in `dbw`

* Add details for `dbC` and `dbw`

* Add quiet printing mode for breakpoints

* Remove unnecessary <addr> argument for `db` commands

 * Also add a quiet output mode for `dbl` and `dbt`

* Return if no breakpoint found in function `add_breakpoint`

* Update tests for new `db` commands

* Update `db` command descriptions

 * Remove `dbi.` redundant command
 * Add details for iterating through the list of breakpoints

* Extract `rz_debug_bp_add_noreturn_func` into `debug.c` as RZ_API

* Fix `dbil` handler and `dbg_bps` test

* Shift the noreturn function breakpoint to `cdebug.c`

* Format according to clang-format

* Fix failing integration tests

 * TODO: Find why `db- @@c:dblq` is failing, and fix the bug

* Update `db` commands

* Use `db- @@c:dblq` instead of `db-*`

 * This will also work as a test for command edits (see https://github.com/rizinorg/rizin/pull/1806)
2021-10-08 21:40:51 +05:30
Riccardo Schirone
291c6e9e9a
Add RzBinResource type and use it to print resources (#1804) 2021-10-08 16:47:04 +08:00
Dhruv Maroo
d6ac6b93ef
Fix changing rflags register using dr (#1794)
* Use the numerical value string as parameter of `rz_core_debug_reg_set()`
* Add test for changing rflags using dr
* Add test for changing rflags using ar
2021-10-04 17:51:38 +08:00
Khairul Azhar Kasmiran
bf847a5db1
Add pt-boundaries test (#1791) 2021-10-03 17:31:35 +08:00
Dhruv Maroo
4f8100cd97
Extend the pretty printing API for base types and other printers (#1781)
* Replace `rz_type_db_base_type_as_string` with `rz_type_db_base_type_as_pretty_string`

 * Use the new type pretty printing API to pretty print base types

* Add option to return newline terminated string by pretty printing API

 * Add `RZ_TYPE_PRINT_END_NEWLINE` option to RzTypePrintOpts

* Improve printing in cases of empty structs/unions/enums

 * Initially, the separator was printed between the curly breaces
   irrespective of whether the struct/union/enum is empty. Now the
   separator is not printed if the given type is empty

* Add pretty printing support for typedefs

 * Also, add another type printing option to show typedefs. To be used in
   `rz_cores_types_typedef_as_c`

* Refactor `.*_as_c` functions to use the new type pretty printing API

* Add tests for typedef and `unknown_t` for pretty printing API

* Add `rz_type_db_base_type_as_string` back. Update tests.

 * Use ternary operator to make expression more concise

* Add doxygen documentation for `rz_type_db_base_type_as_string`

* Use `rz_vector_len` to determine if empty, instead of convoluted logic

* Remove redundant `RZ_NONNULL` for RzTypeDB

* Fix integration tests for type printing

* Update Doxygen documentation

* Fix failint enum printing itegration tests

* Fix according to clang-format
2021-10-02 13:51:01 +05:30
Anton Kochkov
458095d7a0
Fix afvd command for compound types (#1786) 2021-10-02 11:00:14 +08:00
Giovanni
e224ee7b28
Add demangling as plugins and libdemangle as external dependency (#1656)
* Added demangling as plugins and libdemangle as external dependency
* Added iDl to return the list of demanglers
* moved demangling tests into rz-libdemangle and keep only bin tests
2021-10-01 10:45:38 +00:00
Anton Kochkov
8f1aab7243
Added crc32 and entropy values (#1774)
Co-authored-by: wargio <wargio@libero.it>
2021-10-01 16:35:10 +08:00
Khairul Azhar Kasmiran
300714c38c
rz_utf8_decode(): Declare overlong encodings as invalid UTF-8 (#1764) 2021-09-29 09:25:03 +08:00
Dhruv Maroo
178701f721
Reduce registers shown in the output of dr and Vpp when analysing an ARM64 executable (#1739)
* Add function to check if a register is a system register

* Only checks for ARM64 system registers as of now

* Check for system registers in ARM64 when printing registers using "dr"

* Does not completely remove the unnecessary register, but removes a
  huge number of useless registers printed by "dr"

* Rename `RZ_REG_TYPE_ALL` to `RZ_REG_TYPE_ANY`

* ADd register types for "sys" and "pauth": `RZ_REG_TYPE_SYS` and
  `RZ_REG_TYPE_PAUTH` respectively

* Remove `rz_reg_is_system_reg`

* Add `sys` and `pauth` register profiles

* Update debug tests to account for new arenas and register profiles

* REplace "pauth" with "sec" reg profile

* Update integration tests to account for new register profiles: `sys`, `sec`
2021-09-28 23:49:55 +08:00
Alexis Ehret
01b6e60775
Refactor elf plugin interface (#1728)
* get_sdb
* check_buffer
* load_buffer
* baddr
* boffset
* binsym
* entries
* headers
* create
* fields
2021-09-28 13:36:46 +08:00
Dhruv Maroo
63ccf386f2
Type pretty printing API (#1678)
* Reduce duplicate code and use a single printing API for all sorts of
  printing requirements
2021-09-27 17:30:35 +00:00
Anton Kochkov
aac743beb1
Port y (yank) commands to the rzshell (#1734)
* Port `y` (yank) commands to the rzshell
* Add very basic yank unit tests

Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
2021-09-27 13:27:41 +08:00
Florian Märkl
d116fe3bdc Refactor macho relocs patching and convert to vfiles 2021-09-26 10:45:40 +02:00
Dhruv Maroo
2c48a91d13
Add serialization functionality for breakpoints (#1574)
* Migrate project from v5 to v6
* Add serialization for debug (RzDebug) instance (only for breakpoints as of now)
* Replace commit hash once the PR is merged into dev
* Add new namespaces added in v6
2021-09-24 12:30:28 +00:00
Aswin C
2c4601f762
Convert pm to rz-shell (#1686)
* Add a test for `pmj` and remove an unwanted newline
2021-09-24 09:08:09 +00:00
Paul I
15409562c9
Port ax commands to newshell (#1655)
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2021-09-23 22:05:57 +00:00
Riccardo Schirone
1c90b4698e
Fix pimm/cimm opex printing in ARM instructions (#1730)
* Fix pimm/cimm opex printing in ARM instructions
* Add test for opex cimm/pimm in ARM
2021-09-23 09:39:14 +02:00
Florian Märkl
65d567282b
Remove length restrictions in analysis classes and various serializations (#1718) 2021-09-18 16:48:14 +02:00
Luca Borzacchiello
f211163b70
UTF-16 be, UTF-32 be support (#1535)
* Refactored string search

string search logic moved from librz/bin/bfile.c to
librz/util/str_search.c

* UTF-16BE and UTF-32BE support

* Decoupled rz_str_search with rz_bin

* Changed parameter order in rz_scan_strings

* Fixed needle reset in rz_string_search

Now when the string search fails, needle is restored to original_needle+1,
i.e., we continue the searching process starting from the next byte.

* Changed heuristic for UTF BE detection

one more byte in for the detection (6 instead of 5)

* Fixed unit test in str_search

* Refactored rz_scan_strings and better UTF16-LE and UTF16-BE detection

Now if there is an ambiguity between UTF16-LE and UTF16-BE, we take the
longest one.

* Changed UTF BE heuristic

If there is any ambiguity about big-endian or little-endian, always
choose little endian

* Small format fixes in str_search

* Added preferred endianess switch in RzUtilStrScanOptions

* Fixed str_search regression tests
2021-09-17 16:37:35 +08:00
Anton Kochkov
9377b16951
Add some missing Windows types (#1693) 2021-09-15 20:20:33 +08:00
Khairul Azhar Kasmiran
086701e7de
Move pt UTC timezone tests out of archos/ (#1668)
* Move `pt` UTC timezone tests out of `archos/`
* Do Windows hack if `__OpenBSD__`
2021-09-13 22:51:00 +08:00
Anton Kochkov
34f7d44bfd Parse comments in types definitions 2021-09-13 20:42:31 +08:00
Khairul Azhar Kasmiran
f70a4da1d2
Add UTC timezone to timestamps (#1639) 2021-09-11 23:29:16 +08:00
Giovanni
4ededd5577
Remove yank test where we alloc 2 GB of ram for no reason (#1652)
Yank allocs 1GB via malloc(size) and then allocs another GB via RzBuffer
2021-09-10 22:17:42 +02:00
Anton Kochkov
818a8ec835 Fix Windows functions test 2021-09-10 16:54:42 +08:00
Anton Kochkov
565bbf034d Add tests for rz_type*_as_string() functions 2021-09-10 16:54:42 +08:00
Anton Kochkov
c9f9aea292 Fix enum printing 2021-09-09 20:46:27 +08:00
Riccardo Schirone
5d6667abf5 Fix function pointers printing in complex types 2021-09-09 20:46:27 +08:00
Aswin C
dba3fb0197
Use PJ in config_print_node() (#1488)
* Remove `cb_printf` from `RzConfig`
* Rename `rz_config_list` to `rz_core_config_print_all`
* Remove `rz_cmd_eval` and run clang-format
2021-09-09 13:46:08 +02:00
Riccardo Schirone
0ac5330828
Implement t* and remove tn* because not needed/working 2021-09-08 00:23:41 +08:00
Anton Kochkov
b7dd650f62 Fix type name parsing in tc and tcd 2021-09-08 00:22:34 +08:00
Anton Kochkov
ecb5d4472e Bump Project version to 5, add unknown_t 2021-09-07 17:34:25 +08:00
Anton Kochkov
5009f9b669 Add missing Windows types 2021-09-06 12:18:58 +08:00
Anton Kochkov
a523314fa7 Add unknown_t type 2021-09-06 12:18:58 +08:00
Riccardo Schirone
1c78aee3cd
Convert i commands to rzshell (#1238)
* Start to create some RzBinObject specific API

Adding some unit tests

Fix for new relocs storage system

Fix test_bin unit test for oob-write

* Add `iA` command to newshell

Add `ie`/`iee` commands

Add support for `is`/`iE` commands

Add support for `ii` command

Add support for `il` command

Add support for `iM` command

Add support for `ir` command

Add support for `iS`/`iSS` commands

Add support for `iz` command

Add support for `i` command

Add support for `ic` command

Add support for `iC` command

Add support for `ih` and `iHH` commands

Add support for `iI` command

Add support for `iL` command

Fix descriptions of commands already converted

Add support for `idp` commands

Add support for `iD` command

Add support for `im` commands

Add support for `iR` command

Add support for `it` command

Add support for `iV` commands

Add support for `iw` command

Add support for `ix` commands

Add support for `iZ` command

Add support for `ik` command

Add support for `is.` command

Add support for `iS.` command

Reduce arguments in print_arch

Few Doxygen and ownership annotations

Add support for `iS=` command

Add support for `izz` and `izzz` commands

Add support for `ib` command

Add support for `ic*` command

Put section flags as the last field of the table

* Proper language detection.

* Rewritten blang.c

* implemented `icc/icm/icf <class name>`

* ignore blocks when printing langs

Remove num from `iA` output

* Fixed flags on java and added class column

Add support for `ia` commands

Fix `iCj` command

* RzBin: add rz_bin_object_sections_mapping_list API

* Fix rz-bin for new API

Remove unused va var in rz-bin.c

Fix `iA`/`-A` output

* implemented classdump_cpp

* Support namespaces

Use `icc`, `icl` does not exist anymore

Update output of broken tests for `icc`

Add `rz_return_*()` asserts in new `*_print()` functions

* Provide rz_core_bin_print API

* Select which parts to print also based on the mode

* Return bool from all `rz_core_bin_*_print()` API

* Use RzBinFile in new `rz_core_bin_*_print()` API

* Restore `dbg_dmi` test

* Remove oldshell handlers for `i` commands

* Remove `ieq` call in rizin, not needed

* Allow NULL `bf` in `rz_cmd_info_handler()`

* Re-add support for RZ_BIN_PREFIX for symbols/sections/segments/imports/relocs

* Move `ib` command to `obR`

* Show 'N/A' in `i` command when info are not available

* Assert on bf->o, just to be sure

* Make error messages clearer in `idp` commands

Co-authored-by: wargio <wargio@libero.it>
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2021-09-04 22:37:05 +08:00
Anton Kochkov
b5e037b149
Add missing Windows LDAP types (#1566) 2021-09-02 00:22:59 +08:00
Khairul Azhar Kasmiran
04a094a2e3
Fix #1416: Fix dte (#1545) 2021-08-29 15:45:20 +02:00
GustavoLCR
b84158fd3e
Fixes for value analysis (#1520)
* Fill `op->reg` for ARM64 `br`/`blr` analysis
* This fixes software single-stepping on `br`/`blr` instructions on ARM64
* Fill `op->reg` for ARM `bx`/`blx` analysis
* This fixes software single-stepping on `bx`/`blx` instructions on ARM
* Set `bx` as `RZ_ANALYSIS_OP_TYPE_RJMP`
* Fill `RzAnalysisValue->type`
* Use only `RzAnalysisValue` in `rz_core_link_stroff()`
* Fill `op->ireg/disp/scale` for ARM `ldr` analysis
* This fixes software single-stepping for `ldr pc` on ARM
* Fix riscv inverted src/dst values for store instructions
* Fix riscv analysis with buffer of size 2
* Add unit tests for `RzAnalysisOp` and `RzAnalysisValue`

Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2021-08-27 22:07:39 +08:00
Basstorm
cabe45edf6
Report an error when global variable does not exist (#1525) 2021-08-25 13:14:10 +00:00
Anton Kochkov
6510ce4fb5
Enable Travis CI PPC tests (#1250)
* Enable Travis CI PPC tests
* Fix endianess for buffer reads in `pf`
* Fix `tpv` test

Co-authored-by: wargio <wargio@libero.it>
2021-08-25 00:02:47 +08:00
Sylvain Pelissier
3b20861ef7 Reset certificate search properly (#18664) ##search 2021-08-18 17:22:13 +02:00
Sylvain Pelissier
92b7e9321a Correct MOVD instruction and SSE registers definition (#18437)
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2021-08-18 09:16:23 +02:00
Giovanni
984e9728d3
Various fixes on Java, icc/ic and dex rewrite (#1455)
* rewritten dex parser
* rewritten java demangler
* javas/javac returns demangled comments
* converted code to use new rz_buf_read_le* apis
* Added ownership & doxygen 
* Removed useless dex hack
2021-08-17 21:52:11 +02:00
pancake
cef781411a Use RNum.math in "?b" to make '?b 1<<1' work ##shell 2021-08-17 12:03:29 +02:00
pancake
c7d530cb07 Honor < and > comparison operators in RNumMath ##shell (#18979) 2021-08-17 12:03:29 +02:00
pancake
e4906bc452 Remove colons in "?" number conversion output ##shell 2021-08-17 12:03:29 +02:00
Basstorm
8d54707ccf
New global variable concept (#1407)
* Add global var concept
* Doxygen & ownership & delete `delete_all` & argc check
* Use RBTree to manage the address of global variable
* Kill comment and access & use ht_pp_new
* Add unit test and regressions test
* Remove GlobalVarNode
* Implement global variable [de]serialization
* Moved `rz_cmd_state_output_array_start`
* Added complex type tests
* delete/get at or in address & convert type links to global variable & minor fix
* Remove `size` field
* Migration of typelinks to global var
* Use exists type parser
* Recover typelink unit test
2021-08-11 15:23:29 +02:00
Giovanni
31fc5fbf22
Converting ph commands to rzshell ##shell (#1415)
* Converting `ph` commands to rzshell
* Use `@!` for changing the block size
2021-08-10 00:50:55 +08:00
Basstorm
e451b22d92
Convert av command to newshell (#1405) 2021-08-06 16:16:11 +08:00
Riccardo Schirone
ae46f69366
core/serialize_core: exclude restoring of scr.prompt (#1398)
Restoring scr.prompt might break rz-pipe if you open a project from
within rz-pipe. Exclude scr.prompt so that it is not set to true in such
cases.
2021-08-05 16:52:01 +08:00
Khairul Azhar Kasmiran
c70e29a565
Adjust prc brightness weight slightly (#1401) 2021-08-04 23:24:38 +08:00
GustavoLCR
c9acf440cf
Reorganize map skyline segments 2021-08-03 22:44:38 +08:00
Pulak Malhotra
f32d2c4e15
Fix #1391 (#1393)
* Fix #1391

* Update librz/core/ctypes.c

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>

* Added test

* Remove not needed check

Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2021-08-02 19:55:26 +05:30
Giovanni
8fe4d0b0a5
Convert ! commands to newshell (#1235)
* Updated core_plugin_example.c
* Removed RZ_BYTES and RZ_BLOCK
Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2021-07-28 10:33:33 +02:00
Alexis Ehret
632b0f2b99 Add better warning messages librz/bin/format/elf/* 2021-07-23 15:11:34 +02:00
Anton Kochkov
816d57111b
Do not offer ESIL if not actually support it (#1343) 2021-07-21 18:08:52 +08:00
Paul I
93be07803a
Fix some typedb related memleaks (#1339) 2021-07-21 01:51:54 +08:00
Anton Kochkov
17f10fe106 Add test for type print less than block 2021-07-20 20:50:07 +08:00
Anton Kochkov
495a24705e Add test fo pointers inside structures 2021-07-20 20:49:19 +08:00
Anton Kochkov
3c59df7e98
Refactor RzTypes to use structs instead of SDB + New Tree-Sitter based C Parser (#1047)
- Removed oldshell version of `t` (types) commands
- Removed `tk` command because types storage switched to the hashtable
- Added `tfc` command to show the calling convention of the function or set it
- Added `tsl` (RZ_OUTPUT_MODE_LONG) to show structure members' sizes and offsets
- Added `tul` (RZ_OUTPUT_MODE_LONG) to show union members' sizes
- Switched the types storage to the hashtable instead of SDB
- Added load and export from/to SDB for standard type libraries and serialization for Projects
- Changed all `char *type` occurences to the proper `RzType`
- Added `RzCallable` type for the function/class method types
- Changed all function types API to use the `RzCallable` API
- Switched the function types (`RzCallable`) storage to the hashtable instead of SDB
- Added a connection between `RzAnalysisFunction` and `RzCallable` - `rz_analysis_function_derive_type()` API function to derive new `RzCallable` type from the `RzAnalysisFunction` even if it doesn't exist in the RzTypeDB.
- Moved type links to the RzAnalysis where they belong
- Removed TCC and MPC-based parsers
- Added Tree-Sitter-based parser for C grammar (see `librz/type/parser/*`)
- Reworked type databases in `librz/analysis/d/` to be consistent with C standard, libc, platform-specific definitions
- Switched the type links from `char *` to `RzType`
- Switched the type links from SDB to the hashtable
- Added concept of the "type paths", e.g. `a.b[20].c` where `b` is a member of `a` (`a` is either structure or a union) and `c` is a member of `b`, and `b` is an array where we take 20-th element.
- Added concept of the typeclasses (a bit similar to Haskell) for numerical types: `None` (the most generic one), `Num` (includes `Integral` and `Floating`), `Integral` (includes `Signed Integral` and `Unsigned Integral`), `Floating`.
- Added concept of type equality (`rz_types_equal(a, b)` API function)
- Added Doxygen documentation to every API function in the `librz/type/*`.
- Updated the project format from **V2** to **V3**, added migration.
2021-07-20 01:46:45 +08:00
Aswin C
8a09fdcbd5
Convert pt to newshell ##newshell (#1319)
* Convert `pt` to newshell
* Remove the old shell code and handlers of `pt`
2021-07-19 22:55:54 +08:00
Alexis Ehret
f43cc01b99 Refactor symbols and imports loading ##refactor 2021-07-19 12:20:42 +08:00
Anton Kochkov
703eab5405
Remove ESIL CFG and DFG (#1304) 2021-07-14 21:49:55 +02:00
GustavoLCR
cb9dc46887
Fix #1171 - Fix incorrect variable detection for push [esp + var] (#1292) 2021-07-12 16:14:32 +08:00
GustavoLCR
146d3b5d4f
Reduce analysis recursion (#1284)
* Reduce recursion when analyzing function control-flow
* Jump table refactoring
* Use rz_ prefix for the API
* Use struct instead of long parameter list
* Add `analysis.jmp.tblmax` to configure maximun amount of cases to analyze
* Remove recursion
2021-07-10 13:52:31 +02:00
Riccardo Schirone
c8c98ecce3
Full table header line (#1239)
* Fully print last column header separator
* Fix table unit tests
* Fix tests
2021-06-28 17:25:25 +08:00
Anton Kochkov
de48cc521d
Cleanup of RzLang (#1206) 2021-06-10 10:24:49 +02:00
Florian Märkl
24c4f6cc09
Remove all PJEncodings (#1200) 2021-06-09 15:47:49 +02:00
Alexis Ehret
33d4d081bf
Import refactor split format elf (#1187)
* Move rz_bin_elf_is_executable to a new file ##refactor

* Add documentation rz_bin_elf_is_executable ##doc

* Move rz_bin_elf_has_relro to a new file ##refactor

* Add documentation rz_bin_elf_has_relro ##doc

* Refactor rz_bin_elf_has_relro ##refactor

* Move rz_bin_elf_convert_symbol to a new file ##refactor

* Add documentation rz_bin_elf_convert_symbol ##doc

* Refactor rz_bin_elf_convert_symbol ##refactor

* Move rz_bin_elf_has_nx to a new file ##refactor

* Add documentation rz_bin_elf_has_relro ##doc

* Refactor rz_bin_elf_has_nx ##refactor

* Move rz_bin_elf_get_section to a new file ##refactor

* Add documentation rz_bin_elf_get_section ##doc

* Refactor rz_bin_elf_get_section ##refactor

* Add rz_bin_elf_is_relocatable function ##refactor

* Move rz_bin_elf_get_sections to a new file ##refactor

* Add documentation rz_bin_elf_get_sections ##doc

* Refactor get_sections_from_shdr ##refactor

* Refactor get_sections_from_dt_dynamic ##refactor

* Move rz_bin_elf_get_section_offset to a new file ##refactor

* Add documentation rz_bin_elf_get_section_offset ##doc

* Move rz_bin_elf_get_section_addr to a new file ##refactor

* Add documentation rz_bin_elf_get_section_addr ##doc

* Move rz_bin_elf_get_section_addr_end to a new file ##refactor

* Add documentation rz_bin_elf_get_section_addr_end ##doc

* Move section_flag_to_rzlist to a new file ##refactor

* Add documentation section_flag_to_rzlist ##doc

* Refactor section_flag_to_rzlist ##refactor

* Move section_type_to_string to a new file ##refactor

* Add documentation section_type_to_string ##doc

* Refactor section_type_to_string ##refactor

* Move rz_bin_elf_get_baddr to a new file ##refactor

* Add documentation rz_bin_elf_get_baddr ##doc

* Refactor rz_bin_elf_get_baddr ##refactor

* Move rz_bin_elf_get_boffset to a new file ##refactor

* Add documentation rz_bin_elf_get_boffset ##doc

* Refactor rz_bin_elf_get_boffset ##refactor

* Move rz_bin_elf_get_init_offset to a new file ##refactor

* Add documentation rz_bin_elf_get_init_offset ##doc

* Refactor rz_bin_elf_get_init_offset ##refactor

* Move rz_bin_elf_get_init_offset to a new file ##refactor

* Add documentation rz_bin_elf_get_fini_offset ##doc

* Refactor rz_bin_elf_get_fini_offset ##refactor

* Move rz_bin_elf_get_entry_offset to a new file ##refactor

* Refactor rz_bin_elf_get_entry_offset ##refactor

* Move rz_bin_elf_get_main_offset to a new file ##refactor

* Add documentation rz_bin_elf_get_main_offset ##doc

* Refactor rz_bin_elf_get_main_offset ##refactor

* Move rz_bin_elf_get_stripped to a new file ##refactor

* Add documentation rz_bin_elf_get_stripped ##doc

* Refactor rz_bin_elf_get_stripped ##refactor

* Move rz_bin_elf_interp to a new file ##refactor

* Add documentation rz_bin_elf_intrp ##doc

* Refactor rz_bin_elf_intrp ##refactor

* Move rz_bin_elf_is_static to a new file ##refactor

* Add documentation rz_bin_elf_is_static ##doc

* Refactor rz_bin_is_static ##refactor

* Move rz_bin_elf_get_data_encoding to a new file ##refactor

* Add documentation rz_bin_elf_get_data_encoding ##doc

* Refactor rz_bin_elf_get_data_encoding ##refactor

* Refactor rz_bin_elf_has_va ##refactor

* new file
* add documentation

* Move rz_bin_elf_get_arch to a new file ##refactor

* Add documentation rz_bin_elf_get_arch ##doc

* Refactor rz_bin_elf_get_arch ##refactor

* Move rz_bin_elf_get_abi to a new file ##refactor

* Add documentation rz_bin_elf_get_abi ##doc

* Refactor rz_bin_elf_get_abi ##refactor

* Move rz_bin_elf_get_cpu to a new file ##refactor

* Add documentation rz_bin_elf_get_cpu ##doc

* Refactor rz_bin_elf_get_cpu ##refactor

* Move rz_bin_elf_get_head_flag to a new file ##refactor

* Add documentation rz_bin_elf_get_head_flag ##doc

* Refactor rz_bin_elf_get_head_flag ##refactor

* Move rz_bin_elf_get_machine_name to a new file ##refactor

* Add documentation rz_bin_elf_get_machine_name ##doc

* Refactor rz_bin_elg_get_machine_name ##refactor

* Move rz_bin_elf_get_file_type to a new file ##refactor

* Add documentation rz_bin_elf_get_file_type ##doc

* Refactor rz_bin_elf_get_file_type ##refactor

* Move rz_bin_elf_get_elf_class to new file ##refactor

* Add documentation rz_bin_elf_get_elf_class ##doc

* Refactor rz_bin_elf_get_elf_class ##refactor

* Move rz_bin_elf_get_bits to a new file ##refactor

* Add documentation rz_bin_elf_get_bits ##doc

* Refactor rz_bin_elf_get_bits ##refactor

* Move rz_bin_elf_get_osabi_name to a new file ##refactor

* Add documentation rz_bin_elf_get_osabi_name ##doc

* Refactor rz_bin_elf_get_osabi_name ##refactor

* Move rz_bin_elf_grab_regstate to a new file ##refactor

* Add documentation rz_bin_grab_regstate ##refactor

* Refactor rz_bin_elf_grab_regstate ##refactor

* Move rz_bin_elf_is_big_endian to a new file ##refactor

* Move rz_bin_elf_get_rpath to a new file ##refactor

* Add documentation rz_bin_elf_get_rpath ##refactor

* Refactor rz_bin_elf_get_rpath ##refactor

* Move rz_bin_elf_get_libs to a new file ##refactor

* Add documentation rz_bin_elf_get_libs ##refactor

* Refactor rz_bin_elf_get_libs ##refactor

* Move rz_bin_elf_convert_import to a new file ##refactor

* Move rz_bin_elf_get_fields to a new file ##refactor

* Add documentation rz_bin_elf_get_fields ##doc

* Refactor rz_bin_elf_get_fields ##refactor

* Move rz_bin_elf_free to a new file ##refactor

* Add documentation rz_bin_elf_free ##doc

* Refactor rz_bin_elf_free ##refactor

* Add rz_bin_elf_get_layout RZ_IPI ##refactor

* Add rz_bin_elf_is_sh_index_valid RZ_IPI ##refactor

* Move rz_bin_elf_new_buf to a new file ##refactor

* Add rz_bin_elf_init_ehdr RZ_IPI ##refactor

* Add rz_bin_elf_init_phdr RZ_IPI ##refactor

* Add rz_bin_elf_init_shdr RZ_IPI ##refactor

* Add rz_bin_elf_init_shstrtab RZ_IPI ##refactor

* Add rz_bin_elf_init_dynstr RZ_IPI ##refactor

* Add rz_bin_elf_init_strtab RZ_IPI ##refactor

* Add rz_bin_init_dynamic_section RZ_IPI ##refactor

* Add rz_bin_elf_init_notes RZ_IPI ##refactor

* Add rz_bin_elf_get_version_info_gnu_verneed RZ_IPI ##refactor

* Add rz_bin_elf_get_version_info_gnu_verdef RZ_IPI ##refactor

* Add rz_bin_elf_get_number_of_dynamic_symbols RZ_IPI ##refactor

* Add rz_bin_elf_get_version_info_gnu_versym RZ_IPI ##refactor

* Move rz_bin_elf_get_sp_val to a new file ##refactor

* Add documentation rz_bin_elf_get_sp_val ##doc

* Refactor rz_bin_elf_get_sp_val ##refactor

* Move rz_bin_elf_p2v(_new) to a new file ##refactor

* Move rz_bin_elf_v2p(_new) to a new file ##refactor

* Move rz_bin_elf_compiler to a new file ##refactor

* Add documentation rz_bin_elf_compiler ##doc

* Refactor rz_bin_elf_compiler ##refactor

* Remove unused function definition ##refactor

* Move rz_bin_elf_get_relocs to a new file ##refactor

* Add documentation rz_bin_elf_get_relocs ##refactor

* Move elf_write to deprecated file ##refactor

* Add rz_bin_elf_set_import_by_ord.inc, rz_bin_elf_get_import_addr rZ_IPI ##refactor

* Add rz_bin_elf_symbol_type_to_str RZ_IPI ##refactor

* Add rz_bin_elf_symbol_bind_to_str RZ_IPI ##refactor

* Add rz_bin_elf_get_symbols_with_type_from_phdr RZ_IPI ##refactor

* Add rz_bin_elf_get_symbols_from_phdr RZ_IPI ##refactor

* Move rz_bin_elf_get_symbols to a new file ##refactor

* Move rz_bin_elf_get_imports to a new file ##refactor

* Refactor elf plugin architecture
2021-06-07 11:02:51 +08:00
Anton Kochkov
2c691b91e3
Disable unnecessary io.cache in tests (#1190) 2021-06-04 15:06:02 +02:00
Florian Märkl
bf5b9c41be Remove defunct Dyldcache Xtr Plugin 2021-05-31 12:13:23 +02:00
Aswin C
6c7d508c9e
Convert pg commands to newshell (#1152)
* Use `RZ_CMD_ARG_TYPE_FILE` in all the `dir` tags for `dts`
* Convert `pg` commands to newshell
* Add cmd_print.yaml to the corresponding meson.build
* Add tests for `pgm`, `pg*` and `pg-*`
* Run cmd_descs_generate.py and update cmd_descs.c
2021-05-24 12:59:48 +08:00
Giovanni
f3e5b38794
Add hexview on rz-diff (#1148) 2021-05-22 02:13:20 +08:00
Khairul Azhar Kasmiran
c4c4789dc1
iI: Set bits to asm.bits if flat binary (#1153) 2021-05-20 22:24:35 +08:00
Basstorm
5f27ed6300
Add missing registers for dwarf reg mapping in x86 (#1151) 2021-05-19 19:34:46 +02:00
Giovanni
1348c247df
Add graph diffing and better function diffing (#1131)
* Added function diffing and graph diffing (json and dot only)
* Added tests for new functions and graph diffing
* diff graph more clear
* enforce same colors everywhere.
* using realsize for calculating function size
* renaming unconditional jump color name
* fixed memory issues and weird behaviour
2021-05-18 14:49:53 +02:00
Theofilos Pechlivanis
ec3bde4c8e
Fix grep cmd when used with neg and begin ~!^ (#1143)
* Fix grep cmd when used with neg and begin `~!^`
* Add test ##test
2021-05-18 11:46:12 +02:00
Florian Märkl
58433a72ac Remove now-obsolete io.cache check for ELF Reloc Patching and add more Tests 2021-05-17 17:23:19 +08:00
Florian Märkl
a0729d4d80 Implement Full Reloc Patching for ELF in Virtual Files 2021-05-17 17:23:19 +08:00
Florian Märkl
7b63cb72ed Add RzBinVirtualFile 2021-05-17 17:23:19 +08:00
Anton Kochkov
fb8937b500
Fix L tests for Windows platform (#1139) 2021-05-17 16:17:11 +08:00
Theofilos Pechlivanis
07b937e235 Print the rizin plugin info in json ##print ##json
* Implement `aLj` in cmd_analysis.c ##print ##json
* Replace `,` with a `:` in `Loj` json ##test
* Replace `L` and `Lj` with `Ll` and `Llj` ##test
* Add tests for rz plugin json cmds ##print ##json
* List BinLdrPlugins for `Lij` ##print ##json
* Add spaces to represent no authors for `Li` ##test
* Convert `L` and `Ll` to newshell
* Convert `La` and `Laj` to newshell
* Move `Ll` handler to `clang.c`, rename `La` handler ##print ##json
* Convert `Lc` to newshell ##print ##json
* Convert `Ld` cmd to newshell ##print ##json
* Add `Laq` cmd test ##test
* Convert `Lh` to newshell and fix `La` check ##print ##json
* Fix `Lh` and convert `Li` cmd to newshell ##print ##json
* Convert `Lo` to newshell and modify `Lh` ##print ##json ##test
* Convert `Lp` to newshell ##print ##json ##test
* Use newshell cmd for `aL` ##print ##json
* Fix `Li`, lowercase json properties, add tests ##print ##json ##test
* Fix `Ld` and add `Lds` to set dbg backend ##print ##json ##test
* Revert `oL` and `aL` and replace `Lds` with `Ld` ##print ##json
* Use newshell for `obL`
* Replace `lang->cb_printf` with `rz_cons_printf`
* Replace `bin->cb_printf` with `rz_cons_printf` ##print
* Use `rz_lang_list()` instead of cmd0 ##print
* Set `Lo` and `Loj` tests as broken ##test
2021-05-17 13:38:11 +08:00
sandrabeme
bdface85a2 Switch iI command to use RzTable API
* Implement `rz_table_transpose()`
* Switch `iI` command to use RzTable API
2021-05-16 00:15:32 +08:00
Aswin C
0aa1ff92c4
Mark the test for pg as broken (#1129) 2021-05-14 01:22:32 +08:00
Aswin C
a363b7303a
Introduce rz_core_gadget_print() API to print visual gadgets (#1122)
* Introduce `rz_core_gadget_print` API to print gadgets

* Use the API at all instances where the rz_core_cmd was used

* Add a test and doxygen styled documentation for the API
2021-05-13 23:52:02 +08:00
Florian Märkl
840f880ceb Track RzBinFiles in RzCoreFile 2021-05-08 13:04:10 +02:00
Anton Kochkov
4f541c7cd7
New string information API (#1068) 2021-05-06 19:43:49 +08:00
Florian Märkl
88eaf90b9c Fix Confusion of Reloc Source and Target Addresses
old RzBinReloc.vaddr contained either the reloc address or
the target address, depending on how the bin was loaded.
Now there are two members and dedicated query function for each.
2021-05-05 21:54:36 +08:00
Giovanni
82e7917294
Refactoring Hash (#1082)
* Added authors and licenses and plugin access to crypto related files
* removed `rz_hash` and related files
* introduced `rz_msg_digest_*` with plugins
* updated all old methods with newer ones.
* added HMAC support to `rz-hash` (moved key option under `-K`)
* removed wrong algorithms on `woD`/`woE`
* fixed parity digest size
* fixed the behaviour on all hash functions
* added unit test for hash
* optimized code for HMAC key calculation
* removed hash legacy tests
2021-05-02 20:47:17 +08:00
Khairul Azhar Kasmiran
541d45a752
Fix omtq wrt new table syntax (#1085) 2021-04-28 15:35:58 +02:00
Khairul Azhar Kasmiran
61e6b898f5 table.c: On no op, print column named (new syntax) 2021-04-28 11:25:35 +08:00
Jing Liu
d0e9392fcb
Add alignment to iSS and iS commands where appropriate 2021-04-26 18:35:23 +08:00
Giovanni
54fd6a66bc
Refactoring rz-hash, crypto and hashes interfaces (#1072)
* Refactoring rz-hash main, crypto interfaces and hashes
* ops. removed method that was removed later on
* fixed punycode oob read
* use RZ_ARRAY_SIZE instead of looking for null pointer
* Added broken flag on rz-hash -L test
2021-04-26 11:07:52 +02:00
Khairul Azhar Kasmiran
371081a0df
table.c: Add ge and le operators (#1073) 2021-04-23 22:57:08 +08:00
Riccardo Schirone
cad4e0ae0f
Rename newshell to rzshell and parser commands to statements 2021-04-22 19:45:14 +08:00
Riccardo Schirone
e2e005cd80 Adjust tests 2021-04-21 15:26:35 +02:00
Riccardo Schirone
71a0d66cf8 Use : as separator for table query/format
The idea is that we will move all command specifiers to `:`.
2021-04-21 15:26:35 +02:00
seanachao
a2f8631b6c
Change -, --, = argument and = command meaning (#930)
* Swap = & - R (#615)&(#616)
* Fix R replace =
2021-04-21 16:20:24 +08:00
Anton Kochkov
86cbed2d24
Switch struct/union access to RzBaseType API 2021-04-16 18:26:22 +08:00
Giovanni
b9dd6ae264
AVR LGPL Assembler and Disassembler + tests (#1028) 2021-04-16 10:01:39 +08:00
Anton Kochkov
9c71f7b502 Switch enums access to RzBaseType API 2021-04-13 22:52:04 +08:00
Aswin C
956eb5025e Use PJ in Lcj ##json
* Replace one instance of a call to load saved layout with its API
2021-04-13 16:01:55 +08:00
Anton Kochkov
7c95b30089 Remove sdb_types access from RzAnalysisVar 2021-04-12 21:00:02 +08:00
Florian Märkl
175849813e Implement Project Migrations with 1->2 2021-04-07 16:13:15 +02:00
Anton Kochkov
788fdb3d8e
Extracting types handling into RzType (librz/type) ##refactor (#896)
* RzType introduction
* Move format processing to RzTypes from RzUtil
* Rename RzType to RzTypeDB
* Join RzType and RzAnalysis noreturn functions
* Add noreturn column in `aflt` output
* Remove D (disassembly) pf tests
* Fix `tn` test
* Add function noreturn serialization
* Modify meaningless type test
* Fix wrongly written `Cf` test
* Fix `za t` (zignature type) command
* Fix signature type test
2021-04-06 18:04:00 +08:00
Florian Märkl
4c754dd905 Separate Classes Setting and Printing 2021-04-05 16:49:55 +02:00
Florian Märkl
5b95327c17 Prevent infinite Recursion in Dwarf Types Parsing 2021-04-05 12:00:24 +02:00
Florian Märkl
f28f6e80eb Add some missing DW_AT_KIND_STRING checks 2021-04-05 12:00:24 +02:00
Khairul Azhar Kasmiran
4eb3cb2369
Fix dup [?25l esc seq in cmd_visual test (#965) 2021-04-05 17:04:50 +08:00
Khairul Azhar Kasmiran
eddd2d1b3d
Fix dup ]0;0H esc seq in cmd_visual test (#946) 2021-04-01 20:31:49 +08:00
Khairul Azhar Kasmiran
fe5af64505
Fix dup title in cmd_visual test (#943) 2021-03-31 20:17:43 +08:00
Paul I
8649bebc54
Replace ref/xref with xref from/to 2021-03-30 15:33:31 +08:00