如何从反汇编二进制文件中读取函数?

问题描述 投票:0回答:1

我试图找出二进制文件中的某些功能,这就是其中之一。我已经连续研究了几个小时,这似乎很简单,但是我对此并不陌生,所以我不确定。到目前为止,我所看到的似乎是3个参数的类型为short,而1个参数的类型为long long。最后还有一个打印语句,所以只是打印出变量吗?

70: sym.func.100000d00 (int64_t arg1, int64_t `arg3, int64_t arg4, int64_t arg7);
; var int64_t var_1ch @ rbp-0x1c
; var int64_t var_18h @ rbp-0x18
; var int64_t var_10h @ rbp-0x10
; var int64_t var_ch @ rbp-0xc
; var int64_t var_5h @ rbp-0x5
; var int64_t var_4h @ rbp-0x4
; arg int64_t arg1 @ rdi
; arg int64_t arg3 @ rdx
; arg int64_t arg4 @ rcx
; arg int64_t arg7 @ xmm0
0x100000d00      push rbp          ; [00] -r-x section size 549 named 0.__TEXT.__text
0x100000d01      mov rbp, rsp
0x100000d04      sub rsp, 0x20
0x100000d08      mov al, sil
0x100000d0b      mov dword [var_4h], edi ; arg1
0x100000d0e      mov byte [var_5h], al
0x100000d11      mov dword [var_ch], edx ; arg3
0x100000d14      mov dword [var_10h], ecx ; arg4
0x100000d17      movsd qword [var_18h], xmm0 ; arg7
0x100000d1c      mov esi, dword [var_4h]
0x100000d1f      mov edx, dword [var_ch]
0x100000d22      mov ecx, dword [var_10h]
0x100000d25      movsd xmm0, qword [var_18h]
0x100000d2a      movsx r8d, byte [var_5h]
0x100000d2f      lea rdi, qword str.d__2d:_2d:_6.3lf__cM ; 0x100000f58 ; const char *format
0x100000d36      mov al, 1
0x100000d38      call section.1.__TEXT.__stubs ; sym.imp.printf ; int printf(const char *format)
0x100000d3d      mov dword [var_1ch], eax
0x100000d40      add rsp, 0x20
0x100000d44      pop rbp
0x100000d45      ret
assembly x86-64 reverse-engineering
1个回答
0
投票
int foo(int a, char b, int c, int d, double e)
{
    int printed = printf("%d %2d:%2d:%6.3lf%cM", a, c, d, e, b);
    return printed;
}

请注意,double e参数可以位于任何位置,因为不能从调用约定中推导出来。格式字符串也位于地址0x100000f58上,您自己检查一下,因为我只是尝试从生成的符号名中重建它。

© www.soinside.com 2019 - 2024. All rights reserved.