• Welcome to Valhalla Legends Archive.
 

Val()

Started by Yegg, March 26, 2005, 03:49 PM

Previous topic - Next topic

Yegg

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?

Blaze

QuoteVal(Mid(cdkey, 5, 8))

What bot uses that? Can you give a REAL example?
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Yegg

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.

Blaze

I can't see why they would be doing that. :-\
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Stealth

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
- Stealth
Author of StealthBot

Yegg

Val() can also do the following:
Val("654gffd33") = 654
In that example (not above), it was used by the 0x51 Bot example.

R.a.B.B.i.T

You shouldn't use 0x51 Bot.  It's horrible.

UserLoser.

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)

Newby

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?
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Yegg

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.

UserLoser.

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?

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

Eric

#11
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.

UserLoser.

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