Valhalla Legends Forums Archive | Battle.net Bot Development | S -> C 0x50?

AuthorMessageTime
Piccolo
Hey!
I've been learning for some time (Visual Basic) now and decided to make a bot some weeks ago.
I know how to read and send packets and etc.
My problem: I don't seem to receive 0x50 back from B.net.
I receive 0x25 but not 0x50.
Maybe packets are merging together or something is wrong?

Help would be appreciated.
September 24, 2006, 5:40 PM
Quarantine
It's going to be difficult to help you out unless you atleast post what order you're sending your packets in.

September 24, 2006, 5:41 PM
Piccolo
[quote author=Warrior link=topic=15781.msg158877#msg158877 date=1159119705]
It's going to be difficult to help you out unless you atleast post what order you're sending your packets in.
[/quote]
I've connected to BNLS.
Sent 0x0E to BNLS.
Received a response.
I connected to Bnet..sent 0x01.
I then sent 0x50.
I received 0x25.
That's where I'm stuck.
September 24, 2006, 5:43 PM
l2k-Shadow
probably sending your 0x50 wrong then, showing the code would help us pinpoint the error.
September 24, 2006, 6:03 PM
Piccolo
[quote author=l2k-Shadow link=topic=15781.msg158881#msg158881 date=1159121006]
probably sending your 0x50 wrong then, showing the code would help us pinpoint the error.
[/quote]

PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H49583836 'IX86
PacketBuf.InsertDWORD &H53455850 'SEXP
PacketBuf.InsertDWORD &HCF 'Verbyte
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertNTString "CAN" 'Country Abbr.
PacketBuf.InsertNTString "Canada" 'Country Name
PacketBuf.SendPacket Winsock2, &H50
AddChat vbYellow, "Sent: 0x50"

PacketBuf is my Packet Buffer.
September 24, 2006, 6:12 PM
MyStiCaL
Winsock2 is your sck_BNET or sck_BNLS?
September 24, 2006, 7:00 PM
Piccolo
[quote author=Mystical link=topic=15781.msg158887#msg158887 date=1159124404]
Winsock2 is your sck_BNET or sck_BNLS?
[/quote]

Winsock2 is my winsock to BNET.
September 24, 2006, 7:01 PM
MyStiCaL
maybe its in your packetbuffer.. :|
September 24, 2006, 7:10 PM
Piccolo
I used DarkMinion's packet buffer  ???
September 24, 2006, 7:15 PM
MyStiCaL
that's one old packetbuffer.. :P I don't remember if hmm, i forgot.. stupid moment.
September 24, 2006, 7:17 PM
l2k-Shadow
well your 0x50 looks correct, i think then that your error must be in your Winsock_DataArrival() sub. most likely not parsing clumped packets correctly.
September 24, 2006, 7:39 PM
Quarantine
How can he get a clumped packet so early on?

You may be right about his DataArrival parsing being wrong however.
September 24, 2006, 7:53 PM
Topaz
Are you sending the protocol byte?
September 24, 2006, 8:17 PM
l2k-Shadow
[quote author=Warrior link=topic=15781.msg158899#msg158899 date=1159127633]
How can he get a clumped packet so early on?

You may be right about his DataArrival parsing being wrong however.
[/quote]

Well I sometimes get 0x25 and 0x50 clumped at the beginning, so it is a possibility. I don't think it's the protocol byte because then he wouldn't receive 0x25. So then it's either bad parsing or bad packet buffer.
September 24, 2006, 8:40 PM
Spilled[DW]
Your best bet is that they ARE being clumped as Shadow said, Please post your dataarrival and a packet log to help us find the solution
September 24, 2006, 10:22 PM
Piccolo
Eh, I found that that was my Data_Arrival sub...

I got this(I found this sub on this forum):
[code]
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
    Static PktBuff As String 'Packet Buffer
    Dim Incoming As String
    Dim PacketLength As Long
    Winsock2.GetData Incoming, vbString, bytesTotal
    PktBuff = PktBuff & Incoming
   
    While Len(PktBuff) > 3
        PacketLength = GetWord(Mid$(PktBuff, 3, 2))
        If Len(PktBuff) < PacketLength Then Exit Sub
        ParseData Left(PktBuff, PacketLength))
        PktBuff = Mid(PktBuff, PacketLength + 1)
    Wend
End Sub
[/code]

When I run it, I get a type mismatch error... it highlights this line:
[code]
ParseData Left(PktBuff, PacketLength))
[/code]

ParseData is another sub that takes my packets and, like the name explains, parse packets.
September 24, 2006, 10:36 PM
l2k-Shadow
you have an extra ) at the end ::)
September 24, 2006, 10:38 PM
Piccolo
[quote author=l2k-Shadow link=topic=15781.msg158922#msg158922 date=1159137491]
you have an extra ) at the end ::)
[/quote]

