• Welcome to Valhalla Legends Archive.
 

Re: Insults

Started by brew, February 18, 2007, 02:10 PM

Previous topic - Next topic

brew

Allright sounds cool
its sad how immature some people could be though -_-
Especially on the "why is bnls down" topic I started in general
Anyways speaking of which, my bot is doing it again (disconnecting on send packet)
If there's anything wrong please tell me although I highly doubt it's my code....

Public Sub BNLSSend0x09()
    Dim buf$
    buf = pbuffer.MakeDWORD(GetClient(Client)) & pbuffer.MakeDWORD(mpqNumber) & ChecksumFormula
    SendBNLS buf, &H9
End Sub

Public Sub BNLSSend0x1A()
    Dim buff$
    buff = pbuffer.MakeDWORD(GetClient(Client)) & pbuffer.MakeDWORD(0) & pbuffer.MakeDWORD(&H3713) & Filetime & mpqName & ChecksumFormula
    SendBNLS buff, &H1A
End Sub

Public Sub SendBNLS(Buffer As String, PacketID As Byte)
    frmMain.BNLSWS.SendData pbuffer.MakeWORD(Len(Buffer) + 3) & Chr(PacketID) & Buffer
    AddChat vbYellow, "[BNLS] Sending 0x" & Hex(PacketID) & "..."
End Sub
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Spht

Quote from: BreW on February 18, 2007, 02:10 PM
its sad how immature some people could be though -_-
Especially on the "why is bnls down" topic I started in general

Careful

brew

<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Don Cullen

#3
Got a packet log?

Edit: I just looked at your code and examined them -- all three subs are fine.

Your bot of course should be outputting debug information/logs, so could you paste the debug info here? This way we can see where your bot failed. Packet logs of where exactly it failed would also help.

On a side note, it's not BNLS; I tested BNLS with my bot. It connected and processed packets with no problem. So the problem must be somewhere in your code...
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

brew

Quote from: Kyro on February 18, 2007, 02:30 PM
Quote from: BreW on February 18, 2007, 02:10 PMits sad how immature some people could be though -_-

Ease up. The same can be said for you. While I understand that provocation was the case here, as I have said several times before; if someone annoys you, make no mention of it and ignore it. If you feel the need, PM one of the moderators. By focusing on the annoyance, you become an annoyance yourself since you'll be disrupting the forums just as much as the others are. This is why you're having problems; you're an easy target to annoy. So don't let yourself get annoyed so easily, and disregard any annoyances. Recommendation, just take the advice, and focus on your BNLS problem rather than talking about annoyances. :)

Secondly, as for your BNLS problem; got a packet log?

Uhhh sure h/o anyways I originally made this post in the "insults" topic and it got moved

Allright heres the packetlog-
I send to bnls.....

1C 00 09 00 00 00 00 11 00 00 00 75 D6 47 8D 23  ...........u.G.#
15 AD 51 DB A6 6C 01 ED 99 02 BE 00              ..Q..l......   


And i get back from bnls.....





nothing! It disconnects me after that. Heres a packetlog of me using the 0x1a instead:
Weird, i send this before or while (not sure) attempting to create a connection

02 04 05 B4 01 01 04 02                          ........       


then i get sent back


02 04 05 AC 01 01 04 02                          ........   


here's the acual packet I send to bnls

