467 Commits

Author SHA1 Message Date
Florian Märkl
8beae0bb91 Fix pvector usage in r_core_get_boundaries_prot 2018-07-30 18:49:37 +02:00
Florian Märkl
d5c1fcfd74 Implement flat RVector and pvector 2018-07-30 18:49:37 +02:00
Luca Di Bartolomeo
13a2cb344a [WIP] Colorize function arguments and variables part 2 (#10777)
* Colorize comments that hint type of data
* Use new colors for comments that hint type of data
* Colorize local variables and args in disasm
* Fixed leak in r_anal_var_all_list()
* Refactoring + rename color func_arg* to func_var*
* Updated all color themes for func_var* colors
* Directly query sdb for faster and cleaner var colorizing in r_colorize_opcode
* Remove hackish r_core.h include in print.c and use callbacks instead
2018-07-20 12:45:51 +02:00
cyanpencil
b747592598 Add asm.flags.real option disabled by default 2018-07-05 00:55:51 +08:00
cyanpencil
c90d548082 Fix linking error in flag.c 2018-07-05 00:55:51 +08:00
pancake
6e5240c725 Fix some memleaks related to code analysis 2018-06-12 16:24:07 +02:00
sivaramaaa
8cc5f0216c Intial work on struct offset propagation 2018-05-31 19:05:54 +02:00
sivaramaaa
e5bbaffbfe Refactor code to change R_ANAL_OP_MASK_ALL to appropriate value 2018-05-31 19:05:54 +02:00
pancake
31ad955bab Use r_io_read_at instead of r_core_read_at which is now deprecated 2018-05-21 23:06:00 +02:00
pancake
91a2e5fb9d More killing of strcasecmp/strncasecmp 2018-05-21 22:13:07 +02:00
sivaramaaa
0fd3896262 Fix #9886, Add flag at both offset and value for /V (#9953) 2018-05-21 02:47:20 +02:00
pancake
0c1609e34b Fix #10050 - null deref in cmd_search 2018-05-10 16:32:46 +02:00
Riccardo Schirone
b703dfbf17 anal/xrefs: single, global xrefs API
* several bugfixes
* Fix xrefs/refs confusion with asm.cmt.refs
* Also check if xref source is valid offset
* Fix ax* to show type of ref
* anal/xrefs: pass the right hashtable to mylistrefs
* r_anal_refs_get should use anal->refs, not anal->xrefs
* anal/fcn: add xref also when there's a CALL to a noreturn function
* projects: use radare2 output of ax command to save/restore xrefs
* core/cmd_anal: when analyzing calls, we should use REF_TYPE_CALL
* core/canal: use xrefs API, because the list is a just a copy
* core/canal: rename "loc." entries to "fcn." when a CALL is found
* sort xrefs to make results consistent
* core/canal: avoid recomputing function every time during `aan`
* anal: move fcn_refs/xrefs functions to the xrefs.c file
* core/canal.c: avoid iterating fcn xrefs list
* anal/xrefs: compute fcn xrefs by analyzing fcn addresses
* remove other unused functions
* anal/xrefs: remove fcn_xrefs_add and fcn_xrefs_deln
* anal/xrefs: remove old fcn->refs/xrefs
* anal/xrefs: directly store RAnalRef objects in the hash table
* libr: prevent memory leaks when using refs/xrefs
* anal/xrefs: merge anal/ref and anal/xref and clean API

Big xrefs/refs refactoring that provides a more uniform and simple API.
It avoids changes to refs/xrefs except through the API and it keeps all
xrefs/refs info in one single place, to improve consistency.

Thanks to:
Riccardo Schirone <sirmy15@gmail.com>
pancake <pancake@nopcode.org>
rene <rlaemmert@gmail.com>
2018-05-04 21:40:47 +02:00
pancake
beb5b81c85 Remove wrong assumtion on core->io->desc 2018-05-04 13:08:27 +02:00
Paul I
d774f579ac Fix double free bug in r_core_search_rop (#9997) 2018-05-02 00:24:38 +02:00
pancake
45588ed06e Make /m create flags 2018-04-24 13:50:09 +02:00
pancake
9d477defaf Fix help message for /h 2018-04-14 18:33:15 +02:00
pancake
1adac87918 Update sdb-1.1.0, update calls to sdb_fmt() 2018-04-10 23:52:47 +02:00
Riccardo Schirone
4517a4c6d6 core/cmd_search: fix some memleaks (#9842) 2018-04-09 19:23:29 +02:00
pancake
35df0cd752 Make Travis green again 2018-04-09 10:33:57 +02:00
pancake
62055c57ab /R works like wa now ",," is the same as ";". Add rop.sdb disabled by default 2018-04-09 02:15:22 +02:00
sivaramaaa
1040167beb Fix #9705, Added /mj, /vj and /Vj 2018-04-08 23:02:18 +02:00
pancake
80759f227d Implement pdsb, /gg to graphpath following calls, and honor anal.depth and search.count 2018-04-05 09:30:47 +02:00
pancake
613b240449 Fix aab. (a8 -> ab). Implement /gg and /g? 2018-04-05 01:45:12 +02:00
Gromimousse
c5e476fed1 Rop gadgets are now stored in sdb (#9784)
* Rop gadgets are now stored in sdb

 - Now gadgets are searched only once, and then future rop search are
 much faster because gadgets are just retrieved directly from sdb
 - Still need to deal with the grep functionnality, and perhaps recode a
 little bit around that to make it work well with the gadget in the sdb
2018-04-04 13:00:52 +02:00
pancake
51958b62c3 Implement /g to find all possible paths from A to B inside a function 2018-04-04 00:42:24 +02:00
Florian Märkl
93d9f4ec66 Add mask parameter to r_anal_op() 2018-03-16 11:10:15 +01:00
redmed666
24e076e19e Fix #9595 (#9673)
* Added an address mask inside the RAnalEsil struct in order to be sure that the address accessed is relevant with the asm.bits of the file + Changed the calls to r_anal_esil_new

* Corrected the addrmask in r_anal_esil_new

* RTTI: Read MSVC Complete Object Locator

* RTTI: Read MSVC Class Hierarchy Descriptor

* VTable End on Reference

* RTTI: Read MSVC Type Descriptor

* RTTI: Read MSVC Base Class Array, Better Printing

* Add anal.cpp.abi

* Minor Code Style Changes in RTTI

* Fix rahash2 entropy to show non truncated double (#9629)

* Anal - whitespace fixes

* Honor CFLAGS on the static build test compilation (#9677)

* change coding style tab width to 4 (#9670)

* Meson: use more built-in options (#9678)

* Add support for extended regex in asm search (#9675)

* Fix #9665 - Backwardly handle scr.color={bool}

* Fix #9676 - Infinite loop in ecs with scr.color=2

* Adding help for redirection (#9679)

* Refactores function r_str_split_list to receive the character to split by (#9672)

* Fix #9666 - lines with comments do not use Unicode reflines

* Fix uninitialized optypes_list issue in cmd_debug

* update asan.sh to actually take the env for ASAN

* removed incorrect return (#9685)

* Fix UB in ESIL

* Initial import of the CoreUndo API and uc command

* Initial implementation of cmd.pdc to select pseudo-decompiler

* Handle recursive pdc calls

* Fix RPrint.strconv_mode memleak

* Fix leaks in RSyscall.srdb

* Use r_syscall_ref to avoid dblfree-or-leak issue

* Arm thumb/thumb selector for the armass (#9681)

* added function to translate number to imm12
* added function to get thumb shifts easily
* added selector, newfangled implementation of adc
* add bitmask for command suffixes
* added new routine for parsing suffixes to opcodes. Error check added in getnum. Bugfixes.

* Few improvements to 8051 memory mapping (#9686)

* update memory map when idata/sfr/xdata regs change
* set address space name on map
* fix regression, remove debug output
* fix regression, enable map name

* Some fixups for #9682 (#9688)

* Fix: coredump generation for huge programs (#9680)

* Refix #9666 - lines with comments do not use Unicode reflines

* Removed code unnecessary due to dcf3db025085c45124ec21890550a4ef19bd015c

* Fixed free const warning

* Fix another memleak in RSyscall

* Fix more memleaks

* Fix leak in RConsPal.rainbow

* Fix 18K leak in anal.x86.cs

* Fix some more memleaks in disasm and fix issue in str overlap

* Fix memleak in RCore.anal_refs and fix regression

* Revert "Fix some more memleaks in disasm and fix issue in str overlap"

This reverts commit a902df837b0d499e1723179ed5c957c078703b51.

* Fix memleak regressions

* Bring back another memleak fix

* Fix an undefined behaviour in RParse.filter

* Fix memleaks in disasm.c

* Add cundo.c to Meson (#9694)

* Bring back an ugly buffer pack access issue to make it work

* Cast to void * in R_FREE (#9692)

* Set anal.cpp.abi to msvc for pe

* Add better help for av

* Split avr into avr and avra

* Make av, avr and avra breakable

* Add RTTI struct specific print functions

* RTTI: Support MSVC x86_64

* PE: Fix too short section name.

* PDB: define a constant to store the max length of a section name and use id.

* PDB: dump the size of structure and union in JSON mode.

* Fix cast issue in eprintf for debug.core.linux

* Move the asm and anal plugins for x86.udis to extras

Available via r2pm -ci udis86

* Remove more udis86 references

* Fix warnings

* fix pcache ptr-fuckup

* Fix defragger theme

* Fix crash in asl and fix its behaviour

* Fix memory leak in blaze anal and silent a warning

* Implement ?q to be like ?v but in quiet mode

* Fix Meson build

* Add missing 8, 16, 32 bit registers (and flags) for the linux-arm64 debugger reg profile

* Fix 'Cannot find function at UT64_MAX message'

* Add some Pingu to fortunes.fun

* Loading Core (x86, x86_64, aarch64) (#9669)

* Ragg2-cc -> Ragg2 merge (#9658)

- change of 'access' function for 'r_file_exists' for windows portability
- several changes in the way ragg2.c is done, see PR #9658 pancake comments
- change function for the remove of 'file'.text
- open changed for r_file_dump
- some elt of cEnv_t are now const
- skip all the pointers verification in set_cEnv but do them in check_cEnv instead
- add 2 r_str_sanitize for file and CC in parseCFile
- rewrite the removal of .o, .tmp, .bin, .s files, with cleaner code
- changed the long command with sed and grep to 2 C functions.
  - The function parseCompiled that basically does what the command was doing
  - And r_str_stripLines that is equivalent to "grep -v" (maybe we should put this one in str.c ?)
- simplify a bit getCompiler function with a const char* array
- add ternary operator for armOrMips condition
- use r_file_path for finding path to compilers
- new file created in libr/egg which contains all the C file parser
- modifications of 2 files to match the change :
  - libr/egg/r_egg.h
  - libr/egg/Makefile
- the function r_str_stripLine is simplier (the mallocs wasn't needed)
- the function r_str_stripLine is moved to libr/util/str.c
- libr/include/r_util/r_str.h is changed accordingly

* Revert bd3465c9a3fbeddf83980dc07eaac588320f7d (warning remains fixed)

This reverts commit titled "Fixed free const warning".

* Added an address mask inside the RAnalEsil struct in order to be sure that the address accessed is relevant with the asm.bits of the file + Changed the calls to r_anal_esil_new

* Corrected the addrmask in r_anal_esil_new

* Cleanup expressions in esil.c (addr &=...)

* Corrected r_anal_esil_new definition in r_anal.h

* Added an address size max in the ESIL config (maximum address size reachable by the ESIL VM)
2018-03-16 10:45:17 +01:00
G4mb1t
bc3b63276d Fix cmd /c/j to print json (#9651)
* Fix cmd /c/j to print json

* Fix parameter passed to r_core_asm_strsearch
2018-03-12 09:29:06 +01:00
Vasco Franco
13c02fdcea Fixed json output of /Af command in cmd_search.c (#9657) 2018-03-11 19:29:43 +01:00
Michael Scherer
4ce73d2d44 Add a warning if no section is executable when using aap (#9367)
While trying to RE a firmware, I didn't realize that section
must be marked as 'executable' for aap to work, and the error message
didn't seems to imply that aap wasn't able to find anything.
2018-02-11 20:47:57 +01:00
pancake
6f64b9ff29 Add search.in=bin.sections and @@@ sections 2018-01-28 00:27:30 +01:00
pancake
c19e3b0f8c Fix memleaks in r_core_get_boundaries_prot 2018-01-28 00:19:11 +01:00
sivaramaaa
a6d64cfd3b Fix #9244 , Honor anal.in for aab (#9250)
* Fix from/to issue for anal.in and zoom.in
* Merge all get_boundaries function and added a prefix param
2018-01-27 23:10:02 +01:00
pancake
b926122772 Use RInterval in io.cache and io.pcache, renaming and code cleanup 2018-01-10 02:35:11 +01:00
pancake
e43107d1ca r_str_chop_ro, r_str_trim_const -> r_str_trim_ro 2018-01-08 03:29:29 +01:00
pancake
335938be58 r_str_chop -> r_str_trim 2018-01-08 03:22:26 +01:00
pancake
8f8f4a1d4d Fix /re (arg) 2018-01-07 01:04:01 +01:00
pancake
0f922d0da4 Fix /v when no size is specified 2018-01-06 23:45:06 +01:00
Ziyaddin Sadigov
d4dd6fd5e6 Fix typo regarding byte size (#9067) 2017-12-27 18:33:58 +01:00
pancake
536654bb9f Fix #8797 - Honor search.maxhits in s/ 2017-12-24 18:15:43 +01:00
pancake
1638507d01 search.maxhits is more aggressive now 2017-12-24 18:10:21 +01:00
pancake
0b1e8eaecc Fix almost all warnings from the msvc build 2017-12-19 00:18:39 +01:00
pancake
bc10485212 Fix #9005 - Fix missleading messages in search 2017-12-18 15:51:27 +01:00
Florian Märkl
dda6ba4101 Add /O command 2017-12-16 20:02:54 +01:00
pancake
52f5bb123d Optimize {anal,search}.in=io.maps 2017-12-16 19:38:32 +01:00
xarkes
0ce6e6dbe8 Fixed axtj/axfj extra null byte. (#9018) 2017-12-15 01:12:54 +01:00
pancake
e985e0b9ed Speedup aav even more, from 0.15s to 0.06s 2017-12-10 12:53:06 +01:00
sivaramaaa
785fd99a8e fix warnings in /v (#8996) 2017-12-10 11:26:02 +01:00
sivaramaaa
89145fe0a2 fix #6023, /v[x] with multi arg (#8988) 2017-12-09 18:42:46 +01:00