Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding > Coding Tutorials
You last visited: Today at 07:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[mmBBQ] Bot coding from scratch (part 1)

Discussion on [mmBBQ] Bot coding from scratch (part 1) within the Coding Tutorials forum part of the General Coding category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2011
Posts: 15
Received Thanks: 9
[mmBBQ] Bot coding from scratch (part 1)

With this post i will start a series of howtos, what you have to do if you want to write a bot or tool for a
MMORPG. This should give you an inside view to reverse engineering programs.

Needed:
  • Silkroad Online
  • OllyDbg
  • mmBBQ
  • editor of your choice (mine is vim )
Introduction
The most beginners have the problem not to know how to start. With a program like the selected mmorpg its really a hard task, cause its binary is 13MB large and is protected with hackshield.

First of all we will start the client and attach ollyDbg to it. (in olly File->Attach and select the process) Then we will see hackshield in action. It prevents from attaching a debugger to the given process. Hackshield does that with a kernel driver that is loaded by ehsvc.dll during sro_client.exe startup.



-32Bit they hook NtOpenProcess and return ACCESS_DENIED if someone tries to open Silkroad.
-64Bit they load a so called filterdriver (ObRegisterCallbacks) these callbacks will be called if someone tries to open or copy a handle to the specified process.
Another trick of hackshield is a cyclic scan of the loaded executable for changes.
If we start sro_client.exe without the loader we will get:



What to do next:

1. read the start parameters for the executable
Thats an easy task with the help of mmBBQ.
- Start Silkroad.exe
- use START.bat from out zip file for mmBBQ
- because we already have done most of silkroad
it will automatically injects into the process.
now just type
Code:
str(asmcall.cdecl(getProcAddress("kernel32", "GetCommandLineA")))
in the mmBBQ console and you will see something like this:
Code:
str(asmcall.cdecl(getProcAddress("kernel32", "GetCommandLineA")))
'"C:\Program Files (x86)\Silkroad\sro_client.exe" 1967664 /18 0 3'
If you have opened the sro_client.exe in ollydbg youre easy able to set the command line with
File -> Set new arguments...
2. Make sro_client.exe startable without the loader
We know the message that will occur when we try to start sro_client.exe directly.
- So we open the executable in ollyDbg (File -> Open)
- Then we will search for all referenced Strings (right click -> Search for -> All referenced strings)
- In the new window we will search for the text "Please Execute" (right click -> Search for text)



- a double click on that line later we jump to the position where the string is used:



As we can see, right before the parameters for the call of MessageBoxA theres a conditional jump (JNE)
If we change this one to a unconditional one (JMP) (double click on the line)
3. get rid of hackshield
Searching for strings i a executable is not the most professional way of reverese engineering, but in the case of silkroad it will work really often
So simply search for HackShield like you search before.



At this point scroll a bit up to get to
the beginning of that function.

In the window under the code section

we can see
Code:
 Local call from 8BDC20.
Double click on that
and the same in the new occuring window to get to the position where our function is called.
At the position where our function will be called till before the line with
Code:
 PUSH EBX
is the startup part for hackshield.



right click -> Edit -> Fill with NOPs



Maybe i will add a detailed description why i choose this block but i want to move on to more interesting stuff
After all the hard work youre able to save the edited binary to another executable. right click -> Edit -> Select all, right click -> Edit -> Copy to executable and in the new window right Click -> Save to file. Choose another name then sro_client.exe (its cool to have a original backup )

So every time you want to live debug the client, just open the saved executable in olly (dont forget to set the arguments before you run run ) and then klick run.

What comes next:
- Networking (Packet read, write)
- Detecting events (monster/player/user move, attack ...)
- Initiating events (attack, move)
- Inventory

Greetz defragger

defragger is offline  
Thanks
5 Users
Old 08/08/2012, 20:53   #2


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,904
Received Thanks: 25,394
Arrow General Coding -> Coding Tutorials

#moved
MrSm!th is offline  
Old 08/12/2012, 02:46   #3
 
Viper3001's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 234
Received Thanks: 321
Well done this tutorial. Im already a bit into stuff like writing bots like a bot for ragnarok online. But silkroad was always interesting to me. I think the most annoying part was the blowfish encryption because i could never get into it. (could be because im not highskilled in english ) but hopefully some day i will learn a bit.

I will follow your next tutorials too. good luck.
Viper3001 is offline  
Old 08/13/2012, 03:05   #4
 
genesisVI's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 796
Received Thanks: 434
looking forward on nxt tuts
genesisVI is offline  
Old 09/02/2012, 12:17   #5
 
elite*gold: 0
Join Date: Apr 2010
Posts: 85
Received Thanks: 33
Indeed a nice tutorial, let me add to *bookmark, I will try this on a new game what should be released soon, just to see if I can fallow this steps.
Q: Will the server notice the hack shield skip? Will GM's know that somebody skipped the shield? Or it's just local.

Thx
azorel2010 is offline  
Old 09/20/2012, 02:04   #6
 
elite*gold: 0
Join Date: Jun 2007
Posts: 96
Received Thanks: 12
mmBBQ can work with any game or just this three games listed on the website ?
atef201080 is offline  
Reply


Similar Threads Similar Threads
Astar fun with Silkroad online (mmBBQ)
08/13/2012 - SRO Coding Corner - 4 Replies
Hi, we implemented astar for mmBBQ for this prove of concept we choose Silkroadonline. We are using the game internal collision detect function. We also hooked EndScene to be able to print all nodes and at the end the path into the 3D game scene. Its just a proove of concept to show what is possible with mmBBQ. I think the collision detect function is not the best choice, it does not detect all collisions. For Silkroadonline we finished also: - Autologin - Attack - Monster/User/Player...
Adding Lua to ollyDbg with mmBBQ (example poc)
08/06/2012 - General Coding - 2 Replies
Heya, i would like to show our new mmBBQ API with a nice prove of concept. We will add Lua scripting to ollyDbg. First of all download: http://duschkumpane.org/mmbbq/releases/mmbbq_3.0. 0.zip. Unzip it and youll get a bunch of files. Youre able to use START.bat without changing anything to get a list of processes in your system that you could inject our mmbbq into. http://praty.net/i/processlist.jpg Just select the index or pid of the process. Youre able to define a new target in...
[REQUEST] Scratch Emu
06/23/2011 - SRO Coding Corner - 6 Replies
HI, I would like to introduce myself: my name is Andrew i am 16 years old from Romania, and i think that is all you have to know about me! Now, I would like to ask someone, who knows a bit of a programming language like C# or C++(because in this topic i think it is not VB case) to make a guide on how to make a sro EMULATOR from scratch! PLEASE DONT DISAGREE ME IN THE VERY BEGINNING! I just want something that covers the basics of the programming language in the EMU that is made... I want...
[Question] for coding part ...
12/31/2009 - Dekaron Private Server - 2 Replies
If skill name part or etc. files passes over 255 line at present, error becomes. Is it that is so because byte coding is measure?



All times are GMT +2. The time now is 07:37.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.