Jump to content

How To Bypass Smartguard?


bubaby

Recommended Posts

  • 4 weeks later...

Hi, I am writing a clicker for L2 and stuck with smartguard. I understand that I have to use some trampoline to bypass api hook from smartguard, but I can't find good document on how using it.

 

As far as I understand, trampoline must be place in a DLL, and that DLL must inject to L2. I have to find what api guard.des is hooking and then write a trampoline to jump to original function. In my case, I need to use SendInput() or keybd_event() or SendMessage( [WM_KEYDOWN / WM_KEYUP] ). Then I must find the actual address of  these function in module User32.dll and then write a trampoline to jump back to this function. That is pretty much everything I understand about api hook / detours.

 

But It seem not right. I think I got it wrong somewhere.

 

I use hookshark to find which api detours guard.des using, and the only interesting detour I found on the L2.exe process is GetRawInputData and it doesn't make sense. So, Guard.des doesn't hook on SendInput, keybd_event or SendMessage as it is no use to write trampoline for these function.

 

This is where I stuck.

Appreciate any help :)

 

 

Link to comment
Share on other sites

Why clicker? Just go for a bot. But if u really want to, the as far as i know L2 uses directinput which is resistant by nature of it to keybd_event or SendInput. Did you try inejcting messages directly to window procedure? This works in most cases. Dont use Hookshark program, write one yourself. The popular one has soem defects, doesnt show all hooks, especially cant scan ntdll where most of interesting stuff resides.

 

And what do you mean by saying "That is pretty much everything I understand about api hook" ? You have to avoid any modifications when creating a cheat, more mods = higher detect ratio and you definitel dont want it. Hooking is terrible idea (look at l2tower which hooks like 20 functions, doesnt work anywhere).

 

So right now reverse to the window creation, find the address of WndProc and try here. BTW Can you show screenshot with log from hookshark? Im interested how many did he find... :)

 

Greetz

Link to comment
Share on other sites

Why clicker? Just go for a bot. But if u really want to, the as far as i know L2 uses directinput which is resistant by nature of it to keybd_event or SendInput. Did you try inejcting messages directly to window procedure? This works in most cases. Dont use Hookshark program, write one yourself. The popular one has soem defects, doesnt show all hooks, especially cant scan ntdll where most of interesting stuff resides.

 

And what do you mean by saying "That is pretty much everything I understand about api hook" ? You have to avoid any modifications when creating a cheat, more mods = higher detect ratio and you definitel dont want it. Hooking is terrible idea (look at l2tower which hooks like 20 functions, doesnt work anywhere).

 

So right now reverse to the window creation, find the address of WndProc and try here. BTW Can you show screenshot with log from hookshark? Im interested how many did he find... :)

 

Greetz

:dat: :dat:

Link to comment
Share on other sites

I mean I am newb at hook and reverse engineering stuffs and that is what I've read somewhere from the internet  :D

 

Mouse hook and keyboard hook are the only kind of hook that I know. Since I am a noob clicker is easiest to code for me, and clicker is enough for me.

 

On some private high/mid rate server, there are other way to farm than hunt mobs, such as raid boss Zaken which need about 12 - 14 players (or 14 boxes on a single computer), and clicker is the best. My clicker just does SendMessage with WM_KEYDOWN / WM_KEYUP to the correct L2 hwnd(s) and everything is good: one player, one computer, 14 L2 client windows and one clicker. That's it.

 

Before L2 exilium upgraded with smartguard my clicker worked fine. You know what happened after they upgraded with smartguard  :D

 

Like I said, I am noob at this hook / detour stuffs, and the information I find on the internet is not helping much.

 

Here are the logs

post-133584-0-12635200-1443437460_thumb.png

usermodehook.txt

log.txt

Link to comment
Share on other sites

The one which makes your clicker not work is most probably this:

 

[6596] L2.exe!window.dll->?StaticWndProc@WWindow@@SGJPAUHWND__@@IIJ@Z       || [0x1101C480] => guard.des [0x72FD382B]            || Inline - Detour [5 Bytes] || push ebp            || jmp 72FD3830h
 

Did you try to preapre the stack + original entry instructions and call it? This would work almost for sure

Link to comment
Share on other sites

The one which makes your clicker not work is most probably this:

 

[6596] L2.exe!window.dll->?StaticWndProc@WWindow@@SGJPAUHWND__@@IIJ@Z       || [0x1101C480] => guard.des [0x72FD382B]            || Inline - Detour [5 Bytes] || push ebp            || jmp 72FD3830h

 

It starts to make sense. So, guard.des detours the callback function that handle all the messages sent to L2 client hwnd and filters out WM_KEYUP /  WM_KEYDOWN. That is probably why message WM_CHAR still works.

 

 

 

Did you try to preapre the stack + original entry instructions and call it? This would work almost for sure

