[Question] Interfering with a bot through a self-made proxy

05/25/2015 17:57 concludeit#1
Hi everyone.

I'm relatively new to networking, so I'm kinda stuck with something I'm trying to do.

What I'm trying to achieve is to participate in the mBot communication with an external tool (to be precise: I'm trying to send a log off packet through the mBot). The reason I'm trying to do this is because the server I'm developing for (purely for fun, falls into the "only because I can" category. :D) has rebirth system, and I managed to automatize the logoff on exact level (by reading mbot memory)-rebirthing-relogging system, but that requires me to close the bot and restart it. That's not quite a problem, but the bot doesn't save the skill mastery leveling (getting the level with 9gap sucks even with plvl), so I'm trying to do a log off through the bot's communication channel. (I tried to debug the mbot, but the moment I even start ollydbg all mbots close promptly, and I'm not an expert reverse engineer.)

What I thought I should do is to create another layer in the communication: a proxy app through the bot connects to the server. I set the localhost and a port as proxy in mBot, the app gets the data, sends it to the server, reads server response and sends it to the bot. I'm pretty much sure this isn't that easy, as the app either have to be socks4 or socks5 too.

Anyone has any experience or a vague idea how to create an extra layer between a bot and the server, where I can also send packets if I were the bot itself (thus, logging off the character)?

Thanks in advance. :)
Cheers!
05/25/2015 19:54 vorosmihaly#2
In my personal opinion,the easiest way to do it would be to just simply set up a proxy (you can use drew's proxy example from his securityapi,should work well for testing stuff),and you can redirect mbot to it by simply modifying the media.pk2 data that holds the original connection data,at least I'm guessing mbot reads it from the client...and once you've modified that,you let mbot connect to your proxy --> proxy connects to silkroad server -->
server can easily receive data from your proxy...at least,this sounds like an easy solution if I'm understanding your problem correctly ^_^ anyways,if you have some trouble,feel free to add me on skype (vorosmihaly8367) and hopefully I'll be able to help you out ;)
05/25/2015 22:15 concludeit#3
Thank you for your response, it does sound a good idea, so I'll check it out tomorrow. :) I have never touched the silkroadrescurityapi, although I have all the tools, dlls and source files to get started... What confuses me a bit that I always saw the redirect and client launch procedure hand in hand with the proxy stuff. I was trying to figuring it all out, not much success so far, but will spend a lot more time trying to understand it.

Perhaps someone can give me a slight idea what code (classes) I should be looking for? :D

EDIT:
I've made it to the loginserver! At the worldserver the whole thing crashes, but modifying the media.pk2 did the trick, everything works fine until I try to log in. :) I used up drew's code in his proxy thread - maybe he is completely missing that part and I have to work out the worldserver thing myself? :D I'm kinda lost at the moment, but much more hopeful. :) I'll dive into it this evening.

EDIT 2:
I succeeded logging in. Does someone know the opcode of the logoff packet? Or perhaps the character levelup packet? :D

EDIT 3:
Okay, I literally sorted everything out. What is left is letting multiple clients connect to the proxy. Anyone knows the proper way to do that?