How would I setup my scripts to auto update memory addresses
Posted: Mon Mar 01, 2010 2:50 pm
How would I setup my scripts to auto update memory addresses?
MicroMacro home
https://www.solarstrike.net/phpBB3/
Code: Select all
005D7F6F 8B0D C0939600 MOV ECX,DWORD PTR DS:[9693C0]
Code: Select all
005D7F67 0F84 07040000 JE Client.005D8374
005D7F6D 8B07 MOV EAX,DWORD PTR DS:[EDI]
005D7F6F 8B0D C0939600 MOV ECX,DWORD PTR DS:[9693C0]
005D7F75 56 PUSH ESI
005D7F76 50 PUSH EAX
Code: Select all
local charUpdatePattern = string.char(0x8B, 0x07, 0x8B, 0x0D, 0xFF, 0xFF, 0xFF, 0xFF, 0x56, 0x50, 0xE8);
local charUpdateMask = "xxxx????xxx";
local charUpdateOffset = 4;
function findOffsets()
local staticcharbase, staticmacrobase;
-- Find the character's static base
local found = findPatternInProcess(getProc(), getCharUpdatePattern(), getCharUpdateMask(), 0x550000, 0xA0000);
if( found == 0 ) then
error("Unable to find static char base pointer in module.", 0);
end
addresses.staticpattern_char = found;
addresses.staticbase_char = memoryReadInt(getProc(), found + getCharUpdateOffset());
if( addresses.staticbase_char == nil ) then
error("Found char pattern, but unable to read memory.\n");
end
-- Find the macro static base
local found = findPatternInProcess(getProc(), getMacroUpdatePattern(), getMacroUpdateMask(), 0x6F0000, 0xA0000);
if( found == 0 ) then
error("Unable to find static macro base pointer in module.", 0);
end
addresses.staticpattern_macro = found;
addresses.staticbase_macro = memoryReadInt(getProc(), found + getMacroUpdateOffset());
if( addresses.staticbase_macro == nil ) then
error("Found macro pattern, but unable to read memory.\n");
end
printf("addresses.staticbase_char: 0x%X\n", addresses.staticbase_char);
printf("addresses.staticbase_macro: 0x%X\n", addresses.staticbase_macro);
end
Code: Select all
03B85066 7A 69 JPE SHORT fff.03B850D1
03B85068 0300 ADD EAX,DWORD PTR DS:[EAX]
03B8506A 0000 ADD BYTE PTR DS:[EAX],AL
03B8506C 6203 BOUND EAX,QWORD PTR DS:[EBX]
03B8506E 0000 ADD BYTE PTR DS:[EAX],AL
03B85070 005D 55 ADD BYTE PTR SS:[EBP+55],BL
03B85073 47 INC EDI
03B85074 0000 ADD BYTE PTR DS:[EAX],AL
03B85076 0000 ADD BYTE PTR DS:[EAX],AL
03B85078 3F AAS ////////////////This is the address I need.///////////////////////
03B85079 0000 ADD BYTE PTR DS:[EAX],AL
03B8507B 0029 ADD BYTE PTR DS:[ECX],CH
03B8507D 5C POP ESP
03B8507E 8F ??? ; Unknown command
03B8507F 3F AAS
03B85080 0000 ADD BYTE PTR DS:[EAX],AL
03B85082 0000 ADD BYTE PTR DS:[EAX],AL
03B85084 0000 ADD BYTE PTR DS:[EAX],AL
03B85086 0000 ADD BYTE PTR DS:[EAX],AL
03B85088 0000 ADD BYTE PTR DS:[EAX],AL
03B8508A 0000 ADD BYTE PTR DS:[EAX],AL
You start wherever you want.Do I need to start adding the pattern from the JPE SHORT xenimus
I don't think so. There's no address in an AAS command. You're looking for a constant first.03B85078 3F AAS ////////////////This is the address I need.///////////////////////
Code: Select all
printf("fff\n");
setStartKey(key.VK_DELETE);
setStopKey(key.VK_END);
function main()
myProc = openProcess( findProcess("fff") );
local HPPattern = string.char(0x3F, 0x00, 0x00, 0x00, 0x29, 0x5C, 0x8F, 0x3F);
local HPMask = "xxxxxxxx";
local HPAddress = findPatternInProcess(myProc, HPPattern, HPMask, 0x300000, 0x10000);
if( HPAddress == 0 ) then
printf("Failed to find the pattern in the process.\n");
end
printf("HP Adress: %d\n", HPAddress);
HP = memoryReadByte(myProc, HPAddress);
printf("HP Value: %d\n", HP);
running = false;
while(running) do
--curX = memoryReadInt(myProc, 0x02C85944); --My current X position
--curY = memoryReadInt(myProc, 0x0157D78C); --My current Y position
end
end
startMacro(main);
Start the game a few times and make snapshots of the same stack area to find out which opcodes are dynamic and which not.Exempt wrote:Do I need to start adding the pattern from the JPE SHORT xenimus... all the way to the address i need or do i keep going down a few?
Code: Select all
77AE000D C3 RETN
77AE000E 90 NOP
77AE000F 90 NOP
77AE0010 8B4C24 04 MOV ECX,DWORD PTR SS:[ESP+4]
77AE0014 F641 04 06 TEST BYTE PTR DS:[ECX+4],6
77AE0018 74 05 JE SHORT ntdll.77AE001F
77AE001A E8 411D0100 CALL ntdll.ZwTestAlert
Code: Select all
03B85078 3F AAS
03B85079 0000 ADD BYTE PTR DS:[EAX],AL
03B8507B 0029 ADD BYTE PTR DS:[ECX],CH
03B8507D 5C POP ESP
03B8507E 8F ??? ; Unknown command
03B8507F 3F AAS
03B85080 0000 ADD BYTE PTR DS:[EAX],AL
03B85082 0000 ADD BYTE PTR DS:[EAX],AL
Code: Select all
local HPPattern = string.char(0x3F, 0x00, 0x00, 0x00, 0x29, 0x5C, 0x8F, 0x3F);
Code: Select all
77B6F546 EB 07 JMP SHORT ntdll.77B6F54F
77B6F548 33C0 XOR EAX,EAX
77B6F54A 40 INC EAX
77B6F54B C3 RETN
77B6F54C 8B65 E8 MOV ESP,DWORD PTR SS:[EBP-18]
77B6F54F C745 FC FEFFFFFF MOV DWORD PTR SS:[EBP-4],-2
77B6F556 6A 00 PUSH 0
77B6F558 E8 1B2DFBFF CALL ntdll.RtlExitUserThread
77B6F55D CC INT3
77B6F55E 90 NOP
77B6F55F 90 NOP
Code: Select all
004198F6 . E8 5583FEFF CALL fff.00401C50
004198FB . B9 98D88506 MOV ECX,Xenimus.0685D898
00419900 . E8 8B7FFEFF CALL fff.00401890
00419905 . A1 B0D88506 MOV EAX,DWORD PTR DS:[685D8B0] --This is where search constant stops.
0041990A . 8B0D B4D88506 MOV ECX,DWORD PTR DS:[685D8B4]
00419910 . 8B15 B8D88506 MOV EDX,DWORD PTR DS:[685D8B8]
00419916 . A3 BCC91903 MOV DWORD PTR DS:[319C9BC],EAX
0041991B . 2B05 2490F403 SUB EAX,DWORD PTR DS:[3F49024]
00419921 . 890D 8C32E502 MOV DWORD PTR DS:[2E5328C],ECX
00419927 . 890424 MOV DWORD PTR SS:[ESP],EAX
Code: Select all
0xA1, 0xFF, 0xFF, 0xFF, 0xFF, 0x8B, 0x0D, 0xFF, 0xFF, 0xFF, 0xFF,
0x8B, 0x15, 0xFF, 0xFF, 0xFF, 0xFF, 0xA3
Code: Select all
mouseX Address: 0x419905
mouseY Address: 0x419909
mouseX Value: -95
mouseY Value: 6
Stopping execution.
Code: Select all
printf("fff\n");
setStartKey(key.VK_DELETE);
setStopKey(key.VK_END);
function main()
myProc = openProcess( findProcess("fff") );
local mouseXPat = string.char(0xA1, 0xFF, 0xFF, 0xFF, 0xFF, 0x8B, 0x0D, 0xFF, 0xFF, 0xFF, 0xFF,
0x8B, 0x15, 0xFF, 0xFF, 0xFF, 0xFF, 0xA3);
local mouseXMask = "x????xx????xx????";
local mouseXAdd = findPatternInProcess(myProc, mouseXPat, mouseXMask, 0x400000, 0x40000);
local mouseYAdd = mouseXAdd + 0x4;
if( mouseXAdd == 0 ) then
printf("Failed to find the pattern in the process.\n");
end
mouseX = memoryReadByte(myProc, mouseXAdd);
mouseY = memoryReadByte(myProc, mouseYAdd);
printf("mouseX Address: 0x%X\n", mouseXAdd);
printf("mouseY Address: 0x%X\n", mouseYAdd);
printf("mouseX Value: %d\n", mouseX);
printf("mouseY Value: %d\n", mouseY);
running = false;
while(running) do
--curX = memoryReadInt(myProc, 0x02C85944); --My current X position
--curY = memoryReadInt(myProc, 0x0157D78C); --My current Y position
end
end
startMacro(main);
Since your pattern starts with the MOV command (0xA1), you need to add 1 byte to the result so that you're reading the address; not the 0xA1 + 3 bytes of the address.local mouseXAdd = findPatternInProcess(myProc, mouseXPat, mouseXMask, 0x400000, 0x40000) +1;
Code: Select all
Started.
mouseX Address: 0x419905 --This is the address it returns
mouseY Address: 0x419909 --This address is mouseX +0x4
mouseX Value: -2049396575 --This is mouseX's value
mouseY Value: -1274180858 --This is mouseY's value
Stopping execution.