245 Commits

Author SHA1 Message Date
Adam Pridgen
ffc8cc14a3 Chasing a segfault, when program exits 2013-11-22 12:28:44 -06:00
pancake
fb654160e9 Add GameBoy support in RBin
- Can identify rom, romtype (mbc,sram, ...), arch, entrypoint and 2 rombanks
2013-11-22 09:45:49 +01:00
aaSSfxxx
ba3065fb99 Add get_vaddr to RBinPlugin and fix vaddr calculation for PE files 2013-11-20 12:16:45 +01:00
pancake
42a8bb440e Fix #345 - fix some segfaults in yank and num.c 2013-09-05 05:10:57 +02:00
pancake
f1c9943df2 Fix #313 - Add bin.baddr and r2 -B to set base address for r_bin 2013-11-06 01:32:24 +01:00
pancake
1769a767cd Fix cpp warnings 2013-11-04 04:50:37 +01:00
Adam Pridgen
1b690e5638 - Fixed number of issues
1) Fixed CP Object off-by-one bug, which led too
2) Fixed the listing in consoles so now fully qualified Obj names and descriptions are right
3) Implemented byte look-ups using an array.
2013-10-23 19:44:12 +02:00
pancake
de857fa91d Fix #251 - Segmentation fault running "rabin2 -I classes.dex" 2013-10-14 23:28:17 +02:00
Adam Pridgen
a1cddb68cf - Fixed an issue where r_bin_java_get_entrypoints will return an RList*
directly rather than relying on the entries in libr/bin/p/bin_java to
  perform the conversion.
2013-10-04 10:53:51 +02:00
pancake
ae317798af Fix warnings in bin_elf.c 2013-10-01 17:20:16 +02:00
pancake
08cce66e68 Initial arm64 analysis. Fix loading mach0 kernels. Fix #230 2013-09-30 03:49:08 +02:00
pancake
81d7e5a8a3 Better support for ARM64 and OS autodetect for MACH0 binaries 2013-09-29 20:20:47 +02:00
pancake
666954b00e Filter trash in import names for PE 2013-09-28 23:58:55 +02:00
pancake
93b1e2e9aa Fix segfault in ELF parser (thanks a0rtega) 2013-09-28 11:44:43 +02:00
pancake
0f2fd99986 Fix some warnings and add a specific plugins.cfg for emscripten 2013-09-15 23:57:22 +02:00
pancake
ae97789986 Fix lot of warnings 2013-09-14 14:04:08 +02:00
pancake
dece987ca3 Fix various bugs on 64bits (mach0 entry, assembler, ragg) 2013-09-14 02:42:02 +02:00
Adam Pridgen
da5bf8db45 Squashed commit of the following:
commit 7800f979cc84c48395581b7106627f7f23563ee2
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Sep 4 21:58:35 2013 -0500

    - Added visibility field to structures RBinField, RBinMethod, RBinBind, RBinReloc, and RBinImport
    - Added handling for listing java classes

commit 1e7014342d16094fe21ddcb9b6b1991c5e3908b1
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Sep 4 18:41:00 2013 -0500

    -- Added mappings for access flags

commit cb8e4f0af99fc77f04263ddf292442835e128cff
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Sep 4 17:53:04 2013 -0500

    -- Updated the get sections command.
2013-09-06 16:22:26 +02:00
Adam Pridgen
38420cb91f - Updated the symbols and strings retrieval. Now methods and fields
that were parsed will be retrieved and added to the symbols list, and
all UTF8 strings from the constant-pool items will be retrieved as strings.

- I did not attempt to retrieve strings from the byte code.
2013-09-06 16:22:17 +02:00
Adam Pridgen
31e47f1c47 Squashed commit of the following:
commit 109915c7812305b9a442d3a0febd9bc43f7104b5
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Sep 4 09:50:08 2013 -0500

    - Added author rewrite tag

commit 5fe0d07f3a318f871bc5d6a8499afd9ceab26e33
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Sep 4 09:37:57 2013 -0500

    - Added a print statement for the number of attributes in the Code Attribute
    - Added a default stack frame creation

