March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
6
Task/DNS-query/AutoHotkey/dns-query.ahk
Normal file
6
Task/DNS-query/AutoHotkey/dns-query.ahk
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Url := "www.kame.net" , LogFile := "Ping_" A_Now ".log"
|
||||
Runwait, %comspec% /c nslookup %Url%>%LogFile%, , hide
|
||||
FileRead, Contents, %LogFile%
|
||||
FileDelete, %LogFile%
|
||||
RegExMatch(Contents,"Addresses:.+(`r?`n\s+.+)*",Match)
|
||||
MsgBox, % RegExReplace(Match,"(Addresses:|[ `t])")
|
||||
|
|
@ -1,21 +1,4 @@
|
|||
import java.net.InetAddress;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
class DnsQuery {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
InetAddress[] ipAddr = InetAddress.getAllByName("www.kame.net");
|
||||
for(int i=0; i < ipAddr.length ; i++) {
|
||||
if (ipAddr[i] instanceof Inet4Address) {
|
||||
System.out.println("IPv4 : " + ipAddr[i].getHostAddress());
|
||||
} else if (ipAddr[i] instanceof Inet6Address) {
|
||||
System.out.println("IPv6 : " + ipAddr[i].getHostAddress());
|
||||
}
|
||||
}
|
||||
} catch (UnknownHostException uhe) {
|
||||
System.err.println("unknown host");
|
||||
}
|
||||
}
|
||||
}
|
||||
procedure main(A)
|
||||
host := gethost( A[1] | "www.kame.net") | stop("can't translate")
|
||||
write(host.name, ": ", host.addresses)
|
||||
end
|
||||
|
|
|
|||
21
Task/DNS-query/Groovy/dns-query-4.groovy
Normal file
21
Task/DNS-query/Groovy/dns-query-4.groovy
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import java.net.InetAddress;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
class DnsQuery {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
InetAddress[] ipAddr = InetAddress.getAllByName("www.kame.net");
|
||||
for(int i=0; i < ipAddr.length ; i++) {
|
||||
if (ipAddr[i] instanceof Inet4Address) {
|
||||
System.out.println("IPv4 : " + ipAddr[i].getHostAddress());
|
||||
} else if (ipAddr[i] instanceof Inet6Address) {
|
||||
System.out.println("IPv6 : " + ipAddr[i].getHostAddress());
|
||||
}
|
||||
}
|
||||
} catch (UnknownHostException uhe) {
|
||||
System.err.println("unknown host");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue