Aliases

radare2 also offers aliases which might help you save time by quickly executing your most used commands. They are under $?

The general usage of the feature is: $alias=cmd

[0x00404800]> $disas=pdf

The above command will create an alias disas for pdf. The following command prints the disassembly of the main function.

[0x00404800]> $disas @ main

Apart from commands, you can also alias a text to be printed, when called.

[0x00404800]> $my_alias=$test input

[0x00404800]> $my_alias

test input

To undefine alias, use $alias=:

[0x00404800]> $pmore='b 300;px'

[0x00404800]> $

$pmore

[0x00404800]> $pmore=

[0x00404800]> $


A single $ in the above will list all defined aliases. It's also possible check the aliased command of an alias:

[0x00404800]> $pmore?

b 200; px

Can we create an alias contains alias ? The answer is yes:

[0x00404800]> $pStart='s 0x0;$pmore'

[0x00404800]> $pStart

- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF

0x00000000 7f45 4c46 0201 0100 0000 0000 0000 0000 .ELF............

0x00000010 0300 3e00 0100 0000 1014 0000 0000 0000 ..>.............

0x00000020 4000 0000 0000 0000 5031 0000 0000 0000 @.......P1......

0x00000030 0000 0000 4000 3800 0d00 4000 1e00 1d00 ....@.8...@.....

0x00000040 0600 0000 0400 0000 4000 0000 0000 0000 ........@.......

0x00000050 4000 0000 0000 0000 4000 0000 0000 0000 @.......@.......

0x00000060 d802 0000 0000 0000 d802 0000 0000 0000 ................

0x00000070 0800 0000 0000 0000 0300 0000 0400 0000 ................

0x00000080 1803 0000 0000 0000 1803 0000 0000 0000 ................

0x00000090 1803 0000 0000 0000 1c00 0000 0000 0000 ................

0x000000a0 1c00 0000 0000 0000 0100 0000 0000 0000 ................

0x000000b0 0100 0000 0400 0000 0000 0000 0000 0000 ................

0x000000c0 0000 0000 0000 0000 ........

[0x00000000]>

Загрузка...