Hi friends,
I am trying to make my own little WhoIs lookup application. I understand it would probably be easier to use MSHTML, pass the IP to WhoIs and query the results page.
That would be enough to resolve the hosting country and net name.
However, I would also like to read the abuse email addresses. Unfortunately, these are not displayed in plain text (at domaintools.com). Plus: have a look at the source code - it seems that horrible layout coding is a precondition for those sites!![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
What I've got so far is:
a) An API call to resolve the IP into the hostname:
Full code credits to developerfusion.
I also found a simple VB6 WhoIs online, which unfortunately does not seem to work:
I bolded that part because the control stays in State 6 (connecting). ![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
Anyone got any idea that might help me?
Thanks & regards,
MakeItSo
“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
I am trying to make my own little WhoIs lookup application. I understand it would probably be easier to use MSHTML, pass the IP to WhoIs and query the results page.
That would be enough to resolve the hosting country and net name.
However, I would also like to read the abuse email addresses. Unfortunately, these are not displayed in plain text (at domaintools.com). Plus: have a look at the source code - it seems that horrible layout coding is a precondition for those sites!
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
What I've got so far is:
a) An API call to resolve the IP into the hostname:
Code:
Public Function GetHostNameFromIP(ByVal sIPAddress As String) As String
Dim ptrHosent As Long
Dim hAddress As Long
Dim sHost As String
Dim nBytes As Long
'try to open the socket
If InitializeSocket() = True Then
'convert string address to long datatype
hAddress = apiInetAddr(sIPAddress)
'check if an error ocucred
If hAddress <> SOCKET_ERROR Then
'obtain a pointer to the HOSTENT structure
'that contains the name and address
'corresponding to the given network address.
ptrHosent = apiGetHostByAddr(hAddress, 4, AF_INET)
If ptrHosent <> 0 Then
'convert address and
'get resolved hostname
apiCopyMemory ptrHosent, ByVal ptrHosent, 4
nBytes = apiStrLen(ByVal ptrHosent)
If nBytes > 0 Then
'fill the IP address buffer
sHost = Space$(nBytes)
apiCopyMemory ByVal sHost, ByVal ptrHosent, nBytes
GetHostNameFromIP = sHost
End If
Else
MsgBox "Call to gethostbyaddr failed."
End If
'close the socket
CloseSocket
Else
MsgBox "Invalid IP address"
End If
Else
MsgBox "Failed to open Socket"
End If
End Function
I also found a simple VB6 WhoIs online, which unfortunately does not seem to work:
Code:
Private Function whois(domain As String)
Dim sServer As String
sDataIn = ""
sDataBuff = ""
If Right(Text1.Text, 4) = ".com" Then sServer = "rs.internic.net"
If Right(Text1.Text, 4) = ".net" Then sServer = "rs.internic.net"
If Right(Text1.Text, 4) = ".org" Then sServer = "whois.publicinterestregistry.net"
If Right(Text1.Text, 4) = ".edu" Then sServer = "whois.educause.net"
If Right(Text1.Text, 4) = ".gov" Then sServer = "whois.nic.gov"
If Right(Text1.Text, 5) = ".info" Then sServer = "whois.afilias.info"
If Right(Text1.Text, 3) = ".ru" Then sServer = "whois.ripn.ru"
sWinsockCommand = domain
With Winsock1
.Close
.LocalPort = 0
.Connect sServer, 43
[b]whois = .State = sckResolvingHost[/b]
End With
End Function
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
Anyone got any idea that might help me?
Thanks & regards,
MakeItSo
“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.