Well, that is beyond my knowledge :D

 

But at least, I have something to search for. I guess I have a lot of reading to do.

 

Thanks alot.

Edited by 1413
Link to comment
Share on other sites

I've never been using the detour/retour terminology :) You have to understand how hooking works and how do the "hooker" call real function. The algorithm is to copy instructions from the functions entry and overwrite them with a jump to your code, and create a jump back to real function using the copied instructions and adding a jump to it. If you manage to find or reproduce these instructions then you are set. It may sound very compilcated at start but u need to check it carefully. Do you use a debugger? Its million times easier with one

Edited by Szakalaka
Link to comment
Share on other sites

I've never been using the detour/retour terminology :) You have to understand how hooking works and how do the "hooker" call real function. The algorithm is to copy instructions from the functions entry and overwrite them with a jump to your code, and create a jump back to real function using the copied instructions and adding a jump to it. If you manage to find or reproduce these instructions then you are set. It may sound very compilcated at start but u need to check it carefully. Do you use a debugger? Its million times easier with one

 

I had a hunch a debugger could be useful someday, then I collected some, such as IDA pro, ollydbg... But never use them before because I have no idea how to read ASM :D

 

So, I have to find the address of the callback function StaticWndProc in the memory, then overwrite the first 5 bytes with my instructions that jump to my_function in my_dll and then my function will jump back to the 6th byte and run the original StaticWndProc. I think I read somewhere they call it trampoline, but actually it is access memory of other process and overwrite a part of that process' memory with my instructions, am I right?

 

I have a question, since guard.des overwrite the first 5 bytes with inline-detour which jump to a function in guard.des, is that right? I think maybe we just need to overwrite that 5 bytes with the original 5 bytes of the original function, like undo what guard.des does and bam StaticWndProc now received WM_KEYDOWN again.

Link to comment
Share on other sites

Welp i wrote a big post and it did not send it somehow... So basically u are right with the jump idea, but u cannot unhook guard.des, it will detect it immidietly. You can try to disable the checking loop but without asm knowledge u wont do it, so what you need to do is to reproduce first 5 bytes, then add jump to the 6th and call function that way. I may make short video on it maybe

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



  • Posts

    • WTS Gold bars reborn interlude x10   discord : xeenthekeen
    • Guys, if you'd let me be the bearer of bad news, No amount of "break from server development" can justify your complete lack of idea how things work. If it was this easy, you should've been seeing 90% of the servers of the popular old versions, such as IL and HF, running on the newest client. For this task, you would need a lot of time - think at least 2 months, if you can code, have access to all the necessary tools for client development, and you have a relatively good idea of how server<->client communication works. f you don't, then you either find yourself a well-paying job and find someone who would do it for you or you put the idea aside (for no less than 1-2 years) and start reading and learning asap. Let me give you a little preview/breakdown of what some of the work includes. The work can be split into two parts - SERVER side and CLIENT side.  The server and the client communicate through packets. Each of these packets has a defined structure. Both, the server and the client MUST know this structure and MUST use the same structure, otherwise they won't be able to "understand" each other. - The server side predominantly includes the alteration of existing packet structure and the creation (from zero) of missing packets that the client requires. Then you also have to take these changes into account and alter the existing features of your server to match the changes. A good example for this is SKILL ENCHANTING. On older chronicles, the enchant level is determined by the LEVEL value of the skill and on the new clients, it has been taken out into a separate value. What this means is that you would have to figure out a way to adapt the old system to the new requirements. - Now that we mentioned the client, you would also need to edit a bunch of files, such as Interface, UTX, UNR, as well as DAT files, including those related to ITEMS, SKILLS, QUESTS, NPCS, and AUGMENTATION STATS and DESCRIPTIONS, etc. For some of those, you would also have to figure out how to check for missing entries and how to parse data from the older client to the new. The best example, again, would be the SKILLS. On the latest clients, the skill enchanting was limited to only +20. As such, even if there were some matching skills between the two different client versions, you would still need to add the missing 10 levels to +30. And once you complete all of that, you start testing and fixing bugs and sh1t. And once you have fixed all of that, you can start adding new features from the new client, because otherwise it would be one big mess and a waste of time and/or money.
    • As far as I know, these are not linked to the server. What I mean by this is - there is no server <-> client communication for these two features. If that is indeed the case, you would need the Interface sources in order to create a custom function which you can trigger with a SERVER_TO_CLIENT packet.
    • Hello, I recently Installed the h5 Interface from emu-dev   Everything is working great but i was wondering if anyone can help me add the monster book and item book buttons on my community board to make it more accessible. Or if there is a way to add a button with HTML that calls these windows. I have xdat editor installed and i have located the relevant windows, but i don't know what to do with them. Thank you for your time.  
  • Topics

×
×
  • Create New...