MicroMacro 1.0 beta

Message
Author
User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

MicroMacro 1.0 beta

#1 Post by Administrator » Mon Dec 29, 2008 8:21 am

Note: MicroMacro 1.0 can be found on the download page.

Here you go. There isn't much difference as far as features, but this version should have less bugs when it is complete.

changelog:
0.99 -> 1.0
* memoryRead* functions only return 1 value again. If an error occures, they return nil.
* registerKey() renamed to netPushKey().
* bit.* functions remapped to bitAnd(), bitOr(), bitLShift(), bitRShift().
* Added custom 'commands' directory for command scripts.
* Added function saveScreenshot() to save screenshots of the specified window (or 0 for desktop).
* Added function findPatternInProcess() to aid in finding addresses that may move when the game client updates.
* Added functions for getting/setting startKey and stopKey.
* Added function getAttachedHwnd() to return the handle of the attached window, or 0 if not attached.
* When attached, start and stop hotkeys only take affect when the target or MicroMacro window have focus.
* Corrected minor bugs in XML parsing.
* findWindow() and findWindowList() now can accept a second parameter; a specific control within a window.
* Made a minor improvement to keyboardType().
* Fixed a bug with function stopPE() that would cause it to not pause execution.
* Added getTime() and deltaTime() functions to get the current time, and difference between times with higher precision.
* Improved precision of yrest().
* Updated to Lua 5.1.4
* memoryReadString* functions that specify a length will read and return a string of that length, even if a NULL terminator is reached first.
* unregisterTimer() no longer generates an error when trying to unregister a non-existing timer.
* Added isDirectory() function to check if the given fully qualified path is a directory or not.
* Improved operating system detection.
* Added attachKeyboard() and attachMouse() to attach specifically one device; attach() still attaches both devices.
* Fixed window title not changing properly under Vista.
* Added memory access protection to host process; helps protect the user against malicious scripts.
* Window previews (thumbnails) will no longer be returned by findWindow() or findWindowList() unless specifically asked for (by class name).
* Removed memoryWriteU* functions. You can now use the standard memoryWrite* functions to write signed or unsigned. (only affects write functions, not read!)
* Automatic timers now run in a separate coroutine. You may now place while loops and yrests inside of timed functions without dirupting the flow of the script.
* Added getWindowClassName() function.
* Fixed network object finalizer functions causing MicroMacro to freeze.
* Improved speed of endian swapping when sending/receiving information.
* Added netGetAddress() to return the address of a remote connection.
* Fixed traceback output.
* Plugin system completely removed; Use Lua modules instead (work almost exactly the same way)
* Added cprintf_ex() function; cprintf() is now deprecated.
* Beta version number is now displayed in the log and window title.
* Window title resets back to default when re-initializing.
* Fixed a bug in the XML parser that caused negitive numbers to be returned as strings.
* Fixed an XML parser bug that caused empty strings to be returned as empty strings; they will now be returned as nil.
* Added function warning() which works almost exactly like error(), except it does not end script execution.
* Threads will no longer get out of control and block the user from stopping or killing (CTRL+L) the script.
* All memoryRead*Ptr() and memoryWrite*Ptr() functions can now accept a table of offsets for pointer chains.
* Added memory read/write functions for double type.
* Added lib/autoload.lua - place Lua and DLL files to autoload here.
* Automatically create a randomly generated network encryption key if net.lua does not exist.
* Added a proxy Lua DLL for better module compatibility.
* Fixed a bug in module loading (not running a returned function).
* Script input now assumes .lua extension if none is given (and file does not exist in current state).
* Added getModuleAddress() to return the address of a specific module inside of the given process.
* Added getTimerFrequency() to return CPU frequency and full operator support for time types.

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: MicroMacro 1.0 beta

#2 Post by 3cmSailorfuku » Mon Dec 29, 2008 8:39 am

Code: Select all

