I've a script working with unrealircd:
package require http
bind raw - NOTICE ipcheck
proc ipcheck {frm key text} {
if {[string match *!*@* $frm] || ![string match -nocase "*client connecting*" $text]} {
return
}
regexp {:\ ([^ ]+)\s\(([^@]+)@([^\)])+\)\s\[([^\]]+)} $text - unick ident host ip
set data [getipdatas $ip]
if {[dict get $data status] eq "success"} {
set country [encoding convertfrom utf-8 [dict get $data country]]
putserv "PRIVMSG #logger :$unick ($ip) is connecting from $country"
}
}
proc getipdatas { ip } {
::http::config -useragent "lynx"
set ipq [http::geturl http://ip-api.com/json/$ip?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,offset,currency,isp,org,as,asname,reverse,mobile,proxy,hosting,query&lang=fr]
set data [json2dict [http::data $ipq]]
::http::cleanup $ipq
return $data
}
Note that your eggdrop must be ircop and must have +scC snomask.