Sorry, I made a mistake in my post. It was supposed be:
[code]
ParseData (Left(PktBuff, PacketLength))
[/code]

I still get the same error.
September 24, 2006, 10:40 PM
l2k-Shadow
Then your ParseData is looking for something other than a string.
September 24, 2006, 10:43 PM
Piccolo
Here is my ParseData sub.
It was just a test to see if I received the packets correctly.
[code]
Public Sub ParseData(PacketID As Long)
'Parsing
Select Case PacketID
Case &H25
AddChat vbYellow, "Received: 0x25"
Case &H50
AddChat vbYellow, "Received: 0x50"
End Select
End Sub
[/code]
September 24, 2006, 10:47 PM
l2k-Shadow
[quote author=Abolition link=topic=15781.msg158925#msg158925 date=1159138045]
Here is my ParseData sub.
It was just a test to see if I received the packets correctly.
[code]
Public Sub ParseData(PacketID As Long)
'Parsing
Select Case PacketID
Case &H25
AddChat vbYellow, "Received: 0x25"
Case &H50
AddChat vbYellow, "Received: 0x50"
End Select
End Sub
[/code]
[/quote]

Exactly, your ParseData is expecting a Long, but Left$() returns a String.
September 24, 2006, 11:20 PM
ImaWh0re
[quote author=Abolition link=topic=15781.msg158923#msg158923 date=1159137600]
[quote author=l2k-Shadow link=topic=15781.msg158922#msg158922 date=1159137491]
you have an extra ) at the end ::)
[/quote]

Sorry, I made a mistake in my post. It was supposed be:
[code]
ParseData (Left(PktBuff, PacketLength))
[/code]

I still get the same error.
[/quote]


Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))

But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
September 25, 2006, 12:29 AM
FrostWraith
Dear God, just post a packet log.
September 25, 2006, 12:55 AM
l2k-Shadow
[quote author=ImaWh0re link=topic=15781.msg158933#msg158933 date=1159144182]
[quote author=Abolition link=topic=15781.msg158923#msg158923 date=1159137600]
[quote author=l2k-Shadow link=topic=15781.msg158922#msg158922 date=1159137491]
you have an extra ) at the end ::)
[/quote]

Sorry, I made a mistake in my post. It was supposed be:
[code]
ParseData (Left(PktBuff, PacketLength))
[/code]

I still get the same error.
[/quote]


Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))

But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
[/quote]

