【问题标题】:how to give a name to global varrible in radare2?如何为radare2中的全局变量命名?
【发布时间】:2019-07-23 19:21:33
【问题描述】:

我有这样的事情:

(fcn) fcn.140001020 20
   fcn.140001020 ();
           ; XREFS: CALL 0x140001080  CALL 0x140001098  CALL 0x1400010b0  CALL 0
           ; XREFS: CALL 0x140001794  CALL 0x1400017ad  CALL 
           0x140001029      mov dword [0x140018a38], eax

我希望能够给地址 0x140018a38 起一个名字,这样它就会显示为:

           0x140001029      mov dword [myGlobal], eax

【问题讨论】:

    标签: radare2


    【解决方案1】:

    环境

    • radare2:radare2 4.2.0-git 23519 @ linux-x86-64 git.4.1.1-84-g0c46c3e1e 提交:0c46c3e1e30bb272a5a05fc367d874af32b41fe4 构建:2020-01-08__09:49:0
    • 系统: Ubuntu 18.04.3 LTS

    解决方案

    • 我不确定radare2 是否实现了您正在寻找的确切功能,但我们可以使用Cf 和CCa 命令接近。
      • CCa[-at]|[at] [text] [@addr] # 在给定地址添加/删除评论
      • cf[?][-] [sz] [0|cnt][fmt] [a0 a1...] [@addr] #格式化内存(见pf?)

    示例

    user@host:~$ r2 /my/example
    [0x00000000]> aaaa
    ...
    [0x00000000]> s fcn.140001020
    [0x140001020]> pd 1
    (fcn) fcn.140001020 20
       fcn.140001020 ();
               ; XREFS: CALL 0x140001080  CALL 0x140001098  CALL 0x1400010b0  CALL 0
               ; XREFS: CALL 0x140001794  CALL 0x1400017ad  CALL 
               0x140001029      mov dword [0x140018a38], eax
    [0x140001020]> CCa 0x140001020 0x140018a38 = myGlobal
    [0x140001020]> pd 1
    (fcn) fcn.140001020 20
       fcn.140001020 ();
               ; XREFS: CALL 0x140001080  CALL 0x140001098  CALL 0x1400010b0  CALL 0
               ; XREFS: CALL 0x140001794  CALL 0x1400017ad  CALL 
               0x140001029      mov dword [0x140018a38], eax ; 0x140001029 = myGlobal
    [0x140001020]> Cf 2 w myGlobal @ 0x140018a38
    [0x140001020]> pd 1 @ 0x140018a38
                0x140018a38 format w myGlobal {
     myGlobal : 0x140018a38 = 0xffff
    } 2
    [0x140001020]> q
    user@host:~$ 
    

    【讨论】:

    猜你喜欢
    • 2014-02-17
    • 2012-03-13
    • 2017-05-13
    • 2011-03-25
    • 1970-01-01
    • 2012-12-28
    • 2015-04-22
    • 2015-02-07
    • 2019-11-06
    相关资源
    最近更新 更多