linux 自修改代码 smc,[Win32]自修改代码SMC

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; SMC.ASM is a test piece for reading and writing to the code section

; of a PE file. In this example, there are two procedures, one which

; is called, the second that is read and written at the address

; of the first. The proc is called twice, before & after the code has

; been modified.

; --------------By G-Spider

; fasm smc.asm smc.exe

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

format PE GUI 4.0

entry start

include 'win32a.inc'

section '.text' code readable writeable executable

start:

call f1

mov esi,f2.rpStart

mov edi,f1.ppStart

mov ecx,f2.rpEnd-f2.rpStart

rep movsb

call f1

ret

;---------------------------------------------

f1:

.ppStart:

invoke MessageBox,0,Phony,ttl1,MB_OK

ret

.ppEnd:

;**********************************************

if (f2.rpEnd-f2.rpStart) > (f1.ppEnd-f1.ppStart)

repeat (f2.rpEnd-f2.rpStart)-(f1.ppEnd-f1.ppStart)

nop

end repeat

end if

;**********************************************

f2:

.rpStart:

cinvoke wsprintf,lpBuf,Replc,f1.ppStart-$$

invoke MessageBox,0,lpBuf,ttl2,MB_OK

ret

.rpEnd:

;---------------------------------------------

Phony db 'This is 1st call of proc',0

Replc db 'This is 2nd call of proc',0ah,'Current offset=%0Xh',0

ttl1 db "Original Code",0

ttl2 db "Replacement Code",0

lpBuf rb 64

section '.idata' import data readable writeable

library user32,'user32.dll'

import user32,\

MessageBox,'MessageBoxA',\

wsprintf,'wsprintfA'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值