【问题标题】:Is GDB capable of changing (JLE to JGE)?GDB 能够改变(JLE 到 JGE)吗?
【发布时间】:2019-09-01 05:23:53
【问题描述】:

GDB 是否能够更改某些程序任务?比如从“jle”(跳转小于等于)到“jge”(跳转大于等于)。

来自:0x0000000000400563 <+45>: jle 0x400547 <main+17>

收件人:0x0000000000400563 <+45>: jge 0x400547 <main+17>

【问题讨论】:

    标签: gdb reverse-engineering


    【解决方案1】:

    GDB 是否能够改变内存算法?

    什么是“记忆算法”?

    比如从“jle”(跳转小于等于)到“jge”(跳转大于等于)。

    您的问题非常不清楚。我认为你在问:我可以改变一个程序来执行 JGE 而不是当前 GDB 中的 JLE 指令吗?

    如果这是你的问题,答案是肯定的。

    1. 查找当前与disas/r 0x400563,0x400564 命令一起使用的操作码。
    2. 将操作码更改为JGE 的操作码并分配给指令操作码。

    例子:

    (gdb) disas/r 0x400496,0x400497
    Dump of assembler code from 0x400496 to 0x400497:
       0x0000000000400496 <main(int, char**)+15>:   7e 07   jle    0x40049f <main(int, char**)+24>
    End of assembler dump.
    

    操作码是0x7EJGE 的操作码是 0x7D (table)。

    让我们修补一下。您可以对正在运行的进程执行此操作:

    (gdb) start
    (gdb) set *(char*)0x400496 = 0x7d
    (gdb) disas/r 0x400496,0x400497
    
    
    Dump of assembler code from 0x400496 to 0x400497:
       0x0000000000400496 <main(int, char**)+15>:   7d 07   jge    0x40049f <main(int, char**)+24>
    End of assembler dump.
    

    或者您可以更新磁盘上的二进制文件,但调用gdb --write a.out

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-28
      • 2011-08-11
      • 1970-01-01
      相关资源
      最近更新 更多