Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Logging api calls
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Sun Jan 16, 2011 2:19 pm    Post subject: Reply with quote

Demolish wrote:
Wiccaan wrote:
Use showMessage(msg) then.

Example:
Code:
showMessage("Hello world!");

this isn't that easy, I'd like to know how to hook functions, not only ShowMessage, but send,recv functions of winsock


You asked how to show a message box as soon as you click execute, using showMessage() as the first thing in your script will accomplish that.

Heres a small example of hooking send:
Code:


--[[

    Send Hook Example
    by atom0s [Wiccaan]
   
]]--

local Hook_Example = {}

function Hook_Example.Main( )
    -- Obtain original send pointer.
    Hook_Example.sendPointer = getAddress( "send" );
   
    -- Error checking..
    if( Hook_Example.sendPointer == nil ) or ( Hook_Example.sendPointer == 0 ) then
        showMessage( "Failed to hook send, possibly not imported by process." );
        return false;
    end
   
    -- Set debugger callback.
    debugger_onBreakpoint = Hook_Example.OnBreakpoint;
   
    -- Apply breakpoint.
    debug_setBreakpoint( "send" );

    return true;
end

function Hook_Example.OnBreakpoint( )
    -- Skip if not send breakpoint.
    if( EIP ~= Hook_Example.sendPointer ) then
        return 1;
    end
   
    -- Obtain information from call stack.
    local retaddr   = readInteger( ESP );
    local socket    = readInteger( ESP + 4 );
    local buffer    = readInteger( ESP + 8 );
    local length    = readInteger( ESP + 12 );
    local flags     = readInteger( ESP + 16 );

    -- Remove hook after first break.   
    debug_removeBreakpoint( "send" );

    -- Display param info.
    showMessage( string.format(
        "Socket: %d\nBuffer: %d\nLength: %d\nFlags: %d", socket, buffer, length, flags
    ) );

    return 1;
end

Hook_Example.Main();

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Demolish
Cheater
Reputation: 0

Joined: 27 Dec 2010
Posts: 32

PostPosted: Sun Jan 16, 2011 2:44 pm    Post subject: Reply with quote

Ok, this is still not that what I wish to do ;p
For example: Your code is like a function of filter in a WPE PRO, I want to send packet like in WPE PRO. I want to call function from another process.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Sun Jan 16, 2011 3:05 pm    Post subject: Reply with quote

Demolish wrote:
Ok, this is still not that what I wish to do ;p
For example: Your code is like a function of filter in a WPE PRO, I want to send packet like in WPE PRO. I want to call function from another process.


You'll need to hook send like above to obtain the current socket being used for the overall connection. (Or locate a pointer that holds the socket in memory.)

Once you have the socket, you can use the CreateThread method of calling functions / API.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sun Jan 16, 2011 3:56 pm    Post subject: Reply with quote

as I said before, combine it with a dll
let the dll create a gui and let ce hook the api

That way it's a lot easier to show and modify stuff

e.g: See the packet editor plugin in ce 5.6.1: what it does is inject the dll that shows a gui and hook the winsock api so that whenm it's called it goes through the dll's function instead

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Demolish
Cheater
Reputation: 0

Joined: 27 Dec 2010
Posts: 32

PostPosted: Mon Jan 17, 2011 10:06 am    Post subject: Reply with quote

I've learned much from you both Very Happy This will help not only me but others Razz

Wiccaan wrote:
Demolish wrote:
Ok, this is still not that what I wish to do ;p
For example: Your code is like a function of filter in a WPE PRO, I want to send packet like in WPE PRO. I want to call function from another process.


You'll need to hook send like above to obtain the current socket being used for the overall connection. (Or locate a pointer that holds the socket in memory.)

Once you have the socket, you can use the CreateThread method of calling functions / API.


Shouldn't I use CreateRemoteThread? And can you tell me more about this function?

Dark Byte wrote:
as I said before, combine it with a dll
let the dll create a gui and let ce hook the api

That way it's a lot easier to show and modify stuff

e.g: See the packet editor plugin in ce 5.6.1: what it does is inject the dll that shows a gui and hook the winsock api so that whenm it's called it goes through the dll's function instead


It isn't Open Source for my bad ;/
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Mon Jan 17, 2011 2:21 pm    Post subject: Reply with quote

Demolish wrote:
I've learned much from you both Very Happy This will help not only me but others Razz

Wiccaan wrote:
Demolish wrote:
Ok, this is still not that what I wish to do ;p
For example: Your code is like a function of filter in a WPE PRO, I want to send packet like in WPE PRO. I want to call function from another process.


You'll need to hook send like above to obtain the current socket being used for the overall connection. (Or locate a pointer that holds the socket in memory.)

Once you have the socket, you can use the CreateThread method of calling functions / API.


Shouldn't I use CreateRemoteThread? And can you tell me more about this function?

Dark Byte wrote:
as I said before, combine it with a dll
let the dll create a gui and let ce hook the api

That way it's a lot easier to show and modify stuff

e.g: See the packet editor plugin in ce 5.6.1: what it does is inject the dll that shows a gui and hook the winsock api so that whenm it's called it goes through the dll's function instead


It isn't Open Source for my bad ;/


I meant with Cheat Engines scripting for CreateThread. You can inject a chunk of code as a function and use CreateThread to call it using Cheat Engines scripting. Check this thread out for an example of what I mean:

http://forum.cheatengine.org/viewtopic.php?p=5180265#5180265

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Demolish
Cheater
Reputation: 0

Joined: 27 Dec 2010
Posts: 32

PostPosted: Wed Jan 26, 2011 5:47 am    Post subject: Reply with quote

So, I have 1 more question and the question is on the picture:
Code:
img683.imageshack.us/f/questionc.png/
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Wed Jan 26, 2011 4:50 pm    Post subject: Reply with quote

Jumps are calculated. They are the relative position to either a jump table or the actual function itself.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Demolish
Cheater
Reputation: 0

Joined: 27 Dec 2010
Posts: 32

PostPosted: Thu Jan 27, 2011 3:05 pm    Post subject: Reply with quote

Wiccaan wrote:
Jumps are calculated. They are the relative position to either a jump table or the actual function itself.

ohh i forgot about it, thanks for remind me, that was very usefull for my project, i've wrote class in vb6 that calls functions in other processes like send, MessageBoxA, and alot more Very Happy I can hook every function to call it
;D
Back to top
View user's profile Send private message
SEVENS
How do I cheat?
Reputation: 0

Joined: 20 Nov 2012
Posts: 1

PostPosted: Tue Nov 20, 2012 5:41 am    Post subject: ... Reply with quote

Guys,

Someone help me transcribe this code to work with autoit?

I got the idea of ​​making a script to hook ws32_2.dll send function in order to customize and send packets ..

I can already hook "send" and "recv" func. to read packets sent and received, works like a charm.. but modify them is more difficult. :- )

If anyone want to help me in this project I post my partial script.

Cheers!! From Brazil.
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Tue Nov 20, 2012 7:37 am    Post subject: Reply with quote

This site is for Cheat Engine, not AutoIt.
If you wish to receive support for AutoIt you are better off asking on their forums instead.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites