Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Tazo on February 05, 2004, 04:08 PM

Title: Error converting IP
Post by: Tazo on February 05, 2004, 04:08 PM
When this is called, I get 'Type Mismatch' (VB)

Public Function makeip(Data As String) As String
   makeip = CLng("&H" & ToHex(Mid(Data, 1, 1))) & "." & CLng("&H" & ToHex(Mid(Data, 2, 1))) & "." & CLng("&H" & ToHex(Mid(Data, 3, 1))) & "." & CLng("&H" & ToHex(Mid(Data, 4, 1)))
End Function

This is trying to convert Data to an IP from 0x3E
it is called like this:

bah2 = Mid(Server, 5, 4)
frmMain.sckRealm.Connect makeip(bah2), 6112 'connecting to Realm

Correct me if I am wrong, but is the realm port 6112 or 6113
Title: Re:Error converting IP
Post by: l)ragon on February 05, 2004, 10:16 PM
Public Function DWORDtoIP(IPData As String) As String
Dim a As Integer, b As Integer, c As Integer, d As Integer
   If IPData = "" Then
       DWORDtoIP = "ERROR: Empty Data."
       Exit Function
   ElseIf Len(IPData) < 4 Then
       DWORDtoIP = "ERROR: Bad Data length."
       Exit Function
   ElseIf Len(IPData) > 4 Then
       DWORDtoIP = "ERROR: Bad Data length."
       Exit Function
   End If
   a = Asc(Mid(IPData, 1, 1))
   b = Asc(Mid(IPData, 2, 1))
   c = Asc(Mid(IPData, 3, 1))
   d = Asc(Mid(IPData, 4, 1))
   DWORDtoIP = a & "." & b & "." & c & "." & d
End Function

RealmServerIP = DWORDtoIP(Mid(Data3E, TheIPLocation, 4))

TheIPLocation != 5, and the port is normaly 6112.
Note: Not only the IP can be found in Data3E but the port can be found within it also.

Happy hunting.
Title: Re:Error converting IP
Post by: Tazo on February 06, 2004, 05:01 AM
I keep getting type mismatch when I do

Dim IP$
AddText vbYellow, "Attempting to connect to MCP
server " & DWORDtoIP(Mid(Data,IP, 4))

Any ideas?
btw, data is a string
Title: Re:Error converting IP
Post by: Grok on February 06, 2004, 10:10 AM
I posted a class module for use in VB projects that will be working with the internet.  Don't remember the class name, but if you search this forum for my posts in the last six months, you might find the link.  It will solve all your IP and HostName API call usage problems and eliminate the learning curve there.  Plus it will reduce your IQ by about 3 points.  That's relatively good compared to the 29 point damage that CSB does to you.

Spht, did you BotDev it or was it redundant to other libraries?

Title: Re:Error converting IP
Post by: Spht on February 06, 2004, 11:29 AM
Quote from: Grok on February 06, 2004, 10:10 AM
I posted a class module for use in VB projects that will be working with the internet.  Don't remember the class name, but if you search this forum for my posts in the last six months, you might find the link.  It will solve all your IP and HostName API call usage problems and eliminate the learning curve there.  Plus it will reduce your IQ by about 3 points.  That's relatively good compared to the 29 point damage that CSB does to you.

Spht, did you BotDev it or was it redundant to other libraries?

I don't recall you posting that here, so no.
Title: Re:Error converting IP
Post by: Networks on February 06, 2004, 12:22 PM
I dont mean to be stupid but does this mean you can discover someones IP on b.net or is it possible?
Title: Re:Error converting IP
Post by: MyndFyre on February 06, 2004, 01:36 PM
Quote from: Networks on February 06, 2004, 12:22 PM
I dont mean to be stupid but does this mean you can discover someones IP on b.net or is it possible?

No, it is no longer possible. I know it used to be part of diablo retail, but those clients are confined and that part of bnet's message that used to contain IP addresses no longer does.
Title: Re:Error converting IP
Post by: Dyndrilliac on February 06, 2004, 03:35 PM
It IS possible to display somone's IP Address on Client To Client Games(Like Diablo Retail, Starcraft, Etc), however it is only possible after the person owning the IP Address you desire to know has made a game, you can find the IP Address in the data sent via the Game List. This is also the source of making a couple crashes for those games(Where the victim attempts to join a game displaying invalid data in the gamelist and crashes upon clicking on the game in the lsit to see the data). As you can guess this also fails to work on private games. However, I currently have a Diablo Retail GameBot setup to massload(clog 7 copies of itself onto bnet), Create a game, and pass invalid data to the GameList causing anyone trying to join to crash. It also displays the IP Address of the creators of already made public games accessible to me on the Gamelist.
Title: Re:Error converting IP
Post by: Kp on February 06, 2004, 04:58 PM
Quote from: Dyndrilliac on February 06, 2004, 03:35 PMHowever, I currently have a Diablo Retail GameBot setup to massload(clog 7 copies of itself onto bnet), Create a game, and pass invalid data to the GameList causing anyone trying to join to crash. It also displays the IP Address of the creators of already made public games accessible to me on the Gamelist.

and I assume there's actually a point to ruining the experience of those few hold outs still playing Diablo?
Title: Re:Error converting IP
Post by: Dyndrilliac on February 06, 2004, 07:23 PM
Well,  It does it for SC/BW/Diablo, I just had it set for Diablo at the time.

But, there isn't a point.
Title: Re:Error converting IP
Post by: l)ragon on February 06, 2004, 09:58 PM
Quote from: laurion on February 06, 2004, 05:01 AM
I keep getting type mismatch when I do

Dim IP$
AddText vbYellow, "Attempting to connect to MCP
server " & DWORDtoIP(Mid(Data,IP, 4))

Any ideas?
btw, data is a string

heres a crude example

dim data as string, a as string, b as string, c as string
    Data = "abcdefghijkl"
    'Mid(STRING, LONG, LENGTH) = String
    a = DWORDtoIP(Mid(data, 1, 4)) 'you are takeing "abcd" from data and converting it to an ip
    b = DWORDtoIP(Mid(data, 5, 4)) 'you are takeing "efgh" from data and converting it to an ip
    c = DWORDtoIP(Mid(data, 9, 4)) 'you are takeing "ijkl" from data and converting it to an ip

    'print out the values to the Immediate window which you can bring up with Ctrl+G
    debug.print a
    debug.print b
    debug.print c

you might want to look up the use's of mid on http://msdn.microsoft.com
Title: Re:Error converting IP
Post by: Grok on February 06, 2004, 11:43 PM
The first time I saw someone's IP being displayed was in Blizzard Chat 2, in the fall of 1998.  As chat users would log onto battle.net, their start channel was always Blizzard Chat [n].  Someone had a binary bot in there (before I ever saw the first nbbot, SoulburnerNN, or Adron) grabbing the IP off the join packet.
Title: Re:Error converting IP
Post by: Networks on February 07, 2004, 02:06 PM
well i was just thinking if it showed an IP for a user if they logon maybe it'd be easier to ban floodbots because they'll have the same IP everytime they logon to b.net?
Title: Re:Error converting IP
Post by: UserLoser. on February 07, 2004, 04:10 PM
How about using inet_ntoa()?
Title: Re:Error converting IP
Post by: Tazo on February 08, 2004, 10:38 AM
Quote from: Networks on February 07, 2004, 02:06 PM
well i was just thinking if it showed an IP for a user if they logon maybe it'd be easier to ban floodbots because they'll have the same IP everytime they logon to b.net?
Proxies