• Welcome to Valhalla Legends Archive.
 

Error converting IP

Started by Tazo, February 05, 2004, 04:08 PM

Previous topic - Next topic

Tazo

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

l)ragon

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.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

Tazo

#2
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

Grok

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?


Spht

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.

Networks

#5
I dont mean to be stupid but does this mean you can discover someones IP on b.net or is it possible?

MyndFyre

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Dyndrilliac

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.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

Kp

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?
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Dyndrilliac

#9
Well,  It does it for SC/BW/Diablo, I just had it set for Diablo at the time.

But, there isn't a point.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

l)ragon

#10
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
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

Grok

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.

Networks

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?

UserLoser.

How about using inet_ntoa()?

Tazo

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