commit 4b1bca0d79c53421c1d7a9c59da070a5463ba05b
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Sep 4 08:58:55 2013 -0500

    - Added the R_API prefix to all function declarations and definitions
    - Removed the offset<=size from loops.  Not sure why this check is failing, but it needs to be added in the future (probably add it to the list of defects.)
    - Code appears to parse the classfile correctly

commit 5f5a28302da8c605800946df739c67a0f4f80b0d
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Tue Sep 3 23:11:00 2013 -0500

    - still minor bug in the parsing code on the Type Verification
     or somewhere in the StackMapAttr.  The right number of bytes are
     being read, but not all the bytes are being consumed

commit 1c9d8b490c8d7d8592f898e019aed3b56f9406c8
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Tue Sep 3 20:59:08 2013 -0500

    - fixed some compiler warnings in class.c

commit c185248aa478c6c78f6dbe14cf65ee3396287302
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Tue Sep 3 20:58:21 2013 -0500

    - Propogated the change to code.c from changes from classes.

commit 927542a0672f37b41b23345533bc7e6f2d1a5369
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Tue Sep 3 17:10:40 2013 -0500

    Fixed some minor parsing bugs:

    code_attr offet was not updated correctly after reading the length of the attribute
    attr_buf was not initialized correctly before use

commit b43a7189e9934369d1fdbd96de020edcab907430
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Tue Sep 3 16:33:36 2013 -0500

    - Code compiles.  Time to test.

commit ea7b332d84b88baca1abc466d02b00b2b8739bca
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Mon Sep 2 23:55:44 2013 -0500

    - Added in size calculations for the CP Objects.
    - Need to add method or field references calculations for size after compiling

commit ba55375dc0e835fb46550d0063758e419ec0ed7b
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Mon Sep 2 22:56:56 2013 -0500

    - Revamped all of the attribute parsing.  The parsers will handle buffers rather than simply
      parsing straight from the file.

    - added a size calculator for each of the attributes, which opens up the way for creating
      writers for the attributes and such.

commit be6f2e038f01beeb56ace7d4daaf4d90ad3fdad7
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Sat Aug 31 12:19:18 2013 -0500

    - Cleaned up code and removed some of the compiler warnings.

commit 4c81812f2609e4a80c7036053d122306039dd6ef
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 30 15:24:15 2013 -0500

    - Compiler and linker errors have been resolved.
    - Need to work on testing

commit 429ed30621d9abff1eec99ef50a35c57bbed76ad
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 30 13:35:39 2013 -0500

    Added the RunTime Annotations and Parameter annotations.
    Time to start compiling and testing.

commit b6044e1c74cc10874902bd34da7c8fcbdb5713cc
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 30 12:34:14 2013 -0500

    Added BootstrapMethodsAttr Parsing code along with supporting stuff, like creating
      the method and argument structures and mapping the REF_types to strings

    More should be done to map the REF_types to specific resolutions.

    Added in the MethodType, MethodHandle, and InvokeDynamic ConstantPool Objects

commit 2c9317be5d2be0608131fb9aa10f713885c89471
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 30 00:21:34 2013 -0500

    Finished drafting the code for annotation, element values, element value pairs,
       and annotation default attribute.

    TODO: RTI, RTV, and then Bootstrap attributes.

commit cbee3a10c18342f6a8fb941245568de885fe5666
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Thu Aug 29 15:42:00 2013 -0500

    Fixed the r_bin_java_element_value_new function definition.

commit ab98a76fabf2bd7764a51f3363d821c5a4cf1200
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Thu Aug 29 15:39:28 2013 -0500

    - worked out some of the initial compile errors.
    - worked out an outline for parsing the element_values
    - need to work through parsing the element value, freeing the element value, and then printing a summary.

commit b543d904f2aebd0d1f9c0ac8ec8401b6ab698f36
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Thu Aug 29 08:21:33 2013 -0500

    Most of the heavy lifting is done for attributes.  Need to implement a few of the methods,
    and then compiling should be able to happen.

    Added in all attribute values to the enums, the function call tables, and then the Metas information.

    Need implement an ElementValue parser bleh.

    Need to implement RuntimeAnnotations, Annotations, ElementValue parsing and make sure that
    the attribute unions are all updated.

