我正在学习 Windows 汇编语言masm
作为我的汇编器和link
链接器。我拿了以下汇编代码并获得了exe
.386
.model flat, stdcall
option casemap :none
extrn MessageBoxA@16 : PROC
extrn ExitProcess@4 : PROC
.code
start:
mov eax, 0
push eax
jmp msg
pgm: pop ebx
push ebx
push ebx
push eax
call MessageBoxA@16
push eax
call ExitProcess@4
msg: call pgm
db "KingKong",0
end start
C:\Arena>ml /c /coff a.asm
Microsoft (R) Macro Assembler Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: a.asm
C:\Arena>link /subsystem:windows /defaultlib:kernel32 /defaultlib:user32 a.obj
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
该程序运行良好并显示消息框,现在我运行 aobjdump -d a.exe
并获取 shellcode 并将其插入回来以获取可执行文件
.386
.model flat, stdcall
option casemap :none
extrn MessageBoxA@16 : PROC
extrn ExitProcess@4 : PROC
.code
start:
db 0xb8,0x00,0x00,0x00,0x00,0x50,0xeb,0x0f,0x5b,0x53,0x53,0x50,0xe8,0x1b,0x00,0x00,0x00,0x50,0xe8,0x0f,0x00,0x00,0x00,0xe8,0xec,0xff,0xff,0xff,0x4b,0x69,0x6e,0x67,0x4b,0x6f,0x6e,0x67,0x00,0xcc,0xff,0x25,0x00,0x20,0x40,0x00,0xff,0x25,0x08,0x20,0x40,0x00
end start
但是当我尝试组装它时,我得到了
C:\Arena>ml /c /coff b.asm
Microsoft (R) Macro Assembler Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: b.asm
b.asm(10) : error A2042:statement too complex
我能够在 linux 上使用 hexdump 取回可执行文件,并且该线程在这里。我现在只需要使用我在 Windows 上获得的 hexdump 来取回可执行文件。我该怎么做 ?
编辑拆分字节是一个很好的建议,我有
.386
.model flat, stdcall
option casemap :none
extrn MessageBoxA@16 : PROC
extrn ExitProcess@4 : PROC
.code
start:
db 0xb8,0x00,0x00,0x00,0x00,0x50,0xeb,0x0f
db 0x5b,0x53,0x53,0x50,0xe8,0x1b,0x00,0x00
db 0x00,0x50,0xe8,0x0f,0x00,0x00,0x00,0xe8
db 0xec,0xff,0xff,0xff,0x4b,0x69,0x6e,0x67
db 0x4b,0x6f,0x6e,0x67,0x00,0xcc,0xff,0x25
db 0x00,0x20,0x40,0x00,0xff,0x25,0x08,0x20
db 0x40,0x00
end start
但是当我把它喂给汇编器时,我得到了
C:\Arena>ml a.asm
Microsoft (R) Macro Assembler Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: a.asm
a.asm(10) : error A2206:missing operator in expression
a.asm(11) : error A2206:missing operator in expression
a.asm(12) : error A2206:missing operator in expression
a.asm(13) : error A2206:missing operator in expression
a.asm(14) : error A2206:missing operator in expression
a.asm(15) : error A2206:missing operator in expression
a.asm(16) : error A2206:missing operator in expression
仅给定十六进制代码,如何取回可执行文件?