Jump to content
Moopler

Recommended Posts

Hey Mooplers,

I've been messing around with Clientless Bots for quite some while now and figured that it was time I would give something back to the community. I present to you my personal class library for MapleStory Clientless Bots.

NOTE: As I am one lazy motherfucker I have yet to completely test this lib. I'll do this in the near future and update the repo if necessary. This library probably works already, as it is based on years of trying, failing and eventually succeeding.

Features

  • Ready-to-use client, which handles incoming and outgoing data
  • Stream-like readers and writers for packet interpretation and construction
  • Distinction between internal and external packet headers (in other words: dynamic or not)
  • Hardware Profile spoofing
  • Nexon Passport web authentication (Credits to Waty)

Basic Example

//Oversimplified example of a Clientless Bot (CLB)
public class MyBot
{
    public MapleClient Client { get; set; }
    
    public CancellationTokenSource CTS { get; set; }
    
    private bool IsConnected { get; set; }
    
    public void StartBotting()
    {
        CTS = new CancellationTokenSource();
        Client = new MapleClient(); //This is the object that we will be using the most, as it combines the other essential features.
        Client.HandshakeReceived += OnHandshakeReceived;
        Client.PacketReceived += OnPacketReceived;
        
        //Create a thread or just call MainBotLoop
        MainBotLoop();
    }
    
    public void OnHandshakeReceived(ushort version, ushort subversion, byte locale, byte newbyte)
    {
        PacketWriter writer = new PacketWriter(0x0067); //Creates a new packet writer/builder with packet header 67 00. Encryption does not play a role here (yet).
        writer.WriteInt8(locale);
        writer.WriteUInt16(version);
        writer.WriteUInt16(subversion);
        writer.WriteInt8(newbyte);
        
        if(Client != null && Client.Connected) //Only send packets when the Client is initialized and connected to a server. This way we prevent causing unnecessary errors.
            Client.SendPacket(reader); //SendPacket takes care of encrypting the packet and passes it to the Socket
    }
    
    public void OnPacketReceived(PacketReader reader)
    {
        switch(reader.ExternalHeader) //ExternalHeader is the heawder sent by MapleStory. This library does not feature header decryption, but takes this into account by allowing you to set the InternalHeader yourself. This method would be the place to do so.
        {
            case 0x0000: //Some header that is not encrypted
                HandleSomePacket(reader);
                break;
            default: //All headers that are encrypted
                DecryptHeader(reader); //For example
                RouteDecryptedHeaderPacket(reader); //For example
                break;
        }
    }
    
    private void HandleSomePacket(PacketReader reader)
    {
        uint value1 = reader.ReadUInt32();
        string dynamicLength = reader.ReadMapleString();
        string staticlength = reader.ReadString(13);
        byte[] raw = reader.ReadBytes();
    }
    
    public void MainBotLoop() //We need to have a loop to keep receiving data and handling it, preferably on another thread than your UI
    {
        while(!CTS.IsCancellationRequested)
        {
            if(!IsConnected)
            {
                Client.Connect("127.0.0.1", 1337"); //IP/Port of MapleStory server
                IsConnected = true;
            }
            
            Client.Receive(); //Blocks until there is data. Data will be parsed and pushed to OnPacketReceived through an event
        }
    }
}

The code can be found on GitHub.

License

This project is licensed under GPLv3. Please respect this license.

  • Like 8
  • Thanks 2

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×