Commit graph

634 commits

Author SHA1 Message Date
wargio
f9d74c9115 Added tests and fixed some others 2022-05-03 12:13:22 +02:00
Theofilos Pechlivanis
e87349f9bc
Refactor afs and afsj (#2578) 2022-05-03 11:08:20 +08:00
Florian Märkl
b40dde5fbf
Move DEBUGGER checks from C to meson.build (#2577)
Entire files are now avoided to be built by checking in meson rather
than using #if DEBUGGER. This now also includes bsd_debug.c, which
is currently slightly broken on OpenBSD/sparc64 and caused compile
errors even with -Ddebugger=false.
2022-05-02 11:22:35 +02:00
Giovanni
e1b2c3eff5
Remove eprintfs (part 2) (#2563)
* Removed eprintf from librz/bin/format/pyc/marshal.c
* Removed eprintf from librz/bin/format/pyc/pyc_magic.c
* Removed eprintf from librz/bin/format/te/te.c
* Removed eprintf from librz/bin/format/wasm/wasm.c
* Removed eprintf from librz/bin/format/xnu/rz_cf_dict.c
* Removed eprintf from librz/bin/p/bin_bf.c
* Removed eprintf from librz/bin/p/bin_cgc.c
* Removed eprintf from librz/bin/p/bin_elf.inc
* Removed eprintf from librz/bin/p/bin_luac.c
* Removed eprintf from librz/bin/p/bin_mach0.c
* Removed eprintf from librz/bin/p/bin_mdmp.c
* Removed eprintf from librz/bin/p/bin_menuet.c
* Removed eprintf from librz/bin/p/bin_nes.c
* Removed eprintf from librz/bin/p/bin_pe.c
* Removed eprintf from librz/bin/p/bin_pebble.c
* Removed eprintf from librz/bin/p/bin_psxexe.c
* Removed eprintf from librz/bin/p/bin_sfc.c
2022-04-25 17:53:54 +02:00
Paul I
00676b4e39
Convert afc commands to rzshell (#2559) 2022-04-24 20:55:41 +02:00
Paul I
d24a325df1
Remove afC commands (#2555) 2022-04-22 12:57:11 +02:00
Giovanni
de8a5cac55
Porting pd and subcommands to newshell (#2552)
* pd + pda[jJqi=]
* Added pdb/pdC/pdf/pdk/pdl/pdp/pdr and removed pdi in favour of pdq
* removed pdx since is an alias for 2 other commands.
* Added pdR and pds[fb]
* Added example and fixed bug when cw
* Removed pdx test file since it is the same as cmd_pix
2022-04-21 16:19:48 +02:00
GustavoLCR
be669a9404
Fix OOB write in unescape_special_chars() (#2543) 2022-04-14 21:21:34 +02:00
wargio
5c8db619f7 Implemented dex/dexs/dexe core cmds for dumping dex info like for java 2022-04-12 22:14:05 +02:00
Peiwei Hu
5fa722efab
Refactor RzTable: change the implementation to RzVector (#2536) 2022-04-13 00:57:52 +08:00
Anton Kochkov
d6d214572f
Revert "Refactor RzTable: change the internal storage to RzVector (#2421)" (#2517)
This reverts commit 1748b38ce1.
2022-04-08 18:06:20 +08:00
Riccardo Schirone
30cbd237d3 RzCore: save/restore bits and arch config values while printing 2022-04-07 16:41:54 +02:00
Peiwei Hu
1748b38ce1
Refactor RzTable: change the internal storage to RzVector (#2421) 2022-04-07 21:13:34 +08:00
Rot127
10bedc2b00
Add Hexagon register profile (#2490)
Although the reg profile was not really used yet it will be relevant for the RZIL uplifting.
Introduces:
* Double/quadruple registers now properly overlap with their counterparts.
* Registers have correct types assigned (vec, ctr, sys etc. Before, all regs were of type gbr)
* Consistent register names (asm name style: c3:2, r31 etc, alias style: lc1:sa1, lr etc.)
* Adds _tmp registers in the profile. Later used by uplifted instructions (think of .new registers).
2022-04-03 18:26:17 +02:00
Rot127
628d04f713
Add RzConfig for asm plugins (#2488)
* Add function to add config node to config by `RzConfigNode*`
* Move `SET<NODE>` macros to `rz_config.h`
* Add un/set functions for plugin specific configs.
* Add RzConfig and node setter to hexagon plugin.
* Use plugins RzConfig to determine sdk syntax setting.
* Use plugins RzConfig to determine if numbers should be signed.
* Use plugins RzConfig to determine if immediate hash should be printed.
* Remove unused parameter `rz_asm`.
* Remove unused variable.
* Remove unused callback.
* Remove unused flags from `RzAsm`
* Fix asm tests: Add NULL check; Set correct sign in asm test.
2022-04-03 20:44:50 +08:00
Anton Kochkov
30a62fb4e3
Fix the build 2022-04-03 01:50:22 +08:00
Paul I
5ea3630c35
Convert ab commands to rzshell (#2395) 2022-04-02 21:27:55 +08:00
Giovanni
b223ed4992
Use method definition as name where possible (#2481) 2022-04-01 21:59:04 +08:00
Khairul Azhar Kasmiran
907f296f57
Move "p8|sed -e s,1,x,g>x;cat x;rm x" test back under cmd/feat_redirect (#2463) 2022-03-30 23:23:20 +08:00
GustavoLCR
0c4308d07e
Add module name to PDB flag name (#2435)
* Add PDB flags inside `symbols` flag space
* Use `rz_bin_get_baddr()` in `rz_core_pdb_load_info()`
* Fix tests
2022-03-29 12:49:34 +08:00
Florian Märkl
1cbd1d7b31
Introduce addr_bits to type db for e.g. thumb (#2457)
This has the same meaning as rz_analysis_get_address_bits(), i.e. the
size of an address, which is often, but not always the same as the
"asm.bits" bitness, especiall in thumb where it has to be 32, rather
than 16. This fixes pointer size calculation for such cases.

Fix #1835
2022-03-27 15:53:42 +02:00
Giovanni
f87025d1e8
Remove cb_printf() from RzBin (#2446)
* Remove `cb_printf()` from RzBin
* Removed `bin.rawstr` from `rz-bin`
* Dropping `izzz` since does the same as `izz`
* Fix PE one section executables
* Fix behaviour of BFLT, LE, and SMD bin plugins
2022-03-26 20:30:55 +08:00
Khairul Azhar Kasmiran
fc66b66206
Remove .replace("\r\n","\n") from cmd_pipe tests (#2452) 2022-03-26 12:35:21 +08:00
Giovanni
acc339fc2f
Add rz_lang_byte_array and remove rz_print_code (#2444)
* Added rz_lang_byte_array and removed rz_print_code + refactoring cmds
* Added test for big endian
* Removed vlang and sync oldshell with newshell cmd changes
* Fixed in a more portable way conversion on signed byte for Java/Kotlin
* Resolved comments and added examples to help users
2022-03-25 20:45:57 +08:00
GustavoLCR
7e8fc2e97f Move cmd_aO test file to fix git on Windows
Case insensitivity causes all sorts of problems
2022-03-22 09:01:29 +01:00
billow
3632192818
Convert dt commands to rzshell (#2418) 2022-03-22 09:12:12 +08:00
Peiwei Hu
79454cdbe2
Convert a8, aO and ao command to rzshell (#2396) 2022-03-21 16:58:54 +08:00
Riccardo Schirone
86d20b2d16
RzShell: Remove possibility to switch to oldshell (#2420)
Due to some commands/tests still using the legacy "..." commands, we
can't fully remove oldshell code yet, but with this patch we just hide
it from the end users. Rzshell is now the default and only shell and
rzshell autocompletion is the default and only autocompletion engine.
2022-03-17 14:49:34 +01:00
Riccardo Schirone
d20b026ce2
Finish conversion of w commands to rzshell (#2412)
* Convert 'wz' to rzshell
* Remove 'wt' commands in favour of > operator
* Convert 'ww' command to rzshell
* Convert 'wm' command to rzshell
* Convert 'wd' command to rzshell
* Convert 'wu' command to rzshell
* Convert 'wo' commands to rzshell
* Fix 'w' tests
2022-03-16 11:20:29 +00:00
GustavoLCR
dd81b6629a
Implement getting a backtrace from a Windows Kernel Dump for x64 (#2387)
* PE: Add header to mappings
* PE: Add temp defs for unknown `UNWIND_CODE_OPS`
* Core Bind: Add `RzCoreBinApplyInfo` binding
* DMP/WinKD: Always add kernel modules to mod list
* Implement Windows x64 SEH backtracing
* Fix `ompb` not prioritizing maps
* Optimize `rz_io_map_priorize()`
* DMP: Implement backtrace for x64
2022-03-15 10:45:02 +01:00
Khairul Azhar Kasmiran
934588cfa5
!!: Fix extra \r on Windows (#2401)
* `!!`: Fix extra `\r` on Windows
* Use more efficient algorithm
* "Fix" cmd_pipe test
* "Fix" shared_memory.py
* Move feat_redirect test to archos/not-windows-any
2022-03-14 21:55:12 +08:00
Florian Märkl
bedcf6f354
Add indicator to oml for which map is visible at seek (#2409)
There may be multiple maps containing the current seek. This indicates
only the highest-priority one, which is also the one whose data is
visible at the seek address.
2022-03-14 08:59:40 +01:00
Peiwei Hu
d7cb78879e
Add hint for unexpected type definition (#2393) 2022-03-14 10:46:59 +08:00
Akihiko Odaki
13edb7440b Fix /a input option parsing when the pattern lacks 2022-03-11 18:28:06 +01:00
Giovanni
db580beb22
Refactoring for rz_print_2bpp_* and ps<cmd> (#2376)
* Moved rz_print_2bpp_* under rz_core
* Moved rz_print_string to rz_str_stringify_raw_buffer
* Added test for print urlencode and added pu0
* Removed RzCoreString and implemented utf32be/utf16be
2022-03-04 15:30:46 +01:00
GustavoLCR
ccfde0de98 DMP: Add/fix tests 2022-03-03 21:52:41 +08:00
wargio
0fd8a0d847 removed test 2022-03-03 12:56:12 +01:00
Riccardo Schirone
f745478fde
Improve suggestions when wrong command/args is used (#2365) 2022-03-02 10:39:33 +01:00
Khairul Azhar Kasmiran
45bf3677b2
Add double aezi test (#2372) 2022-02-28 22:48:03 +08:00
Khairul Azhar Kasmiran
f3c77de061
aezsu: Fix outdated pc when checking for completion (#2367)
* aezsu: Fix outdated `pc` when checking for completion
* Check reg pc after stepping as well
2022-02-27 22:04:45 +08:00
Riccardo Schirone
9df2994127
RzCmd: add support for dynamically generated details sections (#2361)
So far all the help sections were statically generated from the YAML
files, however sometimes you may want to list things in the help
messages that depend on what is loaded in Rizin (e.g. plugins, etc.).
This patch adds support for a details_cb that provides a dynamically
created RzCmdDescDetail array.
2022-02-25 09:25:15 +00:00
GustavoLCR
ddea0c01e7 PDB: Add/fix tests 2022-02-25 13:17:20 +08:00
Khairul Azhar Kasmiran
03feef1396
disasm, scr.utf8=1: Add missing @ to self-loops (#2335) 2022-02-19 10:42:54 +08:00
Khairul Azhar Kasmiran
a48068ff8d
Drop scr.interactive requirement for s error (#2333) 2022-02-18 21:25:00 +08:00
Riccardo Schirone
dffc891ff8 Fix tests still using '...' syntax 2022-02-16 16:25:37 +01:00
Riccardo Schirone
2a118ee413
Convert 'we' commands to rzshell (#2325) 2022-02-16 09:31:50 +00:00
Giovanni
b1af4e3840
Added test for FLIRT correctness (#2319) 2022-02-15 12:27:13 +08:00
Khairul Azhar Kasmiran
f6ea17e1e0
?P: Ignore io.va (#2305) 2022-02-12 22:02:50 +08:00
Khairul Azhar Kasmiran
dbbd4da41a
Fix #2299: ?p ignores io.va (#2302) 2022-02-11 17:36:22 +01:00
Riccardo Schirone
dea0918afd
Convert wa commands to rzshell (#2293) 2022-02-09 18:49:11 +08:00
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