// Project: DNS Lookup
// Created: 2021-07-16
// By: Virtual Nomad
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "DNS Lookup" )
SetWindowSize( 1280,720, 0 )
SetWindowAllowResize( 1 )
// set display properties
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 )
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )
Type VAR
Label as String
Value as String
EndType
GLOBAL IP as String []
GLOBAL Status as Integer
URL$ = "appgamekit.com"
Lookup(URL$)
do
If GetRawKeyState(27) then End
If Status = 0
Print(URL$)
For x = 0 to IP.Length
Print(IP[x])
Next x
Else
Print(URL$ + " UnResolved")
Endif
Sync()
loop
Function Lookup(URL$)
http = CreateHTTPConnection()
SetHTTPHost( http, "dns.google", 1 )
SendHTTPRequestASync( http, "/resolve?name="+URL$+"&type=A")
while GetHTTPResponseReady(http) = 0
Print( "Connecting..." )
Sync()
endwhile
Strip(GetHTTPResponse(http))
CloseHTTPConnection(http)
DeleteHTTPConnection(http)
EndFunction
Function Strip(This$)
Vars$ as VAR []
Delims$ = "[]{}" + CHR(34)
New$ = StripString(This$,Delims$)
total = CountStringTokens(New$, ",")
If total > 0
for x = 1 to total
This$ = GetStringToken(New$,",",x)
That as VAR
That.Label = GetStringToken(This$,":",1)
That.Value = GetStringToken(This$,":",2)
Vars$.Insert(That)
next x
Endif
Vars$.Sort()
Status = Vars$.Find("Status")
Status = VAL( Vars$[Status].Value )
If Status = 0
for x = 0 to Vars$.Length
If Vars$[x].Label = "data" then IP.Insert(Vars$[x].Value)
Next x
Endif
EndFunction
see the link at the bottom:
https://dns.google/query?name=appgamekit.com
reverse DNS lookup possible with the same method:
https://dns.google/query?name=8.8.8.8