You can resize a section like this:
$ rabin2 -O r/.data/1024 a.out
but bear in mind that if you resize .text, all the refs from the
following sections will
need to be reallocated, and this will require some more work
reassembling code.
If you want to write code in your binary use the -w flag to open in
read-write.
then use 'wa' to write assembly, or 'wx' to write hexpairs.
You can use 'rasm2' from commandline to assemble instructions, but from
commandline
you'll have to provide the offset to avoid writing invalid patches.
As Pete pointed, you may check the article I wrote for the phrack, but
bear in mind that
the paper is based on r1, not r2. I encourage you to use r2 in order to
find bugs and report
issues or missing things, so we can deprecate r1 :)
--pancake
On 01/06/12 01:41, Pete Smith wrote:
Hi,
From what I have read if you're adding a largish section of code it's
better to make a small modification to the code segment which will
load your new code out of the data segment into rwx memory.
There's a great article on Phrack that pancake wrote that explains
some of the things you can do to achieve this.
Phrack 66: manual binary mangling with radare
http://www.phrack.org/issues.html?issue=66&id=14
<http://www.phrack.org/issues.html?issue=66&id=14>
Cheers,
Pete
On 6 January 2012 03:35, Rafael de Oliveira Costa
<[email protected]
<mailto:[email protected]>> wrote:
Hi,
I don't know if here is the right place to ask this but I would
like to know if radare2 can help me to add instructions on text
segment of a program. I know that this task can cause problems.
I've looked resize command of radare2 and I can insert bytes but
this bytes are inserted in data segment.
Rafael de Oliveira Costa,M.Sc. Student
PPGI - UFRJ
Rio de Janeiro, RJ, Brazil
http://www.labnet.nce.ufrj.br <http://www.labnet.nce.ufrj.br/>
"If the doors of perception were cleansed every thing would appear
to man as it is, infinite", William Blake
_______________________________________________
radare mailing list
[email protected] <mailto:[email protected]>
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org