Commit graph

254 commits

Author SHA1 Message Date
wargio
174d02b4a7 Fix ninds plugin endianness and improved it 2022-10-23 11:36:17 +02:00
Giovanni
e2ee0c3fd6
Rewritten bin_nin3ds.c and add test (#3110) 2022-10-20 19:56:17 +02:00
Florian Märkl
2237870395
Mach-O: Add support for DYLD_CHAINED_PTR_64 (#3094)
The added test case was checked against execution on real iOS.
2022-10-14 19:59:29 +02:00
billow
46a1929397
Refactor rz_core_analysis_graph*() functions (#2949)
- fix `ags` and `agl` commands
- add more tests for the `ag` commands
- move graph related code to cgraph.c
- remove APIs `rz_core_print_bb_custom` `rz_core_print_bb_gml`
- exports
    - `rz_graph_drawable_to_json_str`
    - `rz_graph_drawable_to_cmd`
    - `rz_graph_drawable_to_gml`
    - `rz_core_graph`
    - `rz_core_graph_diff`
    - `rz_core_graph_format_from_string`
    - `rz_core_graph_type_from_string`
    - `rz_core_graph_write`
    - `create_agraph_from_graph_at`
- add unit/integration tests for the graph API
2022-08-29 22:48:23 +08:00
Giovanni
3752e24b98
Update rz-libdemangle (#2984) 2022-08-27 02:35:07 +02:00
Riccardo Schirone
9ba89d8116 core/cmd: rewrite rz_cmd_macro API 2022-08-26 07:53:43 +08:00
Giovanni
eedfde9e97
Ensure RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE always return at least 1 (#2917) 2022-08-15 01:15:31 +08:00
wargio
a73e8ecd4d Add references and flags to constant pointers to data maps 2022-08-13 22:52:24 +02:00
billow
0908b65bc3
Convert px[ dDhHwWqQol] to rzshell
* `pxd` -> `pxd 4`
* `pxd<N> [len]` -> `pxd <N> [len]`
* expose APIs:
- `rz_core_print_cmp`
- `rz_core_print_dump`
- `rz_core_print_hexdump_`
- `rz_core_print_hexdump_byline`
* test for `pxW` `pxH`
* move `void rz_print_section` -> `const char *rz_print_section`
* `pxd` -> `pxd[ hwq]`
* `pxc`
* `pxAv` -> `pxAl`
* `pxt.` -> removed ?
* `px/` -> keep
* `pxf` -> TODO: not found old code ?
2022-08-04 09:11:22 +08:00
Florian Märkl
bd076fa6bc
Fix endian issues and libs in xbe and extend tests (#2843)
Apart from obvious big endian parsing bugs, this also tests `il` with
xbe, since that had endianness issues too and was previously untested.
To be able to have meaningful tests there, extra entries for the
explicit kernel and xapi pointers found in the xbe header have been
removed, since these always seem to point into the regular library array
anyway and would thus result in duplicates.

This fixes test/db/formats/xbe on OpenBSD/sparc64.
2022-07-27 08:24:14 +08:00
GustavoLCR
a6bd48f98b
Fixes for tests (#2818)
* Close files before trying to delete them
* Add `-N` to not load the rizinrc in `read from stdin` test to avoid overwriting the color setting
* Make sure `.tmp` exists for `idpx` test
2022-07-19 18:09:33 +08:00
billow
40ca22202b
Refactor rz_core_print_disasm_json (#2746)
* Split `rz_core_print_disasm_json` as: `rz_core_print_disasm_json` and `rz_core_disasm`
* Use `rz_str_enc_string_as_type` in `ds_init`
* Refactor `rz_core_print_disasm` and `rz_core_handle_backwards_disasm`
* Add `rz_core_asm_bb_middle`
* Move global `disasm_texts` to `RzDisasmState`
* Rewrite `core_analysis_bytes_standard` with `rz_core_analysis_bytes`
* Add `test_rz_core_print_disasm` and `test_rz_core_analysis_bytes`
* Rewrite `rz_core_print_disasm` with `RzCmdStateOutput`
* `pdi` -> `pdq` in tests
* `pdi` -> `pDq` in tests
* `pid` -> `pdq` in tests
* `pId` -> `pDq` in tests
* `pij` -> `pdj` in tests
* `pIj` -> `pDj` in tests
* `pdeqq` -> `pdeQ` in tests
* Remove `pDJ` from `test/db/json/`
2022-07-09 08:10:06 +08:00
Giovanni
648882d544
Add libmspack and add idpx to extracts compressed pdb (#2728)
* Add libmspack, cabextract and add idpx to extracts compressed pdb
* Remove cabextract from CIs since it is not anymore required.
2022-06-27 23:52:07 +02:00
Dean
bf2871c7eb
Add dotnet PE support (#2528)
* Add CIL support

* refactor dotnet parsing to pe/dotnet.c
* parse PE CLR metatables (based on yara implementation)
* use CLR methoddefs to add binsymbols (including method namespace/class)
* parse CLR method headers
* CIL disassembler using .NET opcodes.def
* CIL analysis plugin
2022-06-21 09:20:47 +08:00
Luca Borzacchiello
2d69ecbb22
Better false-positives detection in rz_scan_strings (#2691)
* Improved false-positive detection in str_search

This commit adds the following features:
- Extend the false-positive check on ASCII frequencies to all UTF strings
- Add a global option to activate/deactivate di check
- Improve the false-positive heuristic by adding a special case for extended-ASCII strings
2022-06-14 22:14:13 +08:00
Giovanni
4c81b52f68
Use github as symbol server for the tests (#2686) 2022-06-10 16:35:15 +00:00
guest177
59179ab311 Correct MZ size when bytes_in_last_block = 0 ##bin
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2022-06-06 14:35:25 +02:00
GustavoLCR
951a33c490 WinKD/DMP: Use backtrace_generic() for dbt for arm and x86 2022-06-05 00:27:35 +08:00
Florian Märkl
0950e823a4
Refactor rz_core_analysis_get_stats() and fix edge cases (#2645)
Range is now explicitly inclusive/inclusive to allow generating stats
for the entire 64bit range.
This especially also removes the obscure "Cannot alloc for this range",
which could be observed in Cutter, and adds a more meaningful error to
the p- command whenever no range is available.
2022-05-30 04:59:47 +00:00
wargio
99985c89dc Refactoring using sigs for x64/x86/arm32/arm64
- initial support for mips32/mips64/riscv64/ppc64
2022-05-18 19:24:53 +02:00
Riccardo Schirone
e36d66abe7 Remove analysis.endsize config
Commit taken from radare2 project:
03afa631ff37ecb7585d3d4bb052f7208e68c25dA ("Kill anal.endsize ##anal")
2022-05-18 10:25:01 +02:00
Anton Kochkov
5aef0d8a98
Update libdemangle for MSVC fixes (#2556)
Co-authored-by: GustavoLCR <gugulcr@gmail.com>
2022-05-15 20:57:27 +08:00
billow
e767046197
Convert dL to rzshell (becomes dl) and expose API
- Convert `dL` to rzshell
- `dL` becomes `dl`
- Expose `rz_core_debug_backtraces()` API
- Expose `rz_core_analysis_hint_set_offset()` API
2022-05-13 20:17:56 +08:00
Giovanni
0d4d8f5892
Ported aa* commands under newshell (#2594) 2022-05-10 19:07:20 +02:00
Giovanni
0dcdc842a2
SDB usage cleanup within rz_bin 2022-05-10 10:27:33 +08:00
Riccardo Schirone
27e0d7ae82
RzBin: improve handling of addresses in ELF (#2591)
* RzBin/ELF: avoid the creation of useless flags at 0

Use UT64_MAX as an error value for addresses like symbols, imports,
sections, etc., and do not create flags for those because they are not
meaningful. This is useful for imports that do not have an address in
the virtual/file space and for non-alloc sections (e.g. .comment).
2022-05-10 10:17:35 +08:00
Riccardo Schirone
41c9bfc2ae RzBin: fix string scan vaddr/paddr
* Fix convertion of paddr to vaddr by using the new RzBin API
  rz_bin_object_p2v
* Fix locations of strings when RzBinXtr is used (e.g. fatmach)
2022-05-06 18:09:17 +02:00
wargio
f9d74c9115 Added tests and fixed some others 2022-05-03 12:13:22 +02:00
Anton Kochkov
564d88c319
Add missing Python magic values (#2522) 2022-05-02 13:22:12 +02:00
Paul I
00676b4e39
Convert afc commands to rzshell (#2559) 2022-04-24 20:55:41 +02:00
Giovanni
5e09c02109
Remove eprintfs (part 1) and rz-bin -X (#2558)
* Removed eprintfs from librz/bin/bfile.c
* Removed rz_bin_package and rz-bin -X because untested and not implemented
* Removed eprintfs from librz/bin/bin.c
* Be verbose on clang-format and not on command execution
* Removed eprintfs from librz/bin/bobj.c
* Removed eprintfs from librz/bin/dwarf.c
* Removed eprintfs from librz/bin/format/coff/coff.c
* Removed eprintfs from librz/bin/format/dmp/dmp64.c
* Removed eprintfs from librz/bin/format/luac/luac_bin.c
* Removed eprintf from librz/bin/format/luac/luac_common.c and refactoring
* Removed eprintf from librz/bin/format/luac/v53/parse_53.c
* Removed eprintf from librz/bin/format/mach0/coresymbolication.c
* Removed eprintf from librz/bin/format/mach0/dyldcache.c
* Removed eprintf from librz/bin/format/luac/v54/parse_54.c
* Removed eprintf from librz/bin/format/mach0/dyldcache_rebase.c
* Removed eprintf from librz/bin/format/mach0/fatmach0.c
* Removed eprintf from librz/bin/format/mdmp/mdmp.c
* Removed eprintf from librz/bin/format/mz/mz.c
* Removed eprintf from nso/nxo bin format
* Removed eprintf from librz/bin/format/objc/mach0_classes.c
* Removed eprintf from librz/bin/format/omf/omf.c
* Removed eprintf & bprintf from librz/bin/format/pe/pe.c
* Removed eprintf from librz/bin/format/pe/pemixed.c
* Fixed luac test
2022-04-23 18:43:43 +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
GustavoLCR
8ff310e62d Add PE SEH tests 2022-04-11 12:27:50 +08:00
Florian Märkl
a1e958f230 Fix radare2 CVE-2022-1240 (out of bounds read) 2022-04-10 16:05:40 +02:00
wargio
21ba6616ce Fix radare2 CVE-2022-1244 (out of bound read)
This this an Out of Bound read caused by missing sanitization of the
parsed dyldcache parsed structure.
Introduced via c19eaa8843
Original r2 commit: 09e20cd53d00a1497bf50349fe6eb812b4f54ac5
2022-04-10 16:05:40 +02:00
Rot127
0c4e84cd9d
Add big endian PPC relocs (#2502)
* Add support for big endian PPC relocs.
* Add tests for PPC_RELATIVE and PPC_JMP_SLOT.
2022-04-06 09:18:40 +08:00
Giovanni
348ed19ad6
Dex add support for some imports within direct_methods via super calls (#2491)
* Dex add support for some imports within direct_methods via super calls
* Fixed tests and added test
2022-04-03 20:54:55 +08:00
Giovanni
4fb8c83e94
[DEX] Add relocation support 2022-04-02 16:23:43 +02: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
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
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
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
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
babb7bf342
Remove command 0 (alias for s 0x...) 2022-03-09 22:10:13 +08: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
Florian Märkl
95ff6fd38a
Fix separation of fpu and gpr in arm64 reg profile (#2368)
d/s/h/b regs are in a different file than x/w regs.
2022-02-27 16:46:20 +01:00
GustavoLCR
ddea0c01e7 PDB: Add/fix tests 2022-02-25 13:17:20 +08:00
Khairul Azhar Kasmiran
e68a5f785d
Fix #2072: Convert main vaddr to paddr first (#2320)
* Fix #2072: Convert main vaddr to paddr first
* Declare freepascal test as broken
2022-02-15 00:05:09 +08:00
GustavoLCR
5eaea7a552
PE x64 SEH fixes (#2310)
* Fix missing SEH scopes in x64 PE
* Fix multiple exception scopes in same address not adding flags
* Also add flags for the exception filter if it exists
* Fix assertion in `rz_analysis_block_update_hash()`
* Add call reference for exception filter
* Update old block's hash when creating a new block in trycatch analysis
* Fix try-catch control flow analysis
* Fix test
2022-02-13 21:32:40 +08:00