Valhalla Legends Forums Archive | Visual Basic Programming | Socks4

AuthorMessageTime
MichaeL
I'm posting this topic again, since I did not get much feedback from it last time. Here it is: I need to have the option of connecting my battle.net bot (winbot) via socks4 proxy server. Can anyone help with this.

Thank you.
March 30, 2004, 11:47 PM
Grok
Dude, you got 9 replies last time. What was wrong with them?
March 30, 2004, 11:53 PM
Imperceptus
[quote author=MichaeL link=board=31;threadid=6081;start=0#msg52748 date=1080690459]
I need to have the option of connecting my battle.net bot (winbot) via socks4 proxy server.
[/quote]

http://archive.socks.permeo.com/protocol/socks4.protocol

Could try looking at firebot source.
Or go to google and search for SOCKSV4
http://twistedmatrix.com/documents/current/api/twisted.protocols.socks.html
March 31, 2004, 12:17 AM
FuzZ
I just got mine successfully working.

Here's what I do.

I use a connect function.
In it I have
[code]
If BNet.Proxy Then
frmBNet.sckBNet.RemoteHost = BNet.ProxyIP
frmBNet.sckBNet.RemotePort = 1080
frmBNet.sckBNet.Connect
AddChat frmBNet.rtbChat, vbGreen, "SOCKS -> Connecting to " & frmBNet.sckBNet.RemoteHostIP
Exit Function
End If
[/code]

Then, in my sockets connect event handler I have.
[code]
If BNet.Proxy = True Then
Dim splt() As String, str As String, i As Integer
BNet.Server = LCase$(BNet.Server)
splt = Split(BNet.Server, ".")
If IsNumeric(splt(0)) = False Then
' If server is not an ip.
Dim a
a = GetIPFromHostName(BNet.Server)
splt = Split(a, ".")
End If
For i = 0 To UBound(splt)
str = str & Chr(CStr(splt(i)))
Next i
sckBnet.SendData Chr(&H4) & Chr(&H1) & Chr(&H17) & Chr(&HE0) & str & "anonymous" & Chr(&H0)
AddChat frmBNet.rtbChat, vbGreen, "Connecting to " & BNet.Server
Exit Sub
Else
AddChat frmBNet.rtbChat, vbGreen, "Connected to " & frmMain.sckBnet.RemoteHost
Packet0x50
Q.QClear
End If
[/code]

And my sockets DataArrival event handler

[code]
If BNet.Proxy And Mid$(TempRecv, 1, 1) = Chr(&H0) Then
Select Case Mid(TempRecv, 2, 1)
Case Chr(&H5A)
AddChat frmBNet.rtbChat, vbGreen, "SOCKS -> Request granted."
Packet0x50
Exit Sub
Case Chr(&H5B)
AddChat frmBNet.rtbChat, vbRed, "SOCKS -> Request Rejected or Failed."
sckBnet.Close
Exit Sub
Case Chr(&H5C)
AddChat frmBNet.rtbChat, vbRed, "SOCKS -> Request Rejected because SOCKS server cannot IDENT on the client."
sckBnet.Close
Exit Sub
Case Chr(&H5D)
AddChat frmBNet.rtbChat, vbRed, "SOCKS -> Request Rejected because the Client Program and the ID Report Different User-IDs."
sckBnet.Close
Exit Sub
End Select
End If
[/code]

Edit-> From here
[code]
'SoupBotLoD code
Public Declare Function gethostbyname Lib "wsock32" _
(ByVal hostname As String) As Long

Public Function GetIPFromHostName(ByVal sHostName As String) As String
Dim nbytes As Long
Dim ptrHosent As Long
Dim ptrName As Long
Dim ptrAddress As Long
Dim ptrIPAddress As Long
Dim sAddress As String

sAddress = Space$(4)

DoEvents
ptrHosent = gethostbyname(sHostName & vbNullChar)

If ptrHosent <> 0 Then
ptrAddress = ptrHosent + 12

CopyMemory ptrAddress, ByVal ptrAddress, 4
CopyMemory ptrIPAddress, ByVal ptrAddress, 4
CopyMemory ByVal sAddress, ByVal ptrIPAddress, 4

GetIPFromHostName = IPToText(sAddress)

End If

End Function
Private Function IPToText(ByVal IPAddress As String) As String

IPToText = CStr(Asc(IPAddress)) & "." & _
CStr(Asc(Mid$(IPAddress, 2, 1))) & "." & _
CStr(Asc(Mid$(IPAddress, 3, 1))) & "." & _
CStr(Asc(Mid$(IPAddress, 4, 1)))

End Function
[/code]
These two functions are from SoupBotLoD source
Edit->To here

I used FireBot's source code to base mine off from.

If you want FireBot 1.8 source
www.bloodynub.com/files/bnet/bots/srcs/
(yes i realize i borrow alot of code, but i assure you that i DO write my own :P)
Hope this can help.
April 1, 2004, 3:39 PM

Search