Yes! Use Val#() on a string, excellent suggestion.
September 25, 2006, 1:47 AM
LoRd
Click.
September 25, 2006, 2:13 AM
Topaz
[quote author=Lord[nK] link=topic=15781.msg158938#msg158938 date=1159150433]
Click.
[/quote]

I own a copy, I'll sell it for $15.
September 25, 2006, 2:18 AM
FrostWraith
I have it too lol. Not useful anymore. Il sell for $10.
September 25, 2006, 2:58 AM
ImaWh0re
[quote author=l2k-Shadow link=topic=15781.msg158936#msg158936 date=1159148873]
[quote author=ImaWh0re link=topic=15781.msg158933#msg158933 date=1159144182]
[quote author=Abolition link=topic=15781.msg158923#msg158923 date=1159137600]
[quote author=l2k-Shadow link=topic=15781.msg158922#msg158922 date=1159137491]
you have an extra ) at the end ::)
[/quote]

Sorry, I made a mistake in my post. It was supposed be:
[code]
ParseData (Left(PktBuff, PacketLength))
[/code]

I still get the same error.
[/quote]


Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))

But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
[/quote]

Yes! Use Val#() on a string, excellent suggestion.
[/quote]

Dear MORON,
  Msgbox Val#("23")
September 25, 2006, 4:54 AM
MyStiCaL
[quote author=Abolition link=topic=15781.msg158925#msg158925 date=1159138045]
Here is my ParseData sub.
It was just a test to see if I received the packets correctly.
[code]
Public Sub ParseData(PacketID As Long)
'Parsing
Select Case PacketID
Case &H25
AddChat vbYellow, "Received: 0x25"
Case &H50
AddChat vbYellow, "Received: 0x50"
End Select
End Sub
[/code]
[/quote]


maybe somthing like?
[code]
Public Sub ParseData(Data as String)

   Dim PacketID As Byte
       PacketID = Asc(Mid(Data, 2, 1))
   
          Select Case PacketID

                     Case &H25

                     Case &H50

                     Case &H51

           End Select

End Sub
[/code]
September 25, 2006, 5:04 AM
l2k-Shadow
[quote author=ImaWh0re link=topic=15781.msg158951#msg158951 date=1159160099]
[quote author=l2k-Shadow link=topic=15781.msg158936#msg158936 date=1159148873]
[quote author=ImaWh0re link=topic=15781.msg158933#msg158933 date=1159144182]
[quote author=Abolition link=topic=15781.msg158923#msg158923 date=1159137600]
[quote author=l2k-Shadow link=topic=15781.msg158922#msg158922 date=1159137491]
you have an extra ) at the end ::)
[/quote]

Sorry, I made a mistake in my post. It was supposed be:
[code]
ParseData (Left(PktBuff, PacketLength))
[/code]

I still get the same error.
[/quote]


Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))

But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
[/quote]

Yes! Use Val#() on a string, excellent suggestion.
[/quote]

Dear MORON,
  Msgbox Val#("23")

[/quote]

Yes, however, Left$(PktBuff, PacketLength) does not return a number.
September 25, 2006, 5:08 AM
ImaWh0re
[quote author=l2k-Shadow link=topic=15781.msg158953#msg158953 date=1159160924]
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
[/quote]

Msgbox Val#(Left$("23",2))

Better? Comprende?
September 25, 2006, 5:16 AM
Topaz
[quote author=ImaWh0re link=topic=15781.msg158954#msg158954 date=1159161419]
[quote author=l2k-Shadow link=topic=15781.msg158953#msg158953 date=1159160924]
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
[/quote]

Msgbox Val#(Left$("23",2))

Better? Comprende?
[/quote]

The point is, you're not supposed to do it. Val# returns a Double (which is a float, iirc), whereas it expects a Long.
September 25, 2006, 5:31 AM
Spilled[DW]
[quote author=ImaWh0re link=topic=15781.msg158954#msg158954 date=1159161419]
[quote author=l2k-Shadow link=topic=15781.msg158953#msg158953 date=1159160924]
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
[/quote]

Msgbox Val#(Left$("23",2))

Better? Comprende?
[/quote]

Val:
http://msdn2.microsoft.com/en-us/library/k7beh1x9.aspx

CLng:
http://msdn2.microsoft.com/en-us/library/ck4c5842.aspx

hrmm i wonder....
September 25, 2006, 5:39 AM
ImaWh0re
[quote author=topaz link=topic=15781.msg158955#msg158955 date=1159162306]
[quote author=ImaWh0re link=topic=15781.msg158954#msg158954 date=1159161419]
[quote author=l2k-Shadow link=topic=15781.msg158953#msg158953 date=1159160924]
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
[/quote]

Msgbox Val#(Left$("23",2))

Better? Comprende?
[/quote]

The point is, you're not supposed to do it. Val# returns a Double (which is a float, iirc), whereas it expects a Long.
[/quote]

That it does, I was just trying to state that it doesn't matter if you do that to a string. As I said before the coding was whacked. By the way, I find it very funny how you people look this up before saying something, it's like its battle of the wits after googling information. I'm not flaming any person when I say that either, just saying.


Although yes it should of been common sense on my part. I was wrong, I don't have a problem admitting to that unlike a lot of people.
September 25, 2006, 8:07 AM
Topaz
[quote author=ImaWh0re link=topic=15781.msg158966#msg158966 date=1159171628]
That it does, I was just trying to state that it doesn't matter if you do that to a string. As I said before the coding was whacked. By the way, I find it very funny how you people look this up before saying something, it's like its battle of the wits after googling information. I'm not flaming any person when I say that either, just saying.
[/quote]

Of course, we don't like making up stuff.
September 25, 2006, 1:40 PM

Search