Started working on new plugin
parent
fc745f70ae
commit
b29c719538
@ -0,0 +1 @@
|
||||
as -anl --32 -o functions.o functions.asm
|
@ -0,0 +1,19 @@
|
||||
.intel_syntax
|
||||
push eax
|
||||
push edx
|
||||
push ecx
|
||||
push ebx
|
||||
push eax
|
||||
mov eax,[esp+24]
|
||||
push eax
|
||||
function:
|
||||
call 0xdeadbeef
|
||||
function2:
|
||||
mov [0xdeadbeef],eax #self modifying code... :/
|
||||
pop eax
|
||||
function3:
|
||||
call [0xdeadbeef]
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -0,0 +1,36 @@
|
||||
onfunction={}
|
||||
function onfunction.install()
|
||||
ModData=engine.installMod("dfusion/onfunction/functions.o","functions")
|
||||
modpos=ModData.pos
|
||||
modsize=ModData.size
|
||||
onfunction.pos=modpos
|
||||
trgpos=engine.getpushvalue()
|
||||
print(string.format("Function installed in:%x function to call is: %x",modpos,trgpos))
|
||||
local firstpos=modpos+engine.FindMarker(ModData,"function")
|
||||
engine.poked(firstpos,trgpos-firstpos) --call first function
|
||||
engine.poked(modpos+engine.FindMarker(ModData,"function2"),modpos+engine.FindMarker(ModData,"function3")) -- function table start
|
||||
|
||||
end
|
||||
function OnFunction(values)
|
||||
print("Onfunction called!")
|
||||
print("Data:")
|
||||
for k,v in pairs(values) do
|
||||
print(string.format("%s=%x",k,v))
|
||||
end
|
||||
return 0 --todo return real address
|
||||
end
|
||||
function onfunction.patch(addr)
|
||||
|
||||
if(engine.peekb(addr)~=0xe8) then
|
||||
error("Incorrect address, not a function call")
|
||||
else
|
||||
--todo add to list of functions after patch
|
||||
engine.poked(addr+1,onfunction.pos-addr-1)
|
||||
end
|
||||
end
|
||||
mypos=engine.getmod("functions")
|
||||
if mypos then
|
||||
print("Onfunction already installed")
|
||||
else
|
||||
onfunction.install()
|
||||
end
|
Loading…
Reference in New Issue