commit 81f9ca2da2ed7e007a97a20ecb8eb260dfd55e7e
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Aug 28 22:33:43 2013 -0500

    Finished adding some logic to handle the StackMapFrame types.

commit 9a0965cc06021ad56d2127d279b918eef613bec9
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Wed Aug 28 17:54:52 2013 -0500

    Got some of the StackMapTable Atrribute parsing working.  Right now,
    only the FullStackFrame will correctly parse.

commit ea12bd6a8ae9969fa05cbcab622651c8b426917a
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 23 17:51:33 2013 -0500

    Added some debugging code while trying to figure out how to parse the StackMapTable.

commit 6141b57ee94c7bd0569d0ea76725fdce1ac50edf
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 23 17:00:12 2013 -0500

    Code compiles.

commit a7ad14050eb6184a1171620c4dcdba71b2f791aa
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 23 10:29:17 2013 -0500

    - Added a basic Signature element
    - Added declarations for the new functions to handle the parsing of the
      StackMapTable related structures.

commit 54cca3d9af60463dbfa77e23ef1d562ae82d6e5a
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Fri Aug 23 10:18:50 2013 -0500

    Finished an initial coding implementation of the StackMapTable.
    -- Will perform testing later in the day.
    -- Need to look-up the Signature Attribute

commit a14238eece865f4d1c5f2d6b1f482b000d10d94e
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Thu Aug 22 20:23:45 2013 -0500

    StackMap stuff is wip.

commit f011a5d948d31cc6197eed1bbea497a4dde362aa
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Thu Aug 22 18:44:23 2013 -0500

    Made the globals match the R_* standard.  Also tried to clean up naming stuff.

commit 6e61e15572744c2ed722ac3df8d988cc02f1316c
Author: Adam Pridgen <adam.pridgen@thecoverofnight.com>
Date:   Thu Aug 22 16:40:08 2013 -0500

    Plugging progress into the repo.  Adding fixes to handle the Java
    Class file appropriately.  This modification is mostly a re-write
    of the Class File parser, and it "tries" to do a better job of
    creating better objects for each of the Classfile elements.

    Currently this code is experimental, and current TODOs are:
    1) Testing
    2) StackMapTable
    3) LocalVariableTypeTable
