Bu dersimizde Visual Basic .net ile Domain Whois bilgilerini almayı mümkün kılan sınıfı görelim. Bu sınıf ile tüm global üst domainlerin whois bilgisini öğrenebilirsiniz.
Alıntı
Public Class DomainWhois
Private Function HtmlErase(ByVal HtmlCode As String) As String
Return Regex.Replace(HtmlCode, "<(.|n)*?>", String.Empty)
End Function
Public Function GetWhois(ByVal DomainName As String) As String
Dim WhoisResult As String = String.Empty
Dim Selected_WhoIs_Server As String = String.Empty
Dim WhoistenGelenler As String = String.Empty
Try
Dim SplitDomain As String() = DomainName.Trim().Split(".")
Dim DomainTLD As String = SplitDomain(SplitDomain.Length - 1)
Select Case DomainTLD
Case "ad"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "ae"
Selected_WhoIs_Server = "whois.aeda.net.ae"
Exit Select
Case "aero"
Selected_WhoIs_Server = "whois.aero"
Exit Select
Case "af"
Selected_WhoIs_Server = "whois.nic.af"
Exit Select
Case "ag"
Selected_WhoIs_Server = "whois.nic.ag"
Exit Select
Case "ai"
Selected_WhoIs_Server = "whois.ai"
Exit Select
Case "al"
Selected_WhoIs_Server = "whois.ai"
Exit Select
Case "am"
Selected_WhoIs_Server = "whois.amnic.net"
Exit Select
Case "arpa"
Selected_WhoIs_Server = "whois.iana.org"
Exit Select
Case "as"
Selected_WhoIs_Server = "whois.nic.as"
Exit Select
Case "asia"
Selected_WhoIs_Server = "whois.nic.asia"
Exit Select
Case "at"
Selected_WhoIs_Server = "whois.nic.at"
Exit Select
Case "au"
Selected_WhoIs_Server = "whois.ausregistry.net"
Exit Select
Case "az"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "be"
Selected_WhoIs_Server = "whois.dns.be"
Exit Select
Case "bg"
Selected_WhoIs_Server = "whois.register.bg"
Exit Select
Case "biz"
Selected_WhoIs_Server = "whois.biz"
Exit Select
Case "bj"
Selected_WhoIs_Server = "whois.nic.bj"
Exit Select
Case "bo"
Selected_WhoIs_Server = "whois.nic.bo"
Exit Select
Case "by"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "bz"
Selected_WhoIs_Server = "bzwhois.verisign-grs.co"
Exit Select
Case "ca"
Selected_WhoIs_Server = "whois.cira.ca"
Exit Select
Case "cat"
Selected_WhoIs_Server = "whois.cat"
Exit Select
Case "cc"
Selected_WhoIs_Server = "ccwhois.verisign-grs.com"
Exit Select
Case "ch"
Selected_WhoIs_Server = "whois.nic.ch"
Exit Select
Case "ci"
Selected_WhoIs_Server = "whois.nic.ci"
Exit Select
Case "ck"
Selected_WhoIs_Server = "whois.ck-nic.org.ck"
Exit Select
Case "cl"
Selected_WhoIs_Server = "whois.nic.cl"
Exit Select
Case "cn"
Selected_WhoIs_Server = "whois.cnnic.net.cn"
Exit Select
Case "com"
'.com domaini için farklı whois sunucularından birini seçebilirsiniz.
'Selected_WhoIs_Server = "whois.opensrs.net"
Selected_WhoIs_Server = "whois.internic.net"
'Selected_WhoIs_Server = "whois.verisign-grs.com"
'Selected_WhoIs_Server = "whois.++++++++++.net"
Exit Select
Case "coop"
Selected_WhoIs_Server = "whois.nic.coop"
Exit Select
Case "cx"
Selected_WhoIs_Server = "whois.nic.cx"
Exit Select
Case "cy"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "cz"
Selected_WhoIs_Server = "whois.nic.cz"
Exit Select
Case "de"
Selected_WhoIs_Server = "whois.denic.de"
Exit Select
Case "dk"
Selected_WhoIs_Server = "whois.dk-hostmaster.dk"
Exit Select
Case "dm"
Selected_WhoIs_Server = "whois.nic.dm"
Exit Select
Case "do"
Selected_WhoIs_Server = "ns.nic.do"
Exit Select
Case "ec"
Selected_WhoIs_Server = "whois.nic.ec"
Exit Select
Case "edu"
Selected_WhoIs_Server = "whois.educause.edu"
Exit Select
Case "ee"
Selected_WhoIs_Server = "whois.eenet.ee"
Exit Select
Case "eg"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "es"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "eu"
Selected_WhoIs_Server = "whois.eu"
Exit Select
Case "fi"
Selected_WhoIs_Server = "whois.ficora.fi"
Exit Select
Case "fo"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "fr"
Selected_WhoIs_Server = "whois.nic.fr"
Exit Select
Case "ga"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "gb"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "gd"
Selected_WhoIs_Server = "whois.adamsnames.com"
Exit Select
Case "ge"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "gg"
Selected_WhoIs_Server = "whois.gg"
Exit Select
Case "gi"
Selected_WhoIs_Server = "whois2.afilias-grs.net"
Exit Select
Case "gl"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "gm"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "gov"
Selected_WhoIs_Server = "whois.dotgov.gov"
Exit Select
Case "gr"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "gs"
Selected_WhoIs_Server = "whois.nic.gs"
Exit Select
Case "gy"
Selected_WhoIs_Server = "whois.registry.gy"
Exit Select
Case "hk"
Selected_WhoIs_Server = "whois.hkirc.hk"
Exit Select
Case "hm"
Selected_WhoIs_Server = "webhost1.capital.hm"
Exit Select
Case "hn"
Selected_WhoIs_Server = "whois2.afilias-grs.net"
Exit Select
Case "hr"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "ht"
Selected_WhoIs_Server = "whois.nic.ht"
Exit Select
Case "hu"
Selected_WhoIs_Server = "whois.nic.hu"
Exit Select
Case "ie"
Selected_WhoIs_Server = "whois.domainregistry.ie"
Exit Select
Case "il"
Selected_WhoIs_Server = "whois.isoc.org.il"
Exit Select
Case "im"
Selected_WhoIs_Server = "whois.nic.im"
Exit Select
Case "in"
Selected_WhoIs_Server = "whois.inregistry.net"
Exit Select
Case "info"
Selected_WhoIs_Server = "whois.afilias.net"
Exit Select
Case "int"
Selected_WhoIs_Server = "whois.iana.org"
Exit Select
Case "io"
Selected_WhoIs_Server = "whois.nic.io"
Exit Select
Case "ir"
Selected_WhoIs_Server = "whois.nic.ir"
Exit Select
Case "is"
Selected_WhoIs_Server = "whois.isnic.is"
Exit Select
Case "it"
Selected_WhoIs_Server = "whois.nic.it"
Exit Select
Case "je"
Selected_WhoIs_Server = "whois.je"
Exit Select
Case "jo"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "jobs"
Selected_WhoIs_Server = "jobswhois.verisign-grs.com"
Exit Select
Case "jp"
Selected_WhoIs_Server = "whois.jprs.jp"
Exit Select
Case "ke"
Selected_WhoIs_Server = "whois.kenic.or.ke"
Exit Select
Case "kg"
Selected_WhoIs_Server = "whois.domain.kg"
Exit Select
Case "ki"
Selected_WhoIs_Server = "whois.nic.ki"
Exit Select
Case "kp"
Selected_WhoIs_Server = "whois.kcce.kp"
Exit Select
Case "kr"
Selected_WhoIs_Server = "whois.nic.or.kr"
Exit Select
Case "kz"
Selected_WhoIs_Server = "whois.nic.kz"
Exit Select
Case "la"
Selected_WhoIs_Server = "whois.nic.la"
Exit Select
Case "li"
Selected_WhoIs_Server = "whois.nic.li"
Exit Select
Case "lt"
Selected_WhoIs_Server = "whois.domreg.lt"
Exit Select
Case "lu"
Selected_WhoIs_Server = "whois.dns.lu"
Exit Select
Case "lv"
Selected_WhoIs_Server = "whois.nic.lv"
Exit Select
Case "ly"
Selected_WhoIs_Server = "whois.nic.ly"
Exit Select
Case "ma"
Selected_WhoIs_Server = "whois.iam.net.ma"
Exit Select
Case "mc"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "md"
Selected_WhoIs_Server = "whois.nic.md"
Exit Select
Case "me"
Selected_WhoIs_Server = "whois.meregistry.net"
Exit Select
Case "mg"
Selected_WhoIs_Server = "whois.nic.mg"
Exit Select
Case "mk"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "mn"
Selected_WhoIs_Server = "whois.nic.mn"
Exit Select
Case "mobi"
Selected_WhoIs_Server = "whois.dotmobiregistry.net"
Exit Select
Case "ms"
Selected_WhoIs_Server = "whois.nic.ms"
Exit Select
Case "mt"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "mu"
Selected_WhoIs_Server = "whois.nic.mu"
Exit Select
Case "museum"
Selected_WhoIs_Server = "whois.museum"
Exit Select
Case "mx"
Selected_WhoIs_Server = "whois.nic.mx"
Exit Select
Case "my"
Selected_WhoIs_Server = "whois.mynic.net.my"
Exit Select
Case "na"
Selected_WhoIs_Server = "whois.na-nic.com.na"
Exit Select
Case "name"
Selected_WhoIs_Server = "whois.nic.name"
Exit Select
Case "net"
Selected_WhoIs_Server = "whois.verisign-grs.com"
Exit Select
Case "nl"
Selected_WhoIs_Server = "whois.domain-registry.nl"
Exit Select
Case "no"
Selected_WhoIs_Server = "whois.norid.no"
Exit Select
Case "nu"
Selected_WhoIs_Server = "whois.nic.nu"
Exit Select
Case "nz"
Selected_WhoIs_Server = "whois.srs.net.nz"
Exit Select
Case "org"
Selected_WhoIs_Server = "whois.publicinterestregistry.net"
Exit Select
Case "pe"
Selected_WhoIs_Server = "kero.yachay.pe"
Exit Select
Case "pl"
Selected_WhoIs_Server = "whois.dns.pl"
Exit Select
Case "pm"
Selected_WhoIs_Server = "whois.nic.pm"
Exit Select
Case "pr"
Selected_WhoIs_Server = "whois.nic.pr"
Exit Select
Case "pro"
Selected_WhoIs_Server = "whois.registrypro.pro"
Exit Select
Case "pt"
Selected_WhoIs_Server = "whois.dns.pt"
Exit Select
Case "re"
Selected_WhoIs_Server = "whois.nic.re"
Exit Select
Case "ro"
Selected_WhoIs_Server = "whois.rotld.ro"
Exit Select
Case "ru"
Selected_WhoIs_Server = "whois.ripn.net"
Exit Select
Case "sa"
Selected_WhoIs_Server = "whois.saudinic.net.sa"
Exit Select
Case "sb"
Selected_WhoIs_Server = "whois.nic.net.sb"
Exit Select
Case "sc"
Selected_WhoIs_Server = "whois2.afilias-grs.net"
Exit Select
Case "se"
Selected_WhoIs_Server = "whois.iis.se"
Exit Select
Case "sg"
Selected_WhoIs_Server = "whois.nic.net.sg"
Exit Select
Case "sh"
Selected_WhoIs_Server = "whois.nic.sh"
Exit Select
Case "si"
Selected_WhoIs_Server = "whois.arnes.si"
Exit Select
Case "sk"
Selected_WhoIs_Server = "whois.sk-nic.sk"
Exit Select
Case "sm"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "sn"
Selected_WhoIs_Server = "whois.nic.sn"
Exit Select
Case "so"
Selected_WhoIs_Server = "whois.nic.so"
Exit Select
Case "st"
Selected_WhoIs_Server = "whois.nic.st"
Exit Select
Case "su"
Selected_WhoIs_Server = "whois.ripn.net"
Exit Select
Case "tc"
Selected_WhoIs_Server = "whois.adamsnames.tc"
Exit Select
Case "tel"
Selected_WhoIs_Server = "whois.nic.tel"
Exit Select
Case "tf"
Selected_WhoIs_Server = "whois.nic.tf"
Exit Select
Case "th"
Selected_WhoIs_Server = "whois.thnic.net"
Exit Select
Case "tk"
Selected_WhoIs_Server = "whois.dot.tk"
Exit Select
Case "tl"
Selected_WhoIs_Server = "whois.nic.tl"
Exit Select
Case "tm"
Selected_WhoIs_Server = "whois.nic.tm"
Exit Select
Case "tn"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "to"
Selected_WhoIs_Server = "whois.tonic.to"
Exit Select
Case "tr"
Selected_WhoIs_Server = "whois.nic.tr"
Exit Select
Case "travel"
Selected_WhoIs_Server = "whois.nic.travel"
Exit Select
Case "tv"
Selected_WhoIs_Server = "tvwhois.verisign-grs.com"
Exit Select
Case "tw"
Selected_WhoIs_Server = "whois.twnic.net.tw"
Exit Select
Case "ua"
Selected_WhoIs_Server = "whois.net.ua"
Exit Select
Case "ug"
Selected_WhoIs_Server = "whois.co.ug"
Exit Select
Case "uk"
Selected_WhoIs_Server = "whois.nic.uk"
Exit Select
Case "us"
Selected_WhoIs_Server = "whois.nic.us"
Exit Select
Case "uy"
Selected_WhoIs_Server = "whois.nic.org.uy"
Exit Select
Case "uz"
Selected_WhoIs_Server = "whois.cctld.uz"
Exit Select
Case "va"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "vc"
Selected_WhoIs_Server = "whois2.afilias-grs.net"
Exit Select
Case "ve"
Selected_WhoIs_Server = "whois.nic.ve"
Exit Select
Case "vg"
Selected_WhoIs_Server = "whois.adamsnames.tc"
Exit Select
Case "wf"
Selected_WhoIs_Server = "whois.nic.wf"
Exit Select
Case "ws"
Selected_WhoIs_Server = "whois.website.ws"
Exit Select
Case "yt"
Selected_WhoIs_Server = "whois.nic.yt"
Exit Select
Case "yu"
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
Case "xxx"
Selected_WhoIs_Server = "whois.nic.xxx"
Exit Select
Case Else
Selected_WhoIs_Server = "whois.ripe.net"
Exit Select
End Select
Dim tcpc As New TcpClient()
tcpc.Connect(Selected_WhoIs_Server, 43)
Dim strDomain As String = DomainName.Trim() + System.Environment.NewLine
Dim arrDomain As Byte() = Encoding.ASCII.GetBytes(strDomain.ToCharArray())
Dim s As Stream = tcpc.GetStream()
s.Write(arrDomain, 0, strDomain.Length)
Dim sr As New StreamReader(tcpc.GetStream(), Encoding.[Default])
WhoistenGelenler = sr.ReadToEnd()
tcpc.Close()
sr.Close()
WhoisResult = HtmlErase(WhoistenGelenler)
Catch e As Exception
WhoisResult = "Whois Error : " & e.Message
End Try
Return WhoisResult
End Function
End Class
Kolay gelsin.