IPInfo

Platform:  TCL
Published  Jun 21, 2012
Updated  Jun 21, 2012
Gets information on IP address
Commands: !ipinfo <ip address> bind pub - !ipinfo ipinfo

proc ipinfo {nick host hand chan arg} {
package require http
if {$arg == ""} { putserv "PRIVMSG $chan :You must provide an ip address to check!"
} else {
set url "http://www.melissadata.com/lookups/iplocation.asp?ipaddress=$arg"
set page [http::data [http::geturl $url]]
if {[regexp {is not valid} $page]} {
putserv "PRIVMSG $chan :Syntax error: Ip must be in the form of 1.2.3.4"
} else {

while {[regexp -line {columresult'>(.*?)<\/td>.*?<b>(.*?)<\/b>} $page a section info]} {
regsub {columresult'>(.*?)<\/td>.*?<b>(.*?)<\/b>} $page "" page
putserv "PRIVMSG $chan :$section: [recode $info]"
}
}
}
}
proc recode {text} {
return [string map {&quot; \" &middot; "" &amp; & &nbsp; ""} [subst [regsub -nocase -all {&#([0-9]{1,5});} $text {\u\1}]]]
}
putlog "IPInfo"

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.