2013-09-04 18:52:42 +02:00
Anton Kochkov
cc72328f86 Fix error in handling non-bios images as bios images
Just added size check
2013-08-19 17:55:56 +04:00
Juan RP
9101835c58 Accept @xtraeme's massive warning cleanup 2013-07-25 15:14:49 +02:00
Eduard Burtescu
96ca1d3815 r_bin/mach0: new relocs using dyld_info bind opcodes. 2013-07-19 09:53:43 +03:00
Eduard Burtescu
4a30d17266 Mach-O: new relocs implementation and complementary fixes for imports. 2013-07-19 09:29:58 +03:00
Eduard Burtescu
88030d6f38 r_bin/PE: implement new relocs. 2013-07-19 09:29:58 +03:00
Eduard Burtescu
5e096a4fd7 r_bin: new generalized relocs, with only arch-independent types.
Basic implementation for ELF relocs (x86, x64 and ARM).
2013-07-19 09:29:58 +03:00
Eduard Burtescu
b8e031d91c r_bin: removed hint from RBinImport, as it's only used in PE and even there it's doubtfully relevant. 2013-07-19 09:29:58 +03:00
Eduard Burtescu
8403699f2e r_bin: removed rva, offset and size from imports.
PLT-like lazy import wrappers are now part of symbols, where applicable.
The "imp." prefix is a temporary solution, it should be a flag.
2013-07-19 09:29:58 +03:00
pancake
7cb31941a6 Fix double free when loading malformed PE file
FMI: https://corkami.googlecode.com/svn/trunk/src/PE/lfanew_relocW7.asm
2013-07-03 11:57:37 +02:00
pancake
4aa2867486 Workaround to fix ELF object symbol offsets 2013-06-27 19:12:14 +02:00
pancake
04cfefb9d8 Fixes on dyldcache list and x86 branch analysis
Fix some branch analysis issues for x86
Add new simpler r_reg api r_reg_getv()
Store library offset in dyldcache xtract info
Accessible via rabin2 -A or r2 <file>
Looks like dyldcache is too slow and buggy for latest caches
Fix indentation in branch comments
2013-06-20 02:49:39 +02:00
pancake
ef180f1e1b Dummy load when no program loads in elf 2013-06-20 01:38:31 +02:00
pancake
caded0de14 Honor load program headers when no sections found in ELF 2013-06-20 01:25:40 +02:00
pancake
ef781cbadd New flag rasm2 -c CPU. pointer hints, fix analysis of x86-16 jmps
Add ahp (pointer hints)
Add rasm2 -c flag to select cpu (wip for arm)
rasm2 -e toggles instead of setting
Fix analysis of absolute jumps in x86-16
Push and pops are now magenta \o/
2013-06-17 03:26:48 +02:00
Anton Kochkov
b7f7054dcc More supported bios firmware images in r_bin_bios 2013-06-10 03:08:26 +04:00
Anton Kochkov
c53ae2712a Fixed wrong entrypoint offset in check() function for r_bin_bios 2013-06-10 02:33:33 +04:00
Anton Kochkov
dd8d2c9df3 Fixes in BIOS image checking
Fixed entrypoint address
Added checks for valid entrypoint opcodes (jmp opcode)
2013-06-10 01:30:40 +04:00
pancake
cdea34616d Fix some warnings 2013-06-09 02:55:03 +02:00
pancake
4d32b6b8e4 Initial import of r_bin_bios plugin 2013-06-09 02:11:17 +02:00
pancake
3f1d3ba146 Better r_str_hash(), Fixes in CCa, Added ?h, Better rbin for BEOS bins
Identify Haiku binaries as 'beos' with noodle()
Fix CCa for non numeric offsets
Use sdb's r_str_hash() instead of old one (much less collisions)
Added ?h command to hash strings
CCa now appends instead of replacing comments
Do not mark as static if bin links to libs
2013-06-07 10:26:37 +02:00
pancake
26a7854dd6 Rewrite DEX parser 2013-04-25 03:42:17 +02:00
pancake
b77cdf33d7 Fix loading of MACH0 object files and fix build 2013-04-22 01:34:25 +02:00
pancake
426873d911 Better support for macros and fix dex checksum hint
- .(fix-dex) macro defined when loading a dex
2013-04-12 01:15:00 +02:00
pancake
032860782d Add checksum correction hints for DEX 2013-04-11 01:25:25 +02:00
pancake
efb02c8a95 Fix optimization that was invalidating all C* commands 2013-04-05 12:37:28 +02:00
pancake
542de1b426 Avoid dup load of DEX, reduce calls to r_meta_cleanup
- Nicer output for command 'fd'
- Cache methods to avoi dup loading
- Fix delimiter in internal grep (allow '/')
- Faster r_meta processing (reduce calls to meta_cleanup
2013-04-05 02:55:47 +02:00
pancake
dd301cd6a7 Add adler32 checksum, fixes in dex, add 'ws' command
- Handle ^C in searches
- Safer progerssbar for small terminals
- Add 'ws' command to write pascal/dalvik/java strings
- Fix visual refresh on terminal resize
- Partially fix dex negative section issue
2013-04-05 01:53:21 +02:00
pancake
128097572a Optimize DEX header parsing. Fix 'psp' command
Added r_buf_get_at() method to avoid copies
2013-04-04 23:19:19 +02:00
Anton Kochkov
e62e837b7a TE: 16 bit for _TEXT_RE and fixes for virtual addresses calculations 2013-03-29 04:33:45 +04:00
pancake
6fbbb3dea0 Add arch/bits fields in RBinSection (breaks abi) 2013-03-26 23:37:19 +01:00