* Added function saveScreenshot() to save screenshots of the specified window (or 0 for desktop).
* Added function findPatternInProcess() to aid in finding addresses that may move when the game client updates.
Awesome, good job. Now in the next release I demand integrated curl :3 :lol:

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#3 Post by Administrator » Mon Dec 29, 2008 9:01 am

Curl will be made a plugin due to its rather large dependencies. It would be at least 3MB. It will get done eventually, though. The plugin system just needs a bit of updating first (but will be compatible with older plugins).

Zephyr
Posts: 86
Joined: Fri Apr 18, 2008 8:10 pm

Re: MicroMacro 1.0 beta

#4 Post by Zephyr » Wed Dec 31, 2008 5:16 pm

noticed the comment in the general forum about pattern matching

is that what the Client.exe+455B68 was for in RoM addresses.lua?

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#5 Post by Administrator » Wed Dec 31, 2008 5:30 pm

Nope. Disregard that. It's just another way of writing a pointer.

The pattern matching works by examining the client's code section of memory and finding functions that use a specific pointer. It then retrieves the pointer from those functions.

Zephyr
Posts: 86
Joined: Fri Apr 18, 2008 8:10 pm

Re: MicroMacro 1.0 beta

#6 Post by Zephyr » Thu Jan 01, 2009 5:03 pm

ok. went to give this a try today. no go so far. looks like something is written in the screen but it closes to quick.

this is all the log says
Thu Jan 01 14:56:19 2009 : MicroMacro v1.0
Thu Jan 01 14:56:19 2009 : Processor Type: 8X 586, OS: Windows Vista | Windows Server 2008 Service Pack 1
I am running Vista 64 if that has anything to do with it. .99 works fine though.

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#7 Post by Administrator » Thu Jan 01, 2009 7:21 pm

Zephyr: I've added a bit more logging. Can you run try using the attached executable and post another log?

Zephyr
Posts: 86
Joined: Fri Apr 18, 2008 8:10 pm

Re: MicroMacro 1.0 beta

#8 Post by Zephyr » Thu Jan 01, 2009 8:11 pm

Thu Jan 01 18:11:10 2009 : MicroMacro v1.0
Thu Jan 01 18:11:10 2009 : Processor Type: 8X 586, OS: Windows Vista | Windows Server 2008 Service Pack 1
Thu Jan 01 18:11:10 2009 : Failed to initialize macro system.
not much more..

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#9 Post by Administrator » Fri Jan 02, 2009 4:52 am

Ok, here's another version. I think this might fix the problem, but if it doesn't it should help to locate it.

Zephyr
Posts: 86
Joined: Fri Apr 18, 2008 8:10 pm

Re: MicroMacro 1.0 beta

#10 Post by Zephyr » Fri Jan 02, 2009 12:56 pm

that one worked.

and the log anyways..
Fri Jan 02 10:55:12 2009 : MicroMacro v1.0
Fri Jan 02 10:55:12 2009 : Processor Type: 8X 586, OS: Windows Vista | Windows Server 2008 Service Pack 1
Fri Jan 02 10:55:12 2009 : Checking devices...
Fri Jan 02 10:55:12 2009 : Devices are NULL. OK.
Fri Jan 02 10:55:12 2009 : Creating devices.
Fri Jan 02 10:55:12 2009 : Devices created.
Fri Jan 02 10:55:12 2009 : Debugging privileges set.
Fri Jan 02 10:55:12 2009 : Opening Lua libraries...
Fri Jan 02 10:55:12 2009 : Lua libraries opened.
Fri Jan 02 10:55:12 2009 : LuaCoco is available.
Fri Jan 02 10:55:12 2009 : Registering Lua functions...
Fri Jan 02 10:55:12 2009 : Lua glues exported.
Fri Jan 02 10:55:12 2009 : Keyboard layout: US English

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: MicroMacro 1.0 beta

#11 Post by 3cmSailorfuku » Wed Jan 07, 2009 7:55 pm

I know I'm an annoyance, but can you give me a little hand with the findPatterninProcess() function?