3C 00 1A 00 00 00 00 00 00 00 00 13 37 00 00 00  <...........7...
60 95 D7 72 FC C6 01 6C 6F 63 6B 64 6F 77 6E 2D  `..r...lockdown-
49 58 38 36 2D 31 32 2E 6D 70 71 47 1E 1A 0F F6  IX86-12.mpqG....
70 A0 6B B4 DC 5F 2E 96 1F 6F 9C 00              p.k.._...o..   


It disconnects me after that :(
Also i've noticed bnet sends ME a weird TCP packet when I send the 0x50 & 0x25...

05 00 00 00 74 65 6E 62                          ....tenb     
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Don Cullen

Can you post your DataArrival event? What about the parser? Don't need to post the whole parser, just the header part for the part. Also what are you using for a packet debuffer?

For example (posting partial parser):

Public Sub ParseBNLSPacket(ByVal PacketData As String)
    Dim PacketID As Byte
    Dim PacketLen As Long
    Dim Results As Boolean
    PktDeBuf.SetData (PacketData)
    PacketLen = PktDeBuf.rWORD()
    PacketID = PktDeBuf.rBYTE()
    RaiseEvent DebugOutput("Received Packet: 0x" & Hex$(PacketID) & " (" & GetBNLSPacketName(PacketID) & ")")
    Select Case PacketID


So what does your parser header look like?

[Edit] BreW, might want to change the title of the thread to a better one to grab more attention so more people will help.
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

brew

I don't get any data back TO parse... that's the problem heh Anyways if I do get it here's my code for it:


Private Sub BNLSWS_DataArrival(ByVal bytesTotal As Long)
    Dim Data As String
    AddChat vbGreen, "[BNLS] Recieved 0x09!"
    BNLSWS.GetData Data
    AddChat vbGreen, StrToHex(Data)
    BNLSParse0x09 Data
    BNLSWS.Close
End Sub



Public Sub BNLSParse0x09(Data As String)
    EXEVersion = pbuffer.GetDWORD(Mid(Data, 8, 4))
    Checksum = pbuffer.GetDWORD(Mid(Data, 12, 4))
    EXEInfo = KillNull(Mid$(Data, 16))
    frmMain.BNLSWS.Close
    Send0x51
End Sub


Edit* lol i just noticed i close it twice -.- oh well haha, just to be safe i guess
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Don Cullen

#7
BNLS automatically disconnects when they get no further packets from you. BNLS also automatically disconnects if they get an invalid packet. So either one of those is the case.

But the real problem here is your DataArrival sub. Your sub isn't waiting until the end of a packet before parsing it.

[Edit]

I have a few recommendations for you. Get a packet buffer class and a packet debuffer class. Fix your DataArrival sub so it waits until the end of a packet before sending the packet along to your parser. And your parser shouldn't handle only one packet, it should be coded so it can handle more than one packet.

If you like, I can provide you with links to a packet buffer class by either DarkMinion or Hdx, and also a packet debuffer class by Hdx. Both classes were released into the public domain, AFAIK. I currently use DarkMinion's for packet buffering, and Hdx's for packet debuffering.
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

MysT_DooM

Quote from: BreW on February 18, 2007, 02:39 PM

Also i've noticed bnet sends ME a weird TCP packet when I send the 0x50 & 0x25...

05 00 00 00 74 65 6E 62                          ....tenb     


that deals with the games udp ports, use the search button if you want more info on it


vb6, something about that combination of numbers and letters is sexy

Don Cullen

Quote from: MysT_DooM on February 18, 2007, 03:05 PM
Quote from: BreW on February 18, 2007, 02:39 PM

Also i've noticed bnet sends ME a weird TCP packet when I send the 0x50 & 0x25...

05 00 00 00 74 65 6E 62                          ....tenb     


that deals with the games udp ports, use the search button if you want more info on it

That deals with this: http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=31

It can be safely ignored. Worst that happens is your bot will get a lag plug icon.

Don't worry about that yet. Just focus on getting your BNLS working.
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

rabbit

Giving logs with the packet headers would help a lot more.

[edit]
.....your mother.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

brew

Noooo guys, I was going to point it out but i thought it was obvious enough. First of all it should begin with the header, of an 0xFF, 0x14, then the packet length. Second, it's a TCP packet. Notice how it's a "UDP" ping response. Then third, you are supposed to only get that AFTER you pass the 0x51 (we're talking way before that). And kyro, I know for SURE it's not my coding because it worked with the same exact code two, three days ago. Yesterday I heard that BNLS had an error where it would treat all users as ipbanned. Spht was supposed to have fixed this. Also notice how I don't have a packetbuffer/debuffer class for BNLS at all. It's only because I send ONE packet, and nothing more. The only reason why I split the send bnls function into a different sub is because I thought I'd try sending an 0x1a instead of the 0x09, like everyone bugs me about constantly. And maybe BNLS had the 0x09 packet disabled. I have no idea. But, trust me people have been having problems with this since yesterday, and all of a sudden it started working last night and this morning, then supposedly it "broke" again. Hope this clears it up. What I really want to know is what's wrong with BNLS? I'm just about to switch to a checkrevision catche function.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Barabajagal

Try using JBLS and see if that works?

brew

JBLS acually works with the lockdown mpqs? Since when? Damn you, hdx. Stop holding out on us like that -.-
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Don Cullen

#14
Quote from: rabbit on February 18, 2007, 03:31 PM
Giving logs with the packet headers would help a lot more.

[edit]
.....your mother.

Ease up, rabbit. Spht says the ultimatium applies to everyone including me, you, and BreW.

Quote from: BreW on February 18, 2007, 03:33 PM
Noooo guys, I was going to point it out but i thought it was obvious enough. First of all it should begin with the header, of an 0xFF, 0x14, then the packet length. Second, it's a TCP packet. Notice how it's a "UDP" ping response. Then third, you are supposed to only get that AFTER you pass the 0x51 (we're talking way before that). And kyro, I know for SURE it's not my coding because it worked with the same exact code two, three days ago. Yesterday I heard that BNLS had an error where it would treat all users as ipbanned. Spht was supposed to have fixed this. Also notice how I don't have a packetbuffer/debuffer class for BNLS at all. It's only because I send ONE packet, and nothing more. The only reason why I split the send bnls function into a different sub is because I thought I'd try sending an 0x1a instead of the 0x09, like everyone bugs me about constantly. And maybe BNLS had the 0x09 packet disabled. I have no idea. But, trust me people have been having problems with this since yesterday, and all of a sudden it started working last night and this morning, then supposedly it "broke" again. Hope this clears it up. What I really want to know is what's wrong with BNLS? I'm just about to switch to a checkrevision catche function.

There's nothing wrong with BNLS. It's your DataArrival code.

Just use this for your BNLS socket DataArrival:

Private Sub BNLSWS_DataArrival(ByVal bytesTotal As Long)
    Static PktBuff As String 'Packet Buffer
    Dim Incoming As String
    BNLSWS.GetData Incoming, vbString, bytesTotal
    PktBuff = PktBuff & Incoming
    Dim Pkt As BNCSPKT
    While Len(PktBuff) > 3
        Pkt.intPktLen = GetWord(Left$(PktBuff, 2))
        If Len(PktBuff) < Pkt.intPktLen Then Exit Sub
        ParseBNLSPacket (Left(PktBuff, Pkt.intPktLen))
        PktBuff = Mid(PktBuff, Pkt.intPktLen + 1)
    Wend
End Sub


Here's the additional code you'll need to be able to run the DataArrival code-- I think you'll know where to put them:

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numbytes As Long)

'Type coded by Lord[nK]
Public Type BNCSPKT
    bytPktHdr  As Byte
    bytPktID   As Byte
    intPktLen  As Integer
    strPktData As String
End Type

Dim HashedKeyData(4) as Long

Public Function GetWord(Data As String) As Long
    Dim lReturn As Long
    Call CopyMemory(lReturn, ByVal Data, 2)
    GetWord = lReturn
End Function


For your BNLS Parser, you can use:

Public Sub ParseBNLSPacket(ByVal PacketData As String)
    Dim PacketID As Byte
    Dim PacketLen As Long
    Dim Results As Boolean
    PktDeBuf.SetData (PacketData)
    PacketLen = PktDeBuf.rWORD() 'Get WORD using whatever method you're using
    PacketID = PktDeBuf.rBYTE() 'Get BYTE using whatever method you're using
    AddChat vbGreen, "Received Packet: 0x" & Hex$(PacketID)
    Select Case PacketID
        Case &H1    'BNLS_CDKEY
            Results = CBool(PktDeBuf.rDWORD)
            If Results = False Then
                AddChat vbRed, "BNLS reported failure with 0x01 (BNLS_CDKEY). Disconnecting."
                Disconnect
            End If
ClientToken = PktDeBuf.rDWORD 'Get DWORDs using whatever method you're using
            KeyLength = PktDeBuf.rDWORD
            CDKeyProdValue = PktDeBuf.rDWORD
            CDKeyPubValue = PktDeBuf.rDWORD
            Unknown = PktDeBuf.rDWORD
            HashedKeyData(0) = PktDeBuf.rDWORD
            HashedKeyData(1) = PktDeBuf.rDWORD
            HashedKeyData(2) = PktDeBuf.rDWORD
            HashedKeyData(3) = PktDeBuf.rDWORD
            HashedKeyData(4) = PktDeBuf.rDWORD
            Call BNLS_VERSIONCHECKEX2
    End Select
    PktDeBuf.ClearData        'Clear packet
    'finished parsing.
End Sub


Hope that solves your problem. I included the 0x01 BNLS_CDKEY packet in the parser so you'd have an idea of how to add packets to the parser, such as 0x1A or 0x09
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.