whois lookup search in IGOR.
andyfaff
Requires SOCKIT XOP.
#pragma rtGlobals=1 // Use modern global access method.
Function whois(IP_Host, server)
string IP_Host //contains IP address (137.157.202.40) or host name (google.com)
variable server //whois server
variable socknum = 0
make/t/o whoisbuffer
Wave/t whoisbuffer
string servername
switch(server)
case 0: //RIPE
servername = "whois.ripe.net"
break
case 1: //Asia-Pacific == APNIC
servername = "whois.apnic.net"
break
case 2: //ARIN
servername = "whois.arin.net"
break
case 3: //AfriNIC
servername = "whois.afrinic.net"
break
case 4: //LACNIC
servername = "whois.lacnic.net"
break
case 5: //internic
servername = "whois.internic.net"
break
case 6: //networksolutions
servername = "whois.networksolutions.com"
break
endswitch
sockitopenconnection/q socknum, servername, 43, whoisbuffer
if(V_flag == 0)
sockitsendnrecv/TIME=10 sockNum, IP_HOST+"\r\n"
if(V_Flag==0)
S_tcp = replacestring("\n", S_tcp, "\r")
print S_tcp
else
print "Error, whois lookup failed for some reason"
killwaves/z whoisbuffer
return 1
endif
else
print "Error, connection to whois server not made"
killwaves/z whoisbuffer
return 1
endif
killwaves/z whoisbuffer
End
Function whois(IP_Host, server)
string IP_Host //contains IP address (137.157.202.40) or host name (google.com)
variable server //whois server
variable socknum = 0
make/t/o whoisbuffer
Wave/t whoisbuffer
string servername
switch(server)
case 0: //RIPE
servername = "whois.ripe.net"
break
case 1: //Asia-Pacific == APNIC
servername = "whois.apnic.net"
break
case 2: //ARIN
servername = "whois.arin.net"
break
case 3: //AfriNIC
servername = "whois.afrinic.net"
break
case 4: //LACNIC
servername = "whois.lacnic.net"
break
case 5: //internic
servername = "whois.internic.net"
break
case 6: //networksolutions
servername = "whois.networksolutions.com"
break
endswitch
sockitopenconnection/q socknum, servername, 43, whoisbuffer
if(V_flag == 0)
sockitsendnrecv/TIME=10 sockNum, IP_HOST+"\r\n"
if(V_Flag==0)
S_tcp = replacestring("\n", S_tcp, "\r")
print S_tcp
else
print "Error, whois lookup failed for some reason"
killwaves/z whoisbuffer
return 1
endif
else
print "Error, connection to whois server not made"
killwaves/z whoisbuffer
return 1
endif
killwaves/z whoisbuffer
End
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More