local pattern = string.char(0xD9, 0x3D, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0xAE, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00);
staticbase = findPatternInProcess(getProc(), pattern, "xxxxxxxxxx????xx", 0x00840000, 0x00100000) + 0xB;


I've found the Player HP in a different game and browsed the memory region to get the bytes of the instructions (I assume so)
which would be:
00 7f 00 00 00 00 00 00 00 13 01 00 00 [13 01] (Adress I want) 00 00 00 00 00 00 00 00 80 3f 0c
xxxxxxxxxxxxx??xxxxxxxxxxxxx
Does 0x00840000, 0x00100000 mean the Range it should search for this pattern?
The instruction itself is static so I dont think I need to recalculate the base from a static point in the memory, like you do with + 0xB?

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#12 Post by Administrator » Thu Jan 08, 2009 3:06 am

What do you mean with the numbers in square brackets? Do you mean it can be one or the other, or do you mean that those two both change?

The string mask marks "x" for exact matches, and "?" for anything that can change. For the address, you should use pattern 0x00 0x00 0x00 0x00, and string mask "????". The last two parameters are for starting position and length. I actually used a very broad range in mine that wasn't entirely necessary. The lower the range, the quicker it will be to find the match.
The instruction itself is static so I dont think I need to recalculate the base from a static point in the memory, like you do with + 0xB?
The reason for + 0xB is because of the offset of the address from the start of the match. The returned address is where the match starts, not the address, so you have to add to it to give the right address of the address you're reading. In your case, + 14 or + 15 should work, depending on what you meant with the square brackets.

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: MicroMacro 1.0 beta

#13 Post by 3cmSailorfuku » Thu Jan 08, 2009 7:25 am

Administrator wrote:What do you mean with the numbers in square brackets? Do you mean it can be one or the other, or do you mean that those two both change?

The string mask marks "x" for exact matches, and "?" for anything that can change. For the address, you should use pattern 0x00 0x00 0x00 0x00, and string mask "????". The last two parameters are for starting position and length. I actually used a very broad range in mine that wasn't entirely necessary. The lower the range, the quicker it will be to find the match.
The instruction itself is static so I dont think I need to recalculate the base from a static point in the memory, like you do with + 0xB?
The reason for + 0xB is because of the offset of the address from the start of the match. The returned address is where the match starts, not the address, so you have to add to it to give the right address of the address you're reading. In your case, + 14 or + 15 should work, depending on what you meant with the square brackets.
Thank you, I understand now the rest. Basically I was wrong.

Code: Select all

local pattern = string.char(0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x0C);
FoundPlayerHP = findPatternInProcess(getProc(), pattern, "xxxxxxxxxxxxxxxxxxxxxxxxx", 0x00840000, 0x00100000) + 0xE;
0x13 0x01 would be mov [eax],al or something.

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#14 Post by Administrator » Thu Jan 08, 2009 12:54 pm

The address still needs a mask of "????" since it will not match 0x00 0x00 0x00 0x00. Other than that, just make sure nothing else in that region changes.

Zephyr
Posts: 86
Joined: Fri Apr 18, 2008 8:10 pm

Re: MicroMacro 1.0 beta

#15 Post by Zephyr » Sun Jan 11, 2009 9:17 pm

ok with the new RoM script i get an error when using MM1.0. If I use ver .99 it is fine.

I am posting here so there is not mass posting asking for ver 1.0
Sun Jan 11 19:15:38 2009 : MicroMacro v1.0
Sun Jan 11 19:15:38 2009 : Processor Type: 8X 586, OS: Windows Vista | Windows Server 2008 Service Pack 1
Sun Jan 11 19:15:38 2009 : Checking devices...
Sun Jan 11 19:15:38 2009 : Devices are NULL. OK.
Sun Jan 11 19:15:38 2009 : Creating devices.
Sun Jan 11 19:15:38 2009 : Devices created.
Sun Jan 11 19:15:38 2009 : Debugging privileges set.
Sun Jan 11 19:15:38 2009 : Opening Lua libraries...
Sun Jan 11 19:15:38 2009 : Lua libraries opened.
Sun Jan 11 19:15:38 2009 : LuaCoco is available.
Sun Jan 11 19:15:38 2009 : Registering Lua functions...
Sun Jan 11 19:15:38 2009 : Lua glues exported.
Sun Jan 11 19:15:38 2009 : Keyboard layout: US English
Sun Jan 11 19:15:45 2009 : Executing script 'bot.lua'
==================================================

