Jump to content

Help with Multi agBot enabler


EVolt
 Share

Recommended Posts

I hope this is the right sub-forum :)

So I made a script to enable multibotting with agBot (a bot for the MMORPG Silkroad Online) . I also made a thread on gamerzplanetabout it and I hope someone helps me and the other agBotters.

Before I get to explaining the problem I've gotta explain what exactly the script does:

So usually when using SrProxy or NuConnector they listen on port 22580 for a bot and on another port for SRO (Loader default : 15778). Well what my script does is listen on port 22580 for the bot instead of SrProxy, while SrProxy is set to listen on another port. When agBot sends a connection request to port 22580 my script establishes a connection to agBot (TCPAccept) and connects to SrProxy (TCPConnect) and SHOULD redirect all data intended for agBot from SrProxy to agBot and all data intended for SRO from agBot to SRO.

Problem:

Well I hit a brick wall on the latter. Agbot succesfully establishes a connection to SrProxy and data from SrProxy / SRO reaches agBot, but all data sent from agBot doesn't reach SRO.

Guide is on the gamerz planet. So is a package trace pic (in the bug list area).

Here's code again:

CODE

#cs -----------------------------------------------About---------------------------------------------

-Enable Agbot Multibotting

-Version 1.1

-

-By Jeronimo

-

Functions:

-bot simultaneously with 10 bots

-delete nonexistent bots from the bot / socket list (maintainList) ----------------Not yet tested !!!

-

Still to add:

-GUI

-

-

Changelog:

-

Copyright Notice:

-Fuck copyright...I break it everyday. Why should I label my stuff copyrighted ?

-Therefore this script and it's accompanying Autohotkey script are copylefted.

#ce ------------------------------------------------This-^_^--------------------------------------------

#include <Process.au3>

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$g_IP = "127.0.0.1"

;Max Packet Size

$maxPsize = 99999

; Start The TCP Services

;==============================================

TCPStartUp()

; Listen for the bot

;==============================================

$MainSocket = TCPListen($g_IP, 22580,100)

If $MainSocket = -1 Then Exit

#cs Bot/SrProxy List

Make a list of bots and SrProxies

Visualized:

Nr (Max defined by user $botsToRun) | Accepted Socket Nr (defined by AutoIT) | Send Port Nr (Defined by user in SrProxy) | Process # of SrProxy

#ce

$botsToRun = 10

$bots = 0

$portInc = 0

Dim $runningBots[$botsToRun][3]

#cs look for client connection

When a bot connects it's added to the running bots list

with the socket and the port it sends it's data to

#ce

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

;Check the bot connections

checkBotConnections($ConnectedSocket)

;Check or listen for outgoing data from the bots and send it to corresponding SRO

checkOutgoing()

;Check or listen for incoming data from SRO and send it to the corresponding bot

checkIncoming()

;Check if a bot or SrProxy died

maintainList()

Wend

;Checks if the socket is being used

;If so the reference # will be returned

Func isSocketInUse($botSocket)

$inUse = -1

;Runs through the list of running bots

For $i = 0 To $botsToRun-1

If $runningBots[$i][0] == $botSocket Then

$inUse = $i

EndIf

Next

Return $inUse

EndFunc

;Checks if the socket is really in use by the bot

Func maintainList()

;Runs through the list of bots

For $i = 0 To $botsToRun-1

;PID of SrProxy

$PID = $runningBots[$i][2]

;Name of the SrProxy Process if it exists (String)

$name = _ProcessGetName($PID)

$exists = IsString($name)

;Check if the bot and SrProxy are still running

;If not the item is deleted from the list and the items in the list

;are moved one place down in the list

If $exists == 0 Then

For $i = 0 To $botsToRun-2

$runningBots[$i][0] = $runningBots[$i+1][0]

$runningBots[$i][1] = $runningBots[$i+1][1]

$runningBots[$i][2] = $runningBots[$i+1][2]

Next

$i = $i +1

;Delete the last item in the list

$runningBots[$i][0] = ""

$runningBots[$i][1] = ""

$runningBots[$i][2] = ""

;Decrement the number of items on the list

$bots = $bots -1

EndIf

Next

EndFunc

#cs

Check if t

he bot is receiving something from SrPoxy

To do that all ports/sockets in the list will be checked for received data,

which will be sent to the bot

#ce

Func checkIncoming()

$dataArrived = False

;If $runningBots[0][0] <> "" Then

;MsgBox(0,"Size = ",$runningBots[0][0])

For $i = 0 to $botsToRun -1

;Data from SrProxy / SRO

$in = TCPRecv($runningBots[$i][1],$maxPsize)

If $in <> "" Then

;MsgBox(0,"Data incoming !",$in)

;Send to corresponding bot

$sent = TCPSend($runningBots[$i][0],$in)

;MsgBox(0,"Bytes sent",$sent)

$dataArrived = True

EndIf

Next

;EndIf

Return $dataArrived

EndFunc

;Searches a new SrProxy in the process list

Func newProxyPID()

$processList = ProcessList("SrProxy")

;Run through the process list

For $i = 0 To $processList[0][0]

$PID = $processList[$i][1]

;The process doesn't exist yet

$exists = False

;Run through the bot / socket list

For $j = 0 To $botsToRun-1

;and check if the process is already listed

If $runningBots[$j][2] == $PID Then

$exists = True ;Process exists

EndIf

Next

;If process doesn't exist that means we can now add it 2 the list

If $exists == False Then

Return $PID

ExitLoop

EndIf

Next

EndFunc

;Check if the bot is sending something to SrProxy

Func checkOutgoing()

$dataSent = False

For $i = 0 To $botsToRun -1

;Data from bot

$out = TCPRecv($runningBots[$i][0],$maxPsize)

If $out <> "" Then

;MsgBox(0,"Data outgoing",$out)

;Send to corresponding SrProxy-port

$sent = TCPSend($runningBots[$i][1],$out)

;MsgBox(0,"Bytes sent",$sent)

$dataSent = True

EndIf

Next

Return $dataSent

EndFunc

Func checkBotConnections($theSocket)

;Has a connection been established

;First check if the socket has already been connected

;If not then increment the bots#, write the accepted socket # and the send port nr

;If so just redirect the data package

If $theSocket >= 0 Then

;Accepted Socket

$socket = $theSocket

;Check if the socket is already in use

$inUse = isSocketInUse($socket)

$portNr = $inUse

;MsgBox(0,"Port Nr",$portNr)

If($inUse == -1) Then ;Socket not in use

;MsgBox(0,"Socket not in use",$socket)

$portNr = $bots

;Store the bot's socket

$runningBots[$bots][0] = $socket

;Store SrProxy's socket

$runningBots[$bots][1] = TCPConnect($g_IP,$portInc + 20000)

;Increment the port numbers

$portInc = $portInc + 1

;Store the PID

;Need 2 run through the list of processess first and find the new SrProxy

$runningBots[$bots][2] = newProxyPID()

$bots = $bots + 1

EndIf

;Msgbox(0,"Connected on socket",'"' & $connectedSocket & '" and sent "' & $sent & '"bytes of data "' & $data & '" to "' + $runningBots[$bots][1] &'"')

EndIf

EndFunc

Help is very much appreciated. Thank you.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...