Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Elneroth on June 28, 2005, 02:35 PM

Title: Packet Help - Local IP
Post by: Elneroth on June 28, 2005, 02:35 PM
(DWORD)       Local IP for NAT compatibility*

Local IP
This is the local network IP of the client, in network byte order.

I'm having trouble with this.
Do I just insert a DWORD with the local IP? (192.168.1.100) Doesn't make sense.

Please help, TYVM
Title: Re: Packet Help - Local IP
Post by: QwertyMonster on June 28, 2005, 02:38 PM
What packet is this for, or what? Please say, and i will look into it.
Title: Re: Packet Help - Local IP
Post by: Elneroth on June 28, 2005, 02:38 PM
Message ID: 0x50
Message Name: SID_AUTH_INFO 
Direction: Client -> Server (Sent)
Title: Re: Packet Help - Local IP
Post by: Elneroth on June 28, 2005, 02:40 PM
Is it possible to skip the following?
(DWORD)       Local IP for NAT compatibility*
(DWORD)       Time zone bias*
(DWORD)       Locale ID*
(DWORD)       Language ID*
(STRING)     Country abreviation
(STRING)     Country

And send the packet without that information?
Title: Re: Packet Help - Local IP
Post by: Blaze on June 28, 2005, 02:43 PM
* can be replaced with 0.
Title: Re: Packet Help - Local IP
Post by: shout on June 28, 2005, 02:43 PM
192.168.1.100 -> 0x6401A8C0

Imagine all the triplets were switched.
192 -> C0
168 -> A8
1     -> 01
100 -> 64
Title: Re: Packet Help - Local IP
Post by: Ringo on June 28, 2005, 02:44 PM
Quote from: Elneroth on June 28, 2005, 02:35 PM
(DWORD)       Local IP for NAT compatibility*

Local IP
This is the local network IP of the client, in network byte order.

I'm having trouble with this.
Do I just insert a DWORD with the local IP? (192.168.1.100) Doesn't make sense.

Please help, TYVM

You need to turn each number of the address into a byte
You could do it as a string if your lazzy;

Dim Splitter(3) as string
Splitter = Split(Sockets.localip, ".")
Stringthing = Chr(Splitter(0)) & Chr(Splitter(1)) & Chr(Splitter(2)) & Chr(Splitter(3))
Title: Re: Packet Help - Local IP
Post by: Elneroth on June 28, 2005, 02:45 PM
Alright, Thanks for the help
Title: Re: Packet Help - Local IP
Post by: QwertyMonster on June 28, 2005, 02:46 PM
Yeah, put it with 0 mate. I did and it works fine. :)
Title: Re: Packet Help - Local IP
Post by: Elneroth on June 28, 2005, 02:49 PM
Alright, so far I have:

pktBnet.InsertDWORD 0
pktBnet.InsertNTString "68XI"
pktBnet.InsertNTString VarClient                 (Varclient = RATS)
pktBnet.InsertDWORD "&H" & VarVerByte   (Verbyte = CB)
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0

(STRING)     Country abreviation
(STRING)     Country
Can these be also set as 0 or do I have to acually do those?

*edit*, woops, didn't notice they were strings. Can they be left out is what I meant.
Title: Re: Packet Help - Local IP
Post by: QwertyMonster on June 28, 2005, 02:53 PM
Straight from an old version of my bot:


    Packet.InsertDWORD &H0
    Packet.InsertDWORD &H0
    Packet.InsertDWORD &H0
    Packet.InsertDWORD &H0
    Packet.InsertDWORD &H0
    Packet.InsertDWORD &H0
    Packet.InsertDWORD &H0
    Packet.InsertDWORD &H0
    Packet.InsertNTString "ENG" 'England
    Packet.InsertNTString "44" '44 is the mobile thing for england
    Packet.InsertNTString "GBR" 'Great britian
    Packet.InsertNTString "United Kingdom"
    Packet.SendPacket bnetsocket, &H12


Hope this helps mate.
Title: Re: Packet Help - Local IP
Post by: Blaze on June 28, 2005, 02:55 PM
Qwerty, your sending 0x12, hes sending 0x50 so your example is useless.
Title: Re: Packet Help - Local IP
Post by: QwertyMonster on June 28, 2005, 02:57 PM
Oh sorry, didnt relise. But it still shows the country abbrivation..
Title: Re: Packet Help - Local IP
Post by: Ringo on June 28, 2005, 03:05 PM
Quote from: Elneroth on June 28, 2005, 02:49 PM
Alright, so far I have:

pktBnet.InsertDWORD 0
pktBnet.InsertNTString "68XI"
pktBnet.InsertNTString VarClient                 (Varclient = RATS)
pktBnet.InsertDWORD "&H" & VarVerByte   (Verbyte = CB)
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0
pktBnet.InsertDWORD 0

(STRING)     Country abreviation
(STRING)     Country
Can these be also set as 0 or do I have to acually do those?

*edit*, woops, didn't notice they were strings. Can they be left out is what I meant.


with pktBnet
  .InsertDWORD 0
  .InsertNONNTString "68XI" <- with a null @ end will get u ip ban
  .InsertNONNTString VarClient                 (Varclient = RATS)
  .InsertDWORD val("&H" & VarVerByte)   (Verbyte = CB)
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertNTString "BOT"
  .InsertNTString "Robot Land"
end with


You were inserting "68XIRATS" into your buffer as "68XI" & Chr(0) & "RATS" & Chr(0)
That would have gotten you IP banned.
The nullstring, in that example as "BOT" is checked by the server, so must be a 3 byte nullstring, i think the last nullstring can be blank (its ignored i think*)

hope that helps
Title: Re: Packet Help - Local IP
Post by: Elneroth on June 28, 2005, 03:11 PM
Alright, thanks for the help everyone, i appreciate it.

Just one more check:

Private Sub SckCon_Connect()
AddChat vbGreen, " >> Connected!"
AddChat vbGreen, " >> Sending packet &H1E..."
sckCon.SendData Chr(1)
With pktBnet
  .InsertDWORD 0
  .InsertNonNTString "68XI"
  .InsertNonNTString VarClient
  .InsertDWORD Val("&H" & VarVerByte)
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertDWORD 0
  .InsertNTString "USA"
  .InsertNTString "United States"
End With
AddChat vbGreen, " >> Sending packet &H50... [68XI / " & VarClient & " / &H" & VarVerByte & "]"
pktBnet.SendPacket &H50

End Sub
Title: Re: Packet Help - Local IP
Post by: UserLoser. on June 28, 2005, 03:12 PM
Use inet_addr or as Kp always says, inet_pton or inet_aton.  I don't think the last two are used on Windows, though.

Edit:
Quote
.InsertDWORD Val("&H" & VarVerByte)

Let me be the first to say, wtf.  Just insert VarVerbyte, what you're doing is completely pointless...
Title: Re: Packet Help - Local IP
Post by: R.a.B.B.i.T on June 28, 2005, 08:34 PM
I really don't get why people always store the version byte as a string...it's a BYTE and hence NUMERICAL.  Dammit people....
Title: Re: Packet Help - Local IP
Post by: Archangel on June 28, 2005, 11:23 PM
Public varVerByte as Byte
varVerByte = &HCB (For starcraft)