Sun Jan 11 19:15:45 2009 : scripts\rom/bot.lua:13: attempt to call global 'setStartKey' (a nil value)
Sun Jan 11 19:15:45 2009 : Execution error: Runtime error
Sun Jan 11 19:15:45 2009 : Checking devices...
Sun Jan 11 19:15:45 2009 : Devices are NULL. OK.
Sun Jan 11 19:15:45 2009 : Creating devices.
Sun Jan 11 19:15:45 2009 : Devices created.
Sun Jan 11 19:15:45 2009 : Debugging privileges set.

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#16 Post by Administrator » Sun Jan 11, 2009 9:32 pm

Add those functions to lib.lua and modify the variables to be local.

Code: Select all

local startKeyDefault = key.VK_F5;
local stopKeyDefault = key.VK_F6;

local startKey = startKeyDefault;
local stopKey = stopKeyDefault;

function setStartKey(val)
    startKey = val
end

function getStartKey()
    return startKey
end

function setStopKey(val)
    stopKey = val
end

function getStopKey()
    return stopKey
end
I've uploaded a full update and attached it to the first post again.

crackpod
Posts: 11
Joined: Mon Dec 29, 2008 8:30 am

Re: MicroMacro 1.0 beta

#17 Post by crackpod » Mon Jan 26, 2009 10:53 am

I don't really know if it's already possible or planned but why don't you think about integrating "Alien" into MicroMacro. This way it would be possible to access external functions written in C/C++ if I am not mistaken.

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: MicroMacro 1.0 beta

#18 Post by 3cmSailorfuku » Mon Jan 26, 2009 12:13 pm

crackpod wrote:I don't really know if it's already possible or planned but why don't you think about integrating "Alien" into MicroMacro. This way it would be possible to access external functions written in C/C++ if I am not mistaken.
Asfar as I know "Alien" only lets you call DLLs containing those functions you made, and having them return a value back to the interpretor.
This is already possible in micromacro.

Anyway, I'd like to revive my dumbness over the findpattern function. I've made a graphical chart to see what I'd like to achieve and what I believe I need to know.
Note that I've only used 17 Bytes in the example at the bottom.

Image
I've also made a slight error, it should be ) + 0x1.

User avatar
Administrator
Site Admin
Posts: 4850
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 1.0 beta

#19 Post by Administrator » Mon Jan 26, 2009 4:43 pm

Cheat Engine's memory viewer is a bit odd. You have to scroll up and down a bit after using the "Go to address" function so that the bytes will properly re-align with the correct ASM instructions. Now you use the bytes that refer to the ASM instruction being used, and use whatever you want (I find that 0xFF works well) for dynamic stuff (such as addresses).

In your example, 0x60, 0xB8, 0xFF, 0xFF, 0xFF, 0xFF, 0x37, 0x04, 0x02 ... would work. As you can see, the first byte is going to be the instruction and should be static. 0xB8, 0x2C, 0x0F, 0xB8, 0x77 is the mov instruction (0xB8) on the address 0x2C0FB877. That address can (and probably will) change. Now, next you'll see that 0x04, 0x02 (add 2 into AL) is not (or does not appear to be) dynamic, so we can actually use the 0x02 this time. So, the string mask for this would be "xx????xxx". Make sense?

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: MicroMacro 1.0 beta

#20 Post by 3cmSailorfuku » Mon Jan 26, 2009 5:11 pm

Thank you, I finally understood the theory about it. As always, good help. (:

Locked

Who is online

Users browsing this forum: No registered users and 1 guest