If anyone can recommend any public sources I could look through or teach me how, please by all means.
What kind of connection are you using? BNLS Hash or CSB?
Quote from: ChR0NiC on November 17, 2003, 01:56 AM
If anyone can recommend any public sources I could look through or teach me how, please by all means.
Winsock Programmer's FAQ
http://tangentsoft.net/wskfaq/articles/firewalls.html (http://tangentsoft.net/wskfaq/articles/firewalls.html)
See the section on SOCKS.
Quote from: Gangz on November 17, 2003, 09:45 AM
What kind of connection are you using? BNLS Hash or CSB?
Any type can be routed through a proxy.
BNLS Hash
Quote from: ChR0NiC on November 17, 2003, 07:49 PM
BNLS Hash
Which is it? Most clients which use BNLS do so to avoid needing to perform local hashing.
My bot uses BNLS but not CSB. It uses BNLS packets
Quote from: Kp on November 19, 2003, 04:08 PM
Quote from: ChR0NiC on November 17, 2003, 07:49 PM
BNLS Hash
Which is it? Most clients which use BNLS do so to avoid needing to perform local hashing.
I always add hashing incase the BNLS server is down for whatever reason - So mine has both. He probably did the same.
This could have been easily answered by googling "socks protocol." Also, what does this have to do with bot development?
Quote from: warz on November 21, 2003, 05:59 PM
What doesn't it have to do with bot development? He stated he uses BNLS, so it's obviously for a bot.
That is like saying I use buttons on my bot, so if I have a question about buttons then I should ask on the bot development forum. A better question to ask yourself before posting a question is: if I ask this question on a non-bot related forum, can I get a good answer?
Thus...
Talking to Battle.net isn't bot related, it's networking-related
User databases aren't bot related, they're algorithmns/datastructures
UI for a bot isn't bot related, it's GUI related
etc etc
ChR0NiC ... Sup brO... :P
I have ur solution right here...
For BNLS-Type logon...
Okay on ur Winsock that connects to BNET(not BNLS) under the
Winsock_Connect Sub do this...
If Form2.Proxy.Value = 0 Then
Send Your Logon Stuff Here (Header, 0x1E/0x50)
ElseIf Form2.Proxy.Value = 1 Then
Dim splt() As String, str As String, i As Integer
varServer = LCase(varServer)
splt = Split(varServer, ".")
For i = 0 To UBound(splt)
str = str & Chr(CStr(splt(i)))
Next i
sck2.SendData Chr(&H4) & Chr(&H1) & Chr(&H17) & Chr(&HE0) & str & "anonymous" & Chr(&H0)
TextAdd "SOCK: Connected!"
End If
Then on the Winsock's(BNET), DataArrival Sub
Do...
If Form2.Proxy.Value = 1 Then
sckBNET.GetData strTemp, vbString
Select Case Mid(strTemp, 1, 2)
Case Chr(&H0) & Chr(&H5A)
TextAdd "SOCK: Request Granted"
SendHeader
>>Send 0x1E/0x50<<
Case Chr(&H0) & Chr(&H5B)
TextAdd "SOCK: Request Rejected Or Failed"
sckBNET.Close
Exit Sub
Case Chr(&H0) & Chr(&H5C)
TextAdd "SOCK: Request Rejected Because SOCKS server cannot IDENT on the client"
sckBNET.Close
Exit Sub
Case Chr(&H0) & Chr(&H5D)
TextAdd "SOCK: Request Rejected Because the Client Program and the ID Report Different User-IDs"
sckBNET.Close
Exit Sub
End Select
strbuffer = strbuffer & strTemp
While Len(strbuffer) > 4
lnglen = Val("&H" & StrToHex(StrReverse(Mid$(strbuffer, 3, 2))))
If Len(strbuffer) < lnglen Then Exit Sub
parseBNET (Left$(strbuffer, lnglen))
strbuffer = Mid$(strbuffer, lnglen + 1)
Wend
Else
sckBNET.GetData strTemp, vbString
strbuffer = strbuffer & strTemp
While Len(strbuffer) > 4
lnglen = Val("&H" & StrToHex(StrReverse(Mid(strbuffer, 3, 2))))
If Len(strbuffer) < lnglen Then Exit Sub
parseBNET (Left(strbuffer, lnglen))
strbuffer = Mid(strbuffer, lnglen + 1)
Wend
End If
Finally...
On ur parseBNLS Sub(or whatever your's is called)
Under Case &HF for Select Case Asc(Mid$(data, 3, 1))
Case &HF
If varproduct = "3RAW" Or varproduct = "PX3W" Then
InsertDWORD &H2
sendBNLSPacket &HD
End If
If Form2.Proxy.Value = 1 Then
sckBNET.Close
TextAdd "SOCK: Connecting..."
sckBNET.Connect varProxy, 1080
Else
sckBNET.Close
sckBNET.Connect varServer, 6112
End If
**Fixed Spelling ;)
-1 for spitting out code.
People who don't know any Visual Basic should not be attempting to make bots in Visual Basic.
Consider your problem: You want to add proxy support to your bot.
Consider the root of your problem: You don't know how to implement the SOCKS protocol.
Consider the best way to solve your problem: A Google search.
Let's say you've done a few Google searches and found some stuff that was relevant to your situation, but you still can't make heads or tails of it. That would be the prime time to come to these forums and ask your question, mentioning of course that you've actually put some research time into it yourself and aren't just saying "write my program for me!".
If you're not willing to actually LEARN the solution to your problem and are just looking to mooch some working code, I think you don't belong on this forum. Eh. </2AM rant>
"Topic: I want to learn how to add proxy support" - emphasis on LEARN
Quote from: TriCk on November 21, 2003, 10:56 PM
Case &HF
If varproduct = "3RAW" Or varproduct = "PX3W" Then
InsertDWORD &H2
sendBNLSPacket &HD
End If
If Form2.Proxy.Value = 1 Then
sckBNET.Close
TextAdd "SOCK: Connecting..."
sckBNET.Connect varProxy, 1080
Else
sckBNET.Close
sckBNET.Connect varServer, 6112
End If
I see a couple of things here that could be improved. First, there's no need to sckBNET.Close
inside both branches of the if. Move it outside. Second, you're assuming that the bncs will always and only be on port 6112. Third, you could simplify the Connect statement by assigning the port to a variable based on whether proxy support is in effect, then connecting based on that. VB-ish syntax, with some probable errors since I don't actually write VB:
sckBNET.Close
X = Form2.BNCSPort.Value ' or just X = 6112 if you want to ewwishly hardcode the port
Y = varServer
If Form2.Proxy.Value = 1 Then
TextAdd "SOCK: Connecting..."
X = 1080
Y = varProxy
End If
sckBNET.Connect Y, X
Quote from: TriCk on November 21, 2003, 10:56 PM
sckBNET.Close
X = Form2.BNCSPort.Value
' or just X = 6112 if you want to hardcode the port
Y = varServer
If Form2.Proxy.Value = 1 Then
TextAdd "SOCK: Connecting..."
X = 1080
Y = varProxy
End If
sckBNET.Connect Y, X
Also, let's talk about meaningful variable names and that magical TAB key. This code is a sloppy mess! Allow me to rewrite it using slightly more meaningful names:
sckBNET.Close
If Form2.Proxy.Value = 1 Then
TextAdd "SOCK: Connecting..."
lngPort = 1080
strServer = varProxy
Else 'user doesn't want to use a proxy
lngPort = CLng(Form2.BNCSPort.Value) ' or just = 6112 if you want to hardcode the port
strServer = varServer
End If
sckBNET.Connect strServer, lngPort 'Makes much more literal sense than "connect y, x"!
'You connect to the SERVER on the PORT, not the Y on the X.
Compare the two blocks of code. Which one is more readable? White space is cheap, the adding tabs and blank lines in your code does not affect the performance of your program but makes things MUCH easier on yourself and other people -- especially if you want help with your code.
Picky. The only thing I agreed with was the tabbing. X, Y and Z's are prime variable names in examples!
Quote from: Stealth on November 22, 2003, 02:42 PMAlso, let's talk about meaningful variable names and that magical TAB key. This code is a sloppy mess!
You want to write better in the posting box, go ahead. I didn't see the need to clean up his tabbing style since tabs don't work in the posting box; X and Y are simple variable names, so I picked them in preference to long ones that would be more work to type. Incidentally, I don't find your variable names much better. They're a nuisance to type.
All right, so maybe I was a little harsh. Sorry.. it's been a long week. ::)
[edit] And, I didn't realize that the code you posted was an EXAMPLE; I thought it was his original code. Yeesh, I need to sleep.