[DuckTools] DuckAPI - A phBot-like Python plugins system

07/20/2025 20:27 abdopro3#1
[DuckTools] DuckAPI - By Abdo Proff


Hey guys, hope you're all chillin'. I'm Abdo Proff, from Cairo, Egypt, and I'm here to present something that I hope will be useful and interesting for the community.
I’ve created a DLL that works directly with the client — it's not a bot and doesn't require any bot to function.
It provides the same Python plugins system that phBot offers.

This is not a Silkroad Proxy or a game bot that you need to connect to so it can handle client/server packets. What does that mean? It means you can use it to do things you dream of — even in protected environments like Maxiguard or VsroPlus macro servers.

That also means we can use it standalone, whether launching the game via its original launcher or something like EDX Loader. And we can still use it alongside sBot or mBot — but now with a phBot-like Python plugin system.

The great thing about the APIs I built is that they're almost identical to phBot's. As you’ll see in the first video, I took the xPacketTool plugin from phBot and just changed the library names as follows...

Instead of
Code:
from phbot import *
I used
Code:
from duckapi import *
And instead of
Code:
import qtbind
I used
Code:
import duckui
And the rest of the code literally stays the same.

This first video explains the required files to run the API, and shows how similar the function names and signatures are to phBot’s.


Not all phBot APIs are available in this version of DuckAPI. If you want to reuse a phBot plugin like I did in the video, make sure all used APIs exist in DuckAPI.


I'll list all currently available DuckAPI APIs below the videos.

First Video
What is DuckAPI, required files, API similarity with phBot, and how to adapt existing phBot plugins.





First, here are the files you’ll need to put inside your game folder:

1. `DuckAPI.dll` — this is my DLL that you'll inject into `sro_client.exe`.
2. `python38.dll` — the Python runtime DLL required to run the interpreter.
3. The Python environment directories inside the `python38` folder located in the `plugins` folder.


I'll post download links for the files and the injector after the tutorial section.

Second Video
Duck Smart Trace Plugin — A better phBot trace plugin




In this video, I show how to use the Duck Smart Trace plugin for caravans or other purposes:

1. You must enable the “Show Unique ID” checkbox in the plugin.
2. The CMD must send `duckcmd` in All Chat to fetch the CMD’s Unique ID so it appears in the plugin (as shown in the video).
3. Click “Add CMD” to select the Unique ID of the CMD after the message is sent.
4. Then click Start or Stop Trace as needed.

The cool part — something even phBot plugins can’t handle — is that if the CMD presses in the sky or moves using keyboard arrows, phBot goes nuts and traces incorrectly. But here, the plugin uses game trace to continue tracing the CMD, until they press somewhere on ground again.

Note: The Unique ID changes every time the player logs out and back in.
So if the CMD disconnects or closes the game, he must send `duckcmd` again, and you must recheck the box to get the new ID.


This plugin is encrypted, as shown in the video.

This is another feature that makes DuckAPI different from phBot — you can encrypt plugin code if you want to sell or share it without exposing your Python source or allowing edits.

Third Video
DuckControl (aka xControl Plugin) — Extend command handling and add new actions




In this video, we discuss the DuckControl plugin, which is similar to phBot’s xControl plugin.

The idea is to designate certain players as “Leaders.” When those players send certain chat messages in-game, specific actions are automatically performed.

Q1 Command — Auto-teleport from ferry when “Q1” is typed

You’ve probably seen people spam “Q1” or “Q2” during caravans — those are chat commands used with plugins like phBot’s xControl to auto-teleport.

Here I show how to replicate the same behavior using a DuckAPI plugin.

We’ll use the following APIs:

Code:
handle_chat(t, player, msg)
inject_joymax(opcode, data, encrypted)

Just like in phBot:

handle_chat:
1- `t` = chat type (private, party, all chat, etc)
2- `player` = sender’s name (string)
3- `msg` = received message (string)

inject_joymax:
1- `opcode` = the action's hex opcode (e.g. 0x7074, 0x7021)
2- `data` = Python bytes object containing packet data
3- `encrypted` = whether the packet is encrypted (True/False)


Since we don’t have access to media.pk2 data or helper APIs like phBot, we need to use xPacketTool and enable “Show Client Packets” to observe opcodes and data sent by the game client for the actions we want to replicate via chat command.

1- To implement the `q1` teleport command — like teleporting from Jangan to Donwhang — I capture the opcode and data the client sends to the server when I manually teleport.
2- Then, in the plugin code under `handle_chat`, I add a condition that checks if the message came from a leader and whether the message equals "q1".
3- Here’s the current code:


Code:
def handle_chat(t, player, msg):
    if t in [2, 4, 5, 7]:
        if is_leader(player):
            info(f"Message from leader {player}: {msg}")
I add the condition for `q1`, and it becomes:

Code:
def handle_chat(t, player, msg):
    if t in [2, 4, 5, 7]:
        if is_leader(player):
            if msg == "q1":
                inject_joymax(0x705A, b"\x1A\x01\x00\x00\x02\x04\x00\x00\x00", False)
            info(f"Message from leader {player}: {msg}")
This tells the plugin: if a message from a leader equals "Q1", send the same opcode and packet the client would use when manually teleporting.

Same goes for any other command you wish to add to replicate a specific client action.

To edit a plugin, you’ll need an IDE like VSCode or Visual Studio 2019/2022.
You *could* use something like Notepad++ or even basic Notepad — but that would be painful :)

To use this, you can register a new account to use this on [Only registered and activated users can see links. Click Here To Register...]
Discord registration has been disabled to comply with the forum's rules.


I literally made this entire project in a few days without enough testing, so I am expecting errors to come up, and hopefully get reported and solved ASAP.


Currently Available APIs




Download links:

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]
07/23/2025 08:33 wxcxc#2
Wow what a great work
07/24/2025 01:50 Kabloz™#3
:pogchamp:
07/27/2025 01:06 JellyBitz#4
This can be kinda useless without the game database.
I recommend you to use [Only registered and activated users can see links. Click Here To Register...] just to generate such database in sqlite3 format, easy to use in python. :hell:
07/27/2025 01:16 abdopro3#5
Quote:
Originally Posted by JellyBitz View Post
This can be quite useless without the game database.
I recommend you to use [Only registered and activated users can see links. Click Here To Register...] just to generate such database in sqlite3 format, easy to use in python. :hell:
Jellyyyy, dude your xbot code already helped me a lot and I am already using it as a reference in my C++ media contents extraction. I am just using a different method since it's a DLL, I am calling the gfxfilemanager's IFileManager's functions to read from the media at runtime and extract the needed data.

Much love, bro!
07/27/2025 03:45 JellyBitz#6
Quote:
Originally Posted by abdopro3 View Post
I am just using a different method since it's a DLL, I am calling the gfxfilemanager's IFileManager's functions to read from the media at runtime and extract the needed data.
Yeh, it's a way but not recommended, in such case it's better to retrieve the data from the [Only registered and activated users can see links. Click Here To Register...].

Parsing/analyze all the files can take a while on start and I know it can be annoying reading all those files from C++ (I did it before). I'm just giving as option xBot to people here start making some advance addons, xBot already extracts a pretty good database in sqlite3.

Left a database sample from Silkroad Latino.
07/27/2025 13:26 abdopro3#7
This is just brilliant. Thank you so much!
08/04/2025 04:56 NONONO2#8
the tool is good but that guy is childish af I asked him 2 questions on the discord server then for no reason he kicked me from it
1- the tool is not working with me on windows 10 lite host is virtual machine
he said it's because of vmprotect
2- are you willing to add get_monsters() later to the tool?

after a respectful response from me on both mints after I found myself banned :feelsbadman:
08/04/2025 16:23 abdopro3#9
Quote:
Originally Posted by NONONO2 View Post
the tool is good but that guy is childish af I asked him 2 questions on the discord server then for no reason he kicked me from it
1- the tool is not working with me on windows 10 lite host is virtual machine
he said it's because of vmprotect
2- are you willing to add get_monsters() later to the tool?

after a respectful response from me on both mints after I found myself banned :feelsbadman:
It's literally my server, my code, and my thread. I don't see a reason you should feel that I am childish if I decide that I don't like how our interaction went and that I don't want you in my server. It's pretty simple really.

I am glad you enjoyed the tool for the few minutes you were allowed to use it, though.
08/04/2025 17:40 Devsome#10
Quote:
Originally Posted by abdopro3 View Post
It's literally my server, my code, and my thread. I don't see a reason you should feel that I am childish if I decide that I don't like how our interaction went and that I don't want you in my server. It's pretty simple really.

I am glad you enjoyed the tool for the few minutes you were allowed to use it, though.
I only now see that you have to create an account on your Discord to use the program. Unfortunately I see an indirect advertisement for your Discord server and the section “SRO Hacks, Bots, Cheats & Exploits” would not be the right one. Would you like to change that, alternatively I would close your thread.
08/04/2025 17:53 abdopro3#11
Quote:
Originally Posted by Devsome View Post
I only now see that you have to create an account on your Discord to use the program. Unfortunately I see an indirect advertisement for your Discord server and the section “SRO Hacks, Bots, Cheats & Exploits” would not be the right one. Would you like to change that, alternatively I would close your thread.
I am okay with that. I have to link this to my server since I need to disable certain packets in specific editions to prevent creating plugins that could ruin gameplay uncontrollably, such as plugins that automatically attack other players and so on. So, it can be moved to whichever other section it belongs to, closed, or completely removed.

I created it and wanted to share it with people but in a way that still allows me to control its use, in case it ruins servers, especially with it being as powerful as it is, handling packets in macro vsroplus and maxiguard servers, which server owners pay well enough to have, especially that I am working on adding more APIs that people at some point can use to create a working bot in non-bot servers.

But if it's against the rules, then it is what it is.
08/04/2025 22:00 Devsome#12
Then I'll close here, if you post it without being in a Discord server to create an account, I can open the thread again.

#closed
12/01/2025 15:26 ahmedcar2#13
Wow what a great work