如何仅从 objdump(或任何其他程序)导出操作码
逆向工程
恶意软件
转储
操作码
2021-06-22 08:35:47
3个回答
如果要提取所有操作码,可以尝试运行以下命令:
objdump -d ./your_program|grep '[0-9a-f]:'|grep -v 'file'|cut -f2 -d:|cut -f1-6 -d' '|tr -s ' '|tr '\t' ' '|sed 's/ $//g'|paste -d '' -s |sed 's/^/"/'|sed 's/$/"/g'
如果你需要一个shellcode格式(\x8d\x36\x8d...),你可以使用这个命令:
objdump -d ./your_program|grep '[0-9a-f]:'|grep -v 'file'|cut -f2 -d:|cut -f1-6 -d' '|tr -s ' '|tr '\t' ' '|sed 's/ $//g'|sed 's/ /\\x/g'|paste -d '' -s |sed 's/^/"/'|sed 's/$/"/g'
看看这个页面
您可以使用多个空格模式来撕掉操作码
$ objdump -d c:/windows/system32/calc.exe | sed s/.*:[[:space:]]//g | sed s/[[:space:]][[:space:]].*//g | head -n 10
Disassembly of section .text:
01001000 <.text>:
68 04 82 73 08
57
88 73 29
~$ objdump -d c:/windows/system32/calc.exe | head -n 10
c:/windows/system32/calc.exe: file format pei-i386
Disassembly of section .text:
01001000 <.text>:
1001000: 68 04 82 73 08 push $0x8738204
1001005: 57 push %edi
1001006: 88 73 29 mov %dh,0x29(%ebx)
这对我最有效(并且看起来更容易理解 IMO)
objdump -r -j .text -d test | cut -d: -f2 | cut -d$'\t' -f 2
shellcode 最好通过以下方式提取
hexdump -v -e '"\\""x" 1/1 "%02x" ""' test
