This script is triggered when you're an IRC operator and you're using WHOIS.
The script will track the IP of the user using www.ip-tracker.org and output the geographical information at the end of the whois:
Kaj is connnecting from (Contintent: Europe (EU), Country: Belgium, State: Vlaams-Brabant, City: city, ISP: Telenet N.V.)
Kaj is at Organization Telenet N.V.
; IP Tracker Script by Kaj
; ONLY WORKS FOR IRC OPERS!
; Checks users their IP @ ip-tracker.org
raw 378:*: {
if ($regex($1-,/is connecting from [*][@](.+)\s(.+)/)) {
var %host $regml(1)
var %ip $regml(2)
set %tracknick $$2
set %trackip %ip
sockopen ip-tracker ip-tracker.org 80
}
}
on *:SOCKOPEN:ip-tracker: {
if ($sockerr) {
echo -a Error: $sock(tracert).wsmsg
}
else {
sockwrite -n $sockname GET /locator/ip-lookup.php?ip= $+ %trackip HTTP/1.0
sockwrite -n $sockname Host: www.ip-tracker.org
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
}
on *:SOCKREAD:ip-tracker: {
sockread %ip-tracker
if $regex(%ip-tracker,/<th>IP Address:</th> <td class='tracking'>([^<>]+)/) {
var %ip $regml(1)
}
if $regex(%ip-tracker,/<th>Hostname:</th> <td>([^<>]+)/) {
var %host $regml(1)
}
if $regex(%ip-tracker,/<th>Continent:<\/th><td class='tracking'>([^<>]+)/) {
var %continent $regml(1)
}
if $regex(%ip-tracker,/<th>Country:</th><td>([^<>]+)/) {
var %country $remove($regml(1), )
}
if $regex(%ip-tracker,/<th>Capital:</th><td class='tracking'>([^<>]+)/) {
var %capital $regml(1)
}
if $regex(%ip-tracker,/<th>State:</th><td class='tracking'>([^<>]+)/) {
var %state $regml(1)
}
if $regex(%ip-tracker,/<th>City Location:</th><td>([^<>]+)/) {
var %city $regml(1)
}
if $regex(%ip-tracker,/<th>ISP:</th><td class='tracking'>([^<>]+)/) {
var %isp $regml(1)
}
if $regex(%ip-tracker,/<th>Organization:</th><td>([^<>]+)/) {
var %organization $regml(1)
echo -a %tracknick is connnecting from (Contintent: %continent $+ , Country: %country $+ , State: %state $+ , City: %city $+ , ISP: %isp $+ )
echo -a %tracknick is at Organization %organization
}
}