Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
13
Task/DNS-query/Ada/dns-query-1.adb
Normal file
13
Task/DNS-query/Ada/dns-query-1.adb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with GNAT.Sockets; use GNAT.Sockets;
|
||||
|
||||
procedure DNSQuerying is
|
||||
|
||||
Host : Host_Entry_Type (1, 1);
|
||||
Inet_Addr_V4 : Inet_Addr_Type (Family_Inet);
|
||||
begin
|
||||
|
||||
Host := Get_Host_By_Name (Name => "www.kame.net");
|
||||
Inet_Addr_V4 := Addresses (Host);
|
||||
Put ("IPv4: " & Image (Value => Inet_Addr_V4));
|
||||
end DNSQuerying;
|
||||
14
Task/DNS-query/Ada/dns-query-2.adb
Normal file
14
Task/DNS-query/Ada/dns-query-2.adb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with GNAT.Sockets; use Gnat.Sockets;
|
||||
procedure DNSQuerying is
|
||||
procedure Print_Address_Info (Host, Serv : String; Family : Family_Type := Family_Unspec) is
|
||||
Addresses : Address_Info_Array := Get_Address_Info (Host, Serv, Family, Passive => False, Numeric_Host => False);
|
||||
Inet_Addr_V6: Inet_Addr_Type(Family_Inet6);
|
||||
begin
|
||||
Sort (Addresses, IPv6_TCP_Preferred'Access);
|
||||
Inet_Addr_V6 := Addresses(1).Addr.Addr;
|
||||
Put_Line("IPv6: " & Image(Value => Inet_Addr_V6));
|
||||
end Print_Address_Info;
|
||||
begin
|
||||
Print_Address_Info ("ipv6.google.com", "https", Family_Inet6);
|
||||
end DNSQuerying;
|
||||
38
Task/DNS-query/Batch-File/dns-query-1.bat
Normal file
38
Task/DNS-query/Batch-File/dns-query-1.bat
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
:: DNS Query Task from Rosetta Code Wiki
|
||||
:: Batch File Implementation
|
||||
|
||||
@echo off
|
||||
|
||||
set "domain=www.kame.net"
|
||||
echo DOMAIN: "%domain%"
|
||||
echo(
|
||||
call :DNS_Lookup "%domain%"
|
||||
pause
|
||||
exit /b
|
||||
|
||||
::Main Procedure
|
||||
::Uses NSLOOKUP Command. Also uses a dirty "parsing" to detect IP addresses.
|
||||
:DNS_Lookup [domain]
|
||||
|
||||
::Define Variables and the TAB Character
|
||||
set "dom=%~1"
|
||||
set "record="
|
||||
set "reccnt=0"
|
||||
for /f "delims=" %%T in ('forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c echo(0x09"') do set "TAB=%%T"
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
for /f "tokens=1* delims=:" %%x in ('nslookup "!dom!" 2^>nul') do (
|
||||
set "line=%%x"
|
||||
if /i "!line:~0,4!"=="Name" set "record=yes"
|
||||
if /i "!line:~0,5!"=="Alias" set "record="
|
||||
if "!record!"=="yes" (
|
||||
set /a reccnt+=1
|
||||
if "%%y"=="" (set "catch_!reccnt!=%%x") else (set "catch_!reccnt!=%%x:%%y")
|
||||
)
|
||||
)
|
||||
for /l %%c in (1,1,%reccnt%) do (
|
||||
if /i "!catch_%%c:~0,7!"=="Address" echo(!catch_%%c:*s: =!
|
||||
if /i "!catch_%%c:~0,1!"=="%TAB%" echo(!catch_%%c:%TAB% =!
|
||||
)
|
||||
endlocal
|
||||
goto :EOF
|
||||
11
Task/DNS-query/Batch-File/dns-query-2.bat
Normal file
11
Task/DNS-query/Batch-File/dns-query-2.bat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@echo off
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
set catch=
|
||||
for /f "skip=4 tokens=*" %%g in ('nslookup www.kame.net 2^>nul') do (
|
||||
set "a=%%g"
|
||||
if defined catch echo %%g
|
||||
if "!a:~0,7!" equ "Address" (
|
||||
for /f "tokens=2" %%h in ('echo %%g') do echo %%h
|
||||
set catch=1
|
||||
)
|
||||
)
|
||||
14
Task/DNS-query/Batch-File/dns-query-3.bat
Normal file
14
Task/DNS-query/Batch-File/dns-query-3.bat
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
call :getdns -4
|
||||
call :getdns -6
|
||||
goto :eof
|
||||
:getdns
|
||||
for /f "tokens=*" %%g in ('ping %1 -n 1 www.kame.net') do (
|
||||
set a=%%g
|
||||
if "!a:~0,15!" equ "Ping statistics" (
|
||||
echo !a:~20,-1!
|
||||
goto :eof
|
||||
)
|
||||
)
|
||||
goto :eof
|
||||
6
Task/DNS-query/Pluto/dns-query.pluto
Normal file
6
Task/DNS-query/Pluto/dns-query.pluto
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local url = "www.kame.net"
|
||||
print(url)
|
||||
print("\nIPv4:")
|
||||
for os.dnsresolve("A", url) as record do print(record.data) end
|
||||
print("\nIPv6:")
|
||||
for os.dnsresolve("AAAA", url) as record do print(record.data) end
|
||||
2
Task/DNS-query/PowerShell/dns-query.ps1
Normal file
2
Task/DNS-query/PowerShell/dns-query.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$DNS = Resolve-DnsName -Name www.kame.net
|
||||
Write-Host "IPv4:" $DNS.IP4Address "`nIPv6:" $DNS.IP6Address
|
||||
1
Task/DNS-query/Rye/dns-query.rye
Normal file
1
Task/DNS-query/Rye/dns-query.rye
Normal file
|
|
@ -0,0 +1 @@
|
|||
print lookup-ip "www.kame.net"
|
||||
16
Task/DNS-query/VBScript/dns-query.vbs
Normal file
16
Task/DNS-query/VBScript/dns-query.vbs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Function dns_query(url,ver)
|
||||
Set r = New RegExp
|
||||
r.Pattern = "Pinging.+?\[(.+?)\].+"
|
||||
Set objshell = CreateObject("WScript.Shell")
|
||||
Set objexec = objshell.Exec("%comspec% /c " & "ping -" & ver & " " & url)
|
||||
WScript.StdOut.WriteLine "URL: " & url
|
||||
Do Until objexec.StdOut.AtEndOfStream
|
||||
line = objexec.StdOut.ReadLine
|
||||
If r.Test(line) Then
|
||||
WScript.StdOut.WriteLine "IP Version " &_
|
||||
ver & ": " & r.Replace(line,"$1")
|
||||
End If
|
||||
Loop
|
||||
End Function
|
||||
|
||||
Call dns_query(WScript.Arguments(0),WScript.Arguments(1))
|
||||
Loading…
Add table
Add a link
Reference in a new issue