Forum Discussion
The_Bhattman
Nov 08, 2016Nimbostratus
Here is an IRULE that uses the GTM and Google Maps
when HTTP_REQUEST {
set ip [URI::query [HTTP::uri] ip]
set response "\n \n IP Address Geolocation Data Search\n \n \n"
if { ![catch {IP::addr $ip mask 255.255.255.255} ] } {
set geo_properties { country state city zip isp org }
append response "
IP Address Geolocation Data Search
IP
$ip
\n"
foreach property $geo_properties {
set result [whereis $ip $property]
if { $result ne "" } {
append response "
[string toupper $property]
[string toupper $result]
\n"
}
}
append response " \n"
set latitude [whereis $ip latitude]
set longitude [whereis $ip longitude]
if { ($latitude != 0) && ($longitude != 0) } {
append response " \n \n \n lat: $latitude, long: $longitude\n"
} else {
append response " \n \n"
}
append response " "
} else {
append response {
IP Address Geolocation Data Search
IP:
}
}
append response "\n \n"
HTTP::respond 200 content $response
}
I hope this helps, The Bhattman