I was reading up on the Val() function and I came to the conclusion that many of the older model bots used things like Val(Mid(cdkey, 5, 8)), just as an example. I don't see what the point of doing this is, won't you just receive the same code if you left out the Val() function? Or were they just using the Val() function so that the code for starcraft and for other clients would use the same stuff?
QuoteVal(Mid(cdkey, 5, 8))
What bot uses that? Can you give a REAL example?
No bot uses that, I even stated that that was just an example. I also said that "older model" bots used code like this. Here is an example, taken from the source of 0x51 Bot:
dValue1 = Val(Mid$(sCDKey, 3, 7))
This would be for starcraft too.
I can't see why they would be doing that. :-\
Val() simply returns the numeric value of a string's contents as a double. Use it carefully. Examples:
Val("-1") = -1.0
Val(",1") = 0.0
Val("2353") = 2353.0
Val("not a number") = 0.0
The example will presumably take a Starcraft CDKey, which is stored in a string
"1234567890123"
and extract 7 digits beginning at the 3rd using Mid():
"3456789"
then convert it to a double using Val() so that it can be used in mathematical operations.
3456789.0
Val() can also do the following:
Val("654gffd33") = 654
In that example (not above), it was used by the 0x51 Bot example.
You shouldn't use 0x51 Bot. It's horrible.
Quote from: rabbit on March 26, 2005, 07:46 PM
You shouldn't use 0x51 Bot. It's horrible.
Correction: You shouldn't use any open source VB bot. They're all horrible.
(No, this isn't an attack at open source, it's just a proven fact that all open source VB bots are horrible)
Quote from: UserLoser on March 26, 2005, 08:07 PM
Correction: You shouldn't use any open source VB bot. They're all horrible.
(No, this isn't an attack at open source, it's just a proven fact that all open source VB bots are horrible)
Really? (http://www.cold-chaos.net/lord/Programming/Battle.net/BBBCollection/VB6.zip)
Well actually, I'm not even using Visual Basic. I'm using 0x51 Bot for learning purposes to create my own hashing functions written in Python. I created my own Val() function in Python, it does the exact same thing that it does in VB6. As long as a bot works, I find no harm in using any ideas from it.
Quote from: Newby on March 26, 2005, 08:12 PM
Quote from: UserLoser on March 26, 2005, 08:07 PM
Correction: You shouldn't use any open source VB bot. They're all horrible.
(No, this isn't an attack at open source, it's just a proven fact that all open source VB bots are horrible)
Really? (http://www.cold-chaos.net/lord/Programming/Battle.net/BBBCollection/VB6.zip)
Yes, I already looked at that
Public Const CON_STATUS_CONNECTING = &H1
Public Const CON_STATUS_CONNECTED = &H2
Public Const CON_STATUS_RECONNECT_PENDING = &H4
Public Const CON_STATUS_LOGGEDIN = &H8
Public Const CON_STATUS_INCHAT = &H10
Public Const CON_STATUS_INGAME = &H12
Broken values for a bitmask
Public Function GetDWORD(ByVal Data As String) As Long
Dim a As String, b As String, C As String, D As String
Dim tmp As String
tmp = StrToHex(Data)
a = Mid$(tmp, 1, 2)
b = Mid$(tmp, 3, 2)
C = Mid$(tmp, 5, 2)
D = Mid$(tmp, 7, 2)
tmp = D & C & b & a
GetDWORD = CLng(Val("&H" & tmp))
End Function
Public Function GetWORD(ByRef Data As String) As Long
Dim tmp As String
Dim a As String
Dim b As String
tmp = StrToHex(Data)
a = Mid$(tmp, 1, 2)
b = Mid$(tmp, 3, 2)
tmp = b & a
GetWORD = CLng(Val("&H" & tmp))
End Function
That's... horrible... use CopyMemory
Public Function MakeFILETIME(ByRef pFILETIME As Long) As String
Dim tmpBuf As String * 8
Call memmove(ByVal tmpBuf, ByVal pFILETIME, Len(tmpBuf))
MakeFILETIME = tmpBuf
End Function
Looks like that should be named MAKE8BYTELONGSTRING, why calling Len? It's 8
ERROR_HANDLER:
If Err.Number = 10048 Then
iLocalPort = iLocalPort + 1
With sckUDP
.LocalPort = iLocalPort
.Bind
End With
End If
Use setsockopt to allow the address to be reused instead of bruteforcing it
strCompName = String(255, MakeBYTE(0))
strCompUsrName = String(255, MakeBYTE(0))
lngCompNameSize = LenB(strCompName)
lngCompUsrNameSize = LenB(strCompUsrName)
Length is 510... why call LenB?
MakeBYTE(0)? Why is it taking a 0 as a byte, copying it into a string, then returning it into a 8-bit value?
Dim tmpInBuf As New clsPktInBuf
Dim PktOutBuf As New clsPktOutBuf
I see this over and over, and the classes are never destroyed. You probably would want to delete those when you're done with them...
I can go on more... Please, just read my original statement and don't bother going against it
BBBB is far from being done. It lacks comments, and is yet to actually connect to Battle.net. Many of the current functions and declarations are there just to get the job done while I focus on reversing certain functions from battle.snp/storm.dll which is my top priority.
I use Len() to ensure easy modifcation of the code which is much more important than the 0.000001 millisecond or w/e the exact speed difference may be, especially since this code may be used in multiple projects so the code may need to be changed slightly at a later time. I wish Visual Basic supported compile-time functions because a sizeof() would be a big help here.
The typo in the connection status masks has already been fixed.
Generally, I only define objects in functions so the objects will be destroyed when the function collapses. I have a few which are declared within a class scope, but that's because the class would not function properly without the objects, so there'd be no reason why you'd want to destroy them.
Please go on. One of the benefits of programming open source is that users can comment on my code which helps me to find/fix bugs as well as improve certain things that I either haven't noticed or haven't gotten around to.
Quote from: LoRd[nK] on March 26, 2005, 09:15 PM
BBBB is far from being done. It lacks comments, and is yet to actually connect to Battle.net. Many of the current functions and declarations are there just to get the job done.
I use Len() to ensure easy modifcation of the code which is much more important than the 0.000000001 millisecond or w/e the exact amount difference in speed may be.
The typo in the connection status masks has already been fixed.
Generally, I only define constant classes in functions so the objects will be destroyed when the function collapses.
Please go on. One of the benefits of programming open source is that users can comment on the code which helps me in finding/fixing bugs and improving code.
I hate to say this, but I feel good about you saying to go on with complaining about things as a benefit of open source projects. Fix existing things and we